From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konstantin Khorenko Date: Fri, 21 Aug 2026 18:42:23 +0200 Subject: [Devel] [PATCH RHEL10 COMMIT] mm/memory: build the page fault latency accounting for x86 only In-Reply-To: <20260821163718.187766-24-khorenko@virtuozzo.com> Message-ID: <202608211642.67LGgNY1668043@f0.sw.ru> List-Id: The commit is pushed to "branch-rh10-6.12.0-211.39.1.16.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git after rh10-6.12.0-211.39.1.16.6.vz10 ------> commit 490bd4688e3da92f9e7ab0c9675db136ab230749 Author: Eva Kurchatova Date: Fri Aug 21 18:37:09 2026 +0200 mm/memory: build the page fault latency accounting for x86 only mm/memory.c accounts the latency of major page faults into the VZ statistics, converting TSC cycles to nanoseconds with CLKS2NSEC(), which is built on tsc_khz from asm/tsc.h. Both the header and the variable are x86-only, so generic mm/memory.c does not compile elsewhere - User Mode Linux, which we now want for KUnit, has no asm/tsc.h at all: mm/memory.c:90:10: fatal error: asm/tsc.h: No such file or directory Include the header on x86 only and let CLKS2NSEC() evaluate to 0 on other architectures, so the accounting keeps working where there is a cycle counter to read and reports no latency where there is not. Feature: ve: extra statistics (mm, latency) https://virtuozzo.atlassian.net/browse/VSTOR-134732 Signed-off-by: Eva Kurchatova Signed-off-by: Konstantin Khorenko --- mm/memory.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/memory.c b/mm/memory.c index 837194e87664c..5e414c68f3a9c 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -87,7 +87,9 @@ #include #include #include +#ifdef CONFIG_X86 #include +#endif #include "pgalloc-track.h" #include "internal.h" @@ -4455,7 +4457,12 @@ static struct folio *alloc_swap_folio(struct vm_fault *vmf) static DECLARE_WAIT_QUEUE_HEAD(swapcache_wq); +#ifdef CONFIG_X86 #define CLKS2NSEC(c) ((c) * 1000000 / tsc_khz) +#else +/* No cycle counter to convert from outside x86 */ +#define CLKS2NSEC(c) (0) +#endif /* * We enter with non-exclusive mmap_lock (to exclude vma changes,