* [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run
@ 2026-08-21 16:36 Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 01/32] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n Konstantin Khorenko
` (31 more replies)
0 siblings, 32 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
This supersedes the 14-patch series
[PATCH vz10 01/14] sched: fix VZ build errors with CONFIG_CGROUP_SCHED=n
by Eva Kurchatova (VSTOR-134732). The goal is the same - make the in-tree
KUnit tests runnable - and most of the code is hers, but the series is
split per feature, several patches are reworked, two are dropped and nine
are new, so it is easier to review as a fresh series than as a v2.
The goal is reached end to end now:
$ ./tools/testing/kunit/kunit.py run
Testing complete. Ran 408 tests: passed: 397, skipped: 11
Of the 32 patches, 21 come from the old series (18 with Eva as author, 3
reworked to the point where I took authorship and left her a Reported-by),
9 are new, and 3 are upstream cherry-picks.
What changed compared to the old series
=======================================
1. struct ve_struct stays defined for CONFIG_VE=n.
The old series moved it, and all the heavy includes, under
#ifdef CONFIG_VE. That made the type incomplete for CONFIG_VE=n and
broke roughly 80 places - the per-Container connector alone accounts for
79 - of which the series fixed about 15. Measured on this tree: a
CONFIG_VE=n build had 5 errors before the series and about 95 after it.
Nor is it needed for UML: there CONFIG_VE=y, so those includes are
compiled anyway. The only real UML problem in that header was
asm/vdso.h, which is now a 14-line guard (patch 19).
2. No silent behaviour changes in the CONFIG_VE=n stubs.
The old one turned current_user_ns_initial() and is_ve_init_net() into
"return true". The first one is used by sget_fc() to decide whether to
set SB_I_NODEV, so on a CONFIG_VE=n kernel that drops SB_I_NODEV for
mounts from a non-initial user namespace; the second one changes
nf_log_syslog behaviour for non-init netns. Both are dropped.
3. Every patch carries a real Fixes: and the Feature: of the code it fixes,
instead of "Feature: fix KUnit tests" on all 14. Only the five patches
that fix nothing pre-existing - pure enablement - have no Fixes: line.
4. One patch per feature and per config option. The old "fix VZ build
errors with CONFIG_MEMCG=n" alone touched four different config options
(MEMCG, MEMCG_V1, NUMA, VE) and five different VZ features; it is now
seven patches.
5. Bugs in the old patches themselves, fixed here:
- meminfo_proc_show_mi() was left unguarded while its only caller was
guarded, so CONFIG_VE=n did not build (-Werror=unused-function);
- the fdput label in syncfs() and the local variables in kernfs_ioctl()
were left behind by their guards, same class of breakage;
- the guard in proc_oom_score() was placed so that #ifdef/#else split a
scoped_guard(rcu) block in half, leaving an empty rcu section;
- two of the three guards in oom_kill.c were unnecessary and only forced
each other: oom_kill_memcg_member() touches no memcg field at all, and
every function in the "if (oom_group)" block has a !MEMCG stub;
- mem_cgroup_per_node::nid was derived from lruvec_pgdat(&pn->lruvec),
which relies on pgdat being filled in lazily by mem_cgroup_lruvec(),
and did so on the hottest memcg accounting path. The field is now
simply declared in the CONFIG_MEMCG_V1=n branch as well, so no .c file
changes at all.
6. Two patches dropped as unnecessary:
- "mm: page_alloc: guard update_maxlat() with CONFIG_VE": page_alloc.o
builds fine without it, verified; the types it claimed were undefined
are defined unconditionally in kstat.h;
- "ve: vzstat: guard wait_start access with CONFIG_SCHEDSTATS": dead
code once CONFIG_VE selects SCHEDSTATS, and vzstat.c is only built
with CONFIG_VE_CALLS, which depends on VE.
7. Nine places the old series left broken are fixed here: mm/shmem.c (the
CONFIG_MEMCG=n patch missed it, so that config still did not build),
fs/fs_context.c, net/unix/af_unix.c, include/linux/rh_flags.h,
include/linux/rh_waived.h, fs/ext4/Kconfig, drivers/pcmcia/cistpl.c,
kernel/sched/cpuacct.c and tools/testing/kunit/.
The last one matters most: with the RHEL10 -sP shebang, kunit.py cannot
import the modules next to it and does not start at all, so the old
series could not have been tested end to end.
8. Upstream commits instead of local workarounds:
- the !SMP build is fixed by cherry-picking the missing prerequisite,
PERCPU_PTR() (patches 15 and 16), so include/linux/sched.h carries no
local delta and this_rq_raw() stays identical to upstream. UML is
always UP, so this is on the KUnit path, not just an x86 curiosity;
- the pcmcia constification is the upstream commit (patch 29) rather
than a hand-written const.
9. One patch fixes a runtime bug in the shipped kernel: ve0.css without
CSS_NO_REF (patch 22). net_ns_init() takes a reference on ve0 before
cgroup_init() has set up the percpu_ref, so css_get() increments
*(unsigned long __percpu *)NULL - whatever lives at the start of
the percpu area - on every boot. The old series had the same one-line
fix but described it as a UML build issue.
Verification
============
production config (redhat/configs/build_configs.sh kernel rhel),
full vmlinux, at every one of the 33 checkpoints
(base commit plus all 32 patches) 33 OK, 0 FAIL
x86_64 defconfig, full build OK (5 compile errors and
2 undefined references before)
x86_64 defconfig with SMP=n, full build OK (never built before)
ARCH=um defconfig, full build OK
kunit.py run 408 tests, 397 passed,
11 skipped, 0 failed
VE=n; MEMCG=n; MEMCG_V1=n; NUMA=n;
CGROUP_SCHED=n + CGROUP_CPUACCT=n 0 errors
Notes
=====
- "select POSIX_MQUEUE" in patch 7 is the one select I cannot justify by
build failure: it is about the environment a Container expects, not about
compiling. Say the word and it goes.
- CONFIG_CGROUPS=n still does not build, and patch 24 says so explicitly:
struct ve_struct embeds a struct cgroup_subsys_state, so ve.h needs the
cgroup core in any case.
- CONFIG_VE=n compiles but is not functional - get_exec_env() returns NULL
there, so such a kernel would crash on the first aio or coredump path.
Making it work is separate work: 15 patches for the global aio counters,
core_pattern, sync, printk and the per-Container connector, none of which
is needed for KUnit.
Eva Kurchatova (18):
sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n
sched/core: guard cpu_cgrp_subsys.depends_on with
CONFIG_CGROUP_CPUACCT
ve: source Kconfig.openvz from arch/um/Kconfig
ve: select CGROUP_PERF only if PERF_EVENTS
ve: add missing Kconfig selects for CONFIG_VE
mm/oom: build the berserker mode only with CONFIG_MEMCG
proc: build the per-Container oom_score limit lookup only with
CONFIG_MEMCG
mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE
mm/vmstat: build the /proc/vmstat virtualization only with CONFIG_VE
mm/memcontrol: build memory.numa_migrate only with CONFIG_NUMA
mm/memcontrol: add missing inline to the mem_cgroup_fill_meminfo()
stub
block: guard the cbt_list initialization with CONFIG_BLK_DEV_CBT
ve: compile the per-Container VDSO copies only on x86
ve: compile the CPUID override propagation only on x86
ve: mark ve0.css with CSS_NO_REF
mm/memory: build the page fault latency accounting for x86 only
sched/core: include cgroup-internal.h only where it is used
kernfs: build the KERNFS_GET_NS ioctl only with CONFIG_NET
Konstantin Khorenko (11):
sched: move MAX_CPU_RATE out of CONFIG_CFS_CPULIMIT
sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT
mm/shmem: build the tmpfs size virtualization only with CONFIG_VE
mm/memcg: keep mem_cgroup_per_node::nid available with
CONFIG_MEMCG_V1=n
ve: include asm/vdso.h on x86 only
fs/fs_context: build the mount option formatting only with CONFIG_VE
net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n
redhat: rh_flags: make the !CONFIG_RHEL_DIFFERENCES stubs inline
redhat: rh_waived: add a stub for CONFIG_RHEL_DIFFERENCES=n
ext4: select LIBCRC32C
kunit: add the script dir to sys.path for PYTHONSAFEPATH compatibility
Thomas Wei?schuh (1):
ms/pcmcia: cistpl: Constify 'struct bin_attribute'
Uros Bizjak (2):
ms/percpu: introduce PERCPU_PTR() macro
ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long
arch/um/Kconfig | 2 ++
block/blk-core.c | 2 ++
drivers/pcmcia/cistpl.c | 8 ++++----
fs/ext4/Kconfig | 1 +
fs/fs_context.c | 2 ++
fs/kernfs/file.c | 8 ++++----
fs/proc/base.c | 2 ++
fs/proc/meminfo.c | 4 ++++
include/linux/memcontrol.h | 8 +++++++-
include/linux/percpu-defs.h | 15 ++++++++++-----
include/linux/rh_flags.h | 4 ++--
include/linux/rh_waived.h | 7 +++++++
include/linux/sched/loadavg.h | 11 ++++++++++-
include/linux/ve.h | 14 ++++++++++++--
kernel/Kconfig.openvz | 9 ++++++++-
kernel/sched/core.c | 4 ++++
kernel/sched/cpuacct.c | 2 ++
kernel/sched/loadavg.c | 6 ++++--
kernel/sched/sched.h | 9 ++++++++-
kernel/ve/ve.c | 13 +++++++++++++
mm/memcontrol.c | 2 +-
mm/memory.c | 7 +++++++
mm/oom_kill.c | 4 ++++
mm/shmem.c | 23 +++++++++++++----------
mm/show_mem.c | 2 ++
mm/vmstat.c | 19 +++++++++++++------
net/unix/af_unix.c | 2 +-
tools/testing/kunit/kunit.py | 1 +
tools/testing/kunit/kunit_tool_test.py | 2 ++
29 files changed, 152 insertions(+), 41 deletions(-)
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 01/32] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 02/32] sched/core: guard cpu_cgrp_subsys.depends_on with CONFIG_CGROUP_CPUACCT Konstantin Khorenko
` (30 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
get_avenrun_tg() dereferences struct task_group, which is only defined
under CONFIG_CGROUP_SCHED in kernel/sched/sched.h. Both the function
and its unconditional caller are compiled regardless of that option:
kernel/sched/loadavg.c is pulled into build_utility.c, and do_sysinfo()
calls get_avenrun_tg() from a branch that is dead at runtime with
CONFIG_VE=n but still compiled. So CONFIG_CGROUP_SCHED=n does not
build:
kernel/sched/loadavg.c: error: invalid use of undefined type
'struct task_group'
Compile get_avenrun_tg() only when CONFIG_CGROUP_SCHED is enabled and
provide a stub otherwise. The stub returns -ENOSYS, the same error the
real implementation returns when there is no per-Container task group to
report. do_sysinfo() ignores the return value and info->loads is
already zeroed by memset(), so no caller has to change.
calc_load_ve() walks the very same task_group internals, so require
CONFIG_CGROUP_SCHED there as well: the dependency then stands where the
code is, instead of being implied by the select list of CONFIG_VE.
Fixes: c80eee4588ff ("ve/sched/loadavg: Calculate avenrun for Containers root cpu cgroups")
Feature: statistics: loadavg virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/sched/loadavg.h | 11 ++++++++++-
kernel/sched/loadavg.c | 6 ++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/linux/sched/loadavg.h b/include/linux/sched/loadavg.h
index 771e753e4670..b97635dc47d4 100644
--- a/include/linux/sched/loadavg.h
+++ b/include/linux/sched/loadavg.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_SCHED_LOADAVG_H
#define _LINUX_SCHED_LOADAVG_H
+#include <linux/errno.h>
#include <linux/types.h>
/*
@@ -18,8 +19,16 @@ extern unsigned long avenrun[]; /* Load averages */
extern void get_avenrun(unsigned long *loads, unsigned long offset, int shift);
struct task_group;
+#ifdef CONFIG_CGROUP_SCHED
extern int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
unsigned long offset, int shift);
+#else
+static inline int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
+ unsigned long offset, int shift)
+{
+ return -ENOSYS;
+}
+#endif
#define FSHIFT 11 /* nr of bits of precision */
#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
@@ -51,7 +60,7 @@ extern unsigned long calc_load_n(unsigned long load, unsigned long exp,
extern bool calc_global_load(void);
-#ifdef CONFIG_VE
+#if defined(CONFIG_VE) && defined(CONFIG_CGROUP_SCHED)
extern void calc_load_ve(void);
#else
#define calc_load_ve() do { } while (0)
diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index bc0b6bcdae2d..2f66772750ea 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -78,6 +78,7 @@ void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
loads[2] = (avenrun[2] + offset) << shift;
}
+#ifdef CONFIG_CGROUP_SCHED
int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
unsigned long offset, int shift)
{
@@ -93,6 +94,7 @@ int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
return 0;
}
+#endif /* CONFIG_CGROUP_SCHED */
long calc_load_fold_active(struct rq *this_rq, long adjust)
{
@@ -109,7 +111,7 @@ long calc_load_fold_active(struct rq *this_rq, long adjust)
return delta;
}
-#ifdef CONFIG_VE
+#if defined(CONFIG_VE) && defined(CONFIG_CGROUP_SCHED)
extern struct list_head ve_root_list;
extern raw_spinlock_t load_ve_lock;
@@ -166,7 +168,7 @@ void calc_load_ve(void)
kstat_glob.nr_unint_avg[2] = calc_load(kstat_glob.nr_unint_avg[2], EXP_15, nr_unint);
write_seqcount_end(&kstat_glob.nr_unint_avg_seq);
}
-#endif /* CONFIG_VE */
+#endif /* CONFIG_VE && CONFIG_CGROUP_SCHED */
/**
* fixed_power_int - compute: x^n, in O(log n) time
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 02/32] sched/core: guard cpu_cgrp_subsys.depends_on with CONFIG_CGROUP_CPUACCT
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 01/32] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 03/32] sched: move MAX_CPU_RATE out of CONFIG_CFS_CPULIMIT Konstantin Khorenko
` (29 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
cpuacct_cgrp_id is only declared when CONFIG_CGROUP_CPUACCT is enabled -
SUBSYS(cpuacct) in include/linux/cgroup_subsys.h sits under
IS_ENABLED(CONFIG_CGROUP_CPUACCT) - while the cpu controller itself is
built whenever CONFIG_CGROUP_SCHED is set. With CONFIG_CGROUP_SCHED=y
and CONFIG_CGROUP_CPUACCT=n the initializer does not compile:
kernel/sched/core.c: error: 'cpuacct_cgrp_id' undeclared here
(not in a function)
There is nothing for the cpu controller to depend on when cpuacct is not
built, so simply drop the dependency in that configuration.
Fixes: 776275586407 ("cgroup: allow cpuacct to be enabled in v2 hierarchy")
Feature: sched: emulate virtual cpus for Containers
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/sched/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d5b4d8c97a0c..7d2214749245 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10441,7 +10441,9 @@ struct cgroup_subsys cpu_cgrp_subsys = {
.dfl_cftypes = cpu_files,
.early_init = true,
.threaded = true,
+#ifdef CONFIG_CGROUP_CPUACCT
.depends_on = 1 << cpuacct_cgrp_id,
+#endif
};
#endif /* CONFIG_CGROUP_SCHED */
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 03/32] sched: move MAX_CPU_RATE out of CONFIG_CFS_CPULIMIT
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 01/32] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 02/32] sched/core: guard cpu_cgrp_subsys.depends_on with CONFIG_CGROUP_CPUACCT Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 04/32] sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT Konstantin Khorenko
` (28 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
MAX_CPU_RATE is the scale of task_group::cpu_rate, but it was defined in
the middle of the body of struct task_group, inside the block guarded by
CONFIG_CFS_CPULIMIT. cpu_cgroup_update_vcpustat() uses it to normalize
the per-vcpu usage reported in a Container's /proc/stat, and that code is
compiled unconditionally, so CONFIG_CFS_CPULIMIT=n does not build:
kernel/sched/cpuacct.c: error: 'MAX_CPU_RATE' undeclared
(first use in this function)
x86_64 defconfig is exactly such a configuration: CONFIG_VE defaults to
y, while CONFIG_CFS_BANDWIDTH - the only thing that selects
CONFIG_CFS_CPULIMIT - is off.
Move the definition out of the struct and out of the ifdef. Nothing
else in cpu_cgroup_update_vcpustat() needs CONFIG_CFS_CPULIMIT:
tg_cpu_rate() and tg_nr_cpus() already degrade to "no limit configured",
so the vcpustat calculation keeps working and a Container simply gets
num_online_cpus() vcpus running at full rate. Compiling the calculation
out instead would leave tg->vcpustat all zeroes, and /proc/stat inside a
Container would report no CPU time at all.
Fixes: 4e99efb641da ("sched: Port CONFIG_CFS_CPULIMIT feature")
Feature: sched: ability to limit number of CPUs available to a CT
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Reported-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/sched/sched.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 1a8a0ff522cb..2a3f73933456 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -533,12 +533,19 @@ struct task_group {
#endif
#ifdef CONFIG_CFS_CPULIMIT
-#define MAX_CPU_RATE 1024
unsigned long cpu_rate;
unsigned int nr_cpus;
#endif
};
+/*
+ * The scale of task_group::cpu_rate: 1024 means one full CPU. It is also
+ * used to normalize the per-vcpu usage reported in a Container's /proc/stat,
+ * which is done regardless of CONFIG_CFS_CPULIMIT, so keep the definition
+ * unconditional.
+ */
+#define MAX_CPU_RATE 1024
+
#ifdef CONFIG_GROUP_SCHED_WEIGHT
#define ROOT_TASK_GROUP_LOAD NICE_0_LOAD
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 04/32] sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (2 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 03/32] sched: move MAX_CPU_RATE out of CONFIG_CFS_CPULIMIT Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 05/32] ve: source Kconfig.openvz from arch/um/Kconfig Konstantin Khorenko
` (27 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
ve_root_tg() has exactly two callers, tg_cpu_rate() and tg_nr_cpus(),
and both reference it only from inside #ifdef CONFIG_CFS_CPULIMIT: the
task_group fields they read, ::cpu_rate and ::nr_cpus, do not exist
without that option. So with CONFIG_CFS_CPULIMIT=n the helper is not
used at all. x86_64 defconfig is exactly that configuration - CONFIG_VE
defaults to y while CONFIG_CFS_BANDWIDTH, the only thing that selects
CONFIG_CFS_CPULIMIT, is off - and it sets CONFIG_WERROR=y as well, so
there the unused function is not a warning but a build failure:
kernel/sched/cpuacct.c:373:27: error: 've_root_tg' defined but not
used [-Werror=unused-function]
Compile ve_root_tg() under the same condition as its call sites.
Fixes: 095994c57b84 ("ve/sched/stat: Introduce functions to calculate vcpustat data")
Feature: sched: emulate virtual cpus for Containers
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/sched/cpuacct.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 01a2b2c3c5b7..6b0ed967316e 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -370,6 +370,7 @@ struct cgroup_subsys cpuacct_cgrp_subsys = {
.threaded = true,
};
+#ifdef CONFIG_CFS_CPULIMIT
static struct task_group *ve_root_tg(struct task_group *tg) {
struct cgroup_subsys_state *css;
@@ -379,6 +380,7 @@ static struct task_group *ve_root_tg(struct task_group *tg) {
css = css_ve_root1(&tg->css);
return css ? css_tg(css) : NULL;
}
+#endif
static unsigned int tg_cpu_rate(struct task_group *tg)
{
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 05/32] ve: source Kconfig.openvz from arch/um/Kconfig
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (3 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 04/32] sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 06/32] ve: select CGROUP_PERF only if PERF_EVENTS Konstantin Khorenko
` (26 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
kernel/Kconfig.openvz was only sourced from arch/x86/Kconfig, making
CONFIG_VE unavailable on UML. Source it from arch/um/Kconfig so that
VZ containers can be enabled when building under User-Mode Linux
(needed for KUnit testing).
CONFIG_VE is "default y", so this alone gives CONFIG_VE=y for a plain
"make ARCH=um defconfig". That is what we want, but it also means every
UML build from here on compiles the VZ code and trips over the x86-only
parts of it; those are fixed up later in this series.
The source line goes after the last endmenu of the file, like the x86 one,
so that the OpenVZ menu does not end up nested inside another menu.
Feature: fix KUnit tests
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
arch/um/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index c89575d05021..5e1b6d025773 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -252,3 +252,5 @@ menu "Power management options"
source "kernel/power/Kconfig"
endmenu
+
+source "kernel/Kconfig.openvz"
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 06/32] ve: select CGROUP_PERF only if PERF_EVENTS
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (4 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 05/32] ve: source Kconfig.openvz from arch/um/Kconfig Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 07/32] ve: add missing Kconfig selects for CONFIG_VE Konstantin Khorenko
` (25 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
CONFIG_CGROUP_PERF depends on CONFIG_PERF_EVENTS, but CONFIG_VE selects
it unconditionally. On architectures or configurations without perf
events - User Mode Linux, for one, which we now want to build for KUnit -
that produces an unmet direct dependency, and a .config with
CGROUP_PERF=y all the same:
WARNING: unmet direct dependencies detected for CGROUP_PERF
Depends on [n]: CGROUPS [=y] && PERF_EVENTS [=n]
Selected by [y]:
- VE [=y]
Such a .config does not link. CONFIG_CGROUP_PERF adds SUBSYS(perf_event)
to include/linux/cgroup_subsys.h, so cgroup.c builds its subsystem tables
with references to perf_event_cgrp_subsys and its two static keys - all of
which live in kernel/events/core.c, built only when CONFIG_PERF_EVENTS is
set:
ld: kernel/cgroup/cgroup.o:(.data+0x26b0): undefined reference to
`perf_event_cgrp_subsys'
Make the select conditional; a kernel without perf events has no use for
the perf controller anyway.
Fixes: ba3113998624 ("Kconfig.openvz: force CGROUP_PERF if compiling VZ Containers code")
Feature: internal
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/Kconfig.openvz | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/Kconfig.openvz b/kernel/Kconfig.openvz
index 9164db1f2acc..9358727c1afa 100644
--- a/kernel/Kconfig.openvz
+++ b/kernel/Kconfig.openvz
@@ -19,7 +19,7 @@ config VE
select CGROUPS
select CGROUP_DEVICE
select CGROUP_FREEZER
- select CGROUP_PERF
+ select CGROUP_PERF if PERF_EVENTS
help
This option adds support of virtual Linux running on the original box
with fully supported virtual network driver, tty subsystem and
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 07/32] ve: add missing Kconfig selects for CONFIG_VE
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (5 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 06/32] ve: select CGROUP_PERF only if PERF_EVENTS Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 08/32] mm/oom: build the berserker mode only with CONFIG_MEMCG Konstantin Khorenko
` (24 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
The select list of CONFIG_VE only ever named the namespaces and a few
cgroup controllers, and got away with it because everything else it needs
happened to be enabled by the RHEL and Virtuozzo x86 configs. It is not
a property of the option itself, though: plain "make defconfig" already
gives CONFIG_VE=y with CONFIG_MEMCG=n, and building for User Mode Linux
(which we now want for KUnit) starts from yet another set of defaults.
Name the dependencies explicitly:
NET - NET_NS depends on it, so selecting NET_NS alone
yields an unmet direct dependency;
CGROUP_SCHED - the cpu cgroup is the per-Container task group:
cgroup_mark_ve_roots(), the per-Container loadavg
and the /proc/stat virtualization all need it;
CGROUP_CPUACCT - per-Container cpu statistics are read from it;
MEMCG, MEMCG_V1 - per-Container memory limits and the /proc/meminfo,
/proc/vmstat and oom_score virtualization are all
built on the memory controller, v1 included;
POSIX_MQUEUE - part of the IPC environment a Container expects;
SCHEDSTATS - kernel/ve/vzstat.c reads task->stats.wait_start, and
all of struct sched_statistics sits under that option.
Fixes: 82652f8a0749 ("ve: Add ve cgroup and ve_hook subsys")
Feature: ve: ve generic structures
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/Kconfig.openvz | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/Kconfig.openvz b/kernel/Kconfig.openvz
index 9358727c1afa..7494048425a5 100644
--- a/kernel/Kconfig.openvz
+++ b/kernel/Kconfig.openvz
@@ -14,12 +14,19 @@ config VE
select PID_NS
select IPC_NS
select UTS_NS
+ select NET
select NET_NS
select USER_NS
select CGROUPS
+ select CGROUP_SCHED
+ select CGROUP_CPUACCT
+ select MEMCG
+ select MEMCG_V1
select CGROUP_DEVICE
select CGROUP_FREEZER
select CGROUP_PERF if PERF_EVENTS
+ select POSIX_MQUEUE
+ select SCHEDSTATS
help
This option adds support of virtual Linux running on the original box
with fully supported virtual network driver, tty subsystem and
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 08/32] mm/oom: build the berserker mode only with CONFIG_MEMCG
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (6 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 07/32] ve: add missing Kconfig selects for CONFIG_VE Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 09/32] proc: build the per-Container oom_score limit lookup " Konstantin Khorenko
` (23 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
oom_berserker() works on the memory cgroup the OOM happened in: it takes
memcg->oom_rage_lock, updates memcg->oom_time/oom_rage, falls back to
root_mem_cgroup and calls task_in_mem_cgroup(). None of that exists when
CONFIG_MEMCG is disabled:
mm/oom_kill.c: error: 'root_mem_cgroup' undeclared
mm/oom_kill.c: error: invalid use of undefined type 'struct mem_cgroup'
Compile the function only when CONFIG_MEMCG is enabled and provide an
empty stub otherwise: without a memory controller there is no per-cgroup
OOM rate to get enraged about, and the caller stays unchanged.
Fixes: 6517e9ae0449 ("oom: resurrect berserker mode")
Feature: mm/oom: berserker mode
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
mm/oom_kill.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 1fd5f99ce3b9..5cf0fefade48 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -1047,6 +1047,7 @@ static int oom_kill_memcg_member(struct task_struct *task, void *message)
/*
* Kill more processes if oom happens too often in this context.
*/
+#ifdef CONFIG_MEMCG
static void oom_berserker(struct oom_control *oc)
{
static DEFINE_RATELIMIT_STATE(berserker_rs,
@@ -1150,6 +1151,9 @@ static void oom_berserker(struct oom_control *oc)
pr_err("OOM killer in rage %d: %d tasks killed\n", rage, killed);
}
+#else
+static inline void oom_berserker(struct oom_control *oc) { }
+#endif /* CONFIG_MEMCG */
atomic_t global_oom = ATOMIC_INIT(0);
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 09/32] proc: build the per-Container oom_score limit lookup only with CONFIG_MEMCG
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (7 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 08/32] mm/oom: build the berserker mode only with CONFIG_MEMCG Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 10/32] mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE Konstantin Khorenko
` (22 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
proc_oom_score() scales the badness against the memory cgroup limit of
the Container the task belongs to, using memory_cgrp_id,
mem_cgroup_from_css() and mem_cgroup_get_max(). None of those exist with
CONFIG_MEMCG disabled:
fs/proc/base.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
Wrap the whole lookup in CONFIG_MEMCG. totalpages is already initialized
to totalram_pages() + total_swap_pages, so without a memory controller
oom_score simply falls back to being scaled against all of the machine's
memory, which is what a kernel without memory cgroups can report.
Fixes: 708b02c17c36 ("proc,memcg: use memcg limits for showing oom_score inside CT")
Feature: mm/oom: per-CT oom_score virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/proc/base.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8174b2a8a5dc..f7cae1c59ec4 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -692,6 +692,7 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
unsigned long points = 0;
long badness;
+#ifdef CONFIG_MEMCG
scoped_guard (rcu) {
struct cgroup_subsys_state *css = task_css(task, memory_cgrp_id);
@@ -703,6 +704,7 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
totalpages = mem_cgroup_get_max(memcg);
}
}
+#endif
badness = oom_badness(task, totalpages, NULL);
/*
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 10/32] mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (8 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 09/32] proc: build the per-Container oom_score limit lookup " Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 11/32] mm/vmstat: build the /proc/vmstat " Konstantin Khorenko
` (21 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
The Container view of /proc/meminfo is built from the memory cgroup of
the Container: si_meminfo_ve() reads memcg->memory / memcg->memsw and
fill_meminfo_ve() looks the cgroup up by memory_cgrp_id. Both are
compiled unconditionally, so with CONFIG_MEMCG=n - which CONFIG_VE=n
allows, and plain "make defconfig" used to produce - the build fails:
mm/show_mem.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
CONFIG_VE selects CONFIG_MEMCG, so CONFIG_VE is the condition to guard
with, and it is the better one anyway: with CONFIG_VE=n the Container view
is dead code even where CONFIG_MEMCG is on. Compile si_meminfo_ve(),
fill_meminfo_ve() and the code that formats that view under it.
meminfo_proc_show_mi() has to go under the same guard as its only caller,
or it is left as an unused static function - an error rather than a
warning in a CONFIG_VE=n build with CONFIG_WERROR=y, which x86_64
defconfig sets.
The callers of si_meminfo_ve() in do_sysinfo() and swaps_open() are
reached only when !ve_is_super(get_exec_env()), which is a compile-time
false with CONFIG_VE=n, so the compiler drops those branches and no stub
is needed.
Fixes: 7710faa9d4f0 ("ve/proc: virtualize /proc/meminfo in a Container")
Feature: procfs: virtualize /proc/meminfo
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/proc/meminfo.c | 4 ++++
mm/show_mem.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index ac3c88e68728..27e8f921f31a 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -34,6 +34,7 @@ static void show_val_kb(struct seq_file *m, const char *s, unsigned long num)
seq_write(m, " kB\n", 4);
}
+#ifdef CONFIG_VE
static int meminfo_proc_show_mi(struct seq_file *m, struct meminfo *mi)
{
unsigned long *pages;
@@ -84,6 +85,7 @@ static void fill_meminfo_ve(struct meminfo *mi, struct ve_struct *ve)
css_put(css);
}
+#endif /* CONFIG_VE */
static int meminfo_proc_show_ve(struct seq_file *m, void *v,
struct ve_struct *ve)
@@ -104,11 +106,13 @@ static int meminfo_proc_show_ve(struct seq_file *m, void *v,
mi.si = &i;
mi.ve = ve;
+#ifdef CONFIG_VE
if (!ve_is_super(ve) && ve->meminfo_val == VE_MEMINFO_DEFAULT) {
fill_meminfo_ve(&mi, ve);
return meminfo_proc_show_mi(m, &mi);
}
+#endif
committed = vm_memory_committed();
diff --git a/mm/show_mem.c b/mm/show_mem.c
index 3ab11c945bf4..15be6c6050e4 100644
--- a/mm/show_mem.c
+++ b/mm/show_mem.c
@@ -91,6 +91,7 @@ void si_meminfo(struct sysinfo *val)
EXPORT_SYMBOL(si_meminfo);
+#ifdef CONFIG_VE
void si_meminfo_ve(struct sysinfo *si, struct ve_struct *ve)
{
unsigned long memtotal, memused, swaptotal, swapused;
@@ -138,6 +139,7 @@ void si_meminfo_ve(struct sysinfo *si, struct ve_struct *ve)
/* bufferram, totalhigh and freehigh left 0 */
}
EXPORT_SYMBOL(si_meminfo_ve);
+#endif /* CONFIG_VE */
#ifdef CONFIG_NUMA
void si_meminfo_node(struct sysinfo *val, int nid)
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 11/32] mm/vmstat: build the /proc/vmstat virtualization only with CONFIG_VE
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (9 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 10/32] mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 12/32] mm/shmem: build the tmpfs size " Konstantin Khorenko
` (20 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
fill_vmstat_ve() fills the Container view of /proc/vmstat from the
Container's memory cgroup, looked up by memory_cgrp_id. It is compiled
unconditionally, so with CONFIG_MEMCG=n - which CONFIG_VE=n allows, and
plain "make defconfig" used to produce - the build fails:
mm/vmstat.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
CONFIG_VE selects CONFIG_MEMCG, so compile both the helper and its call
site under CONFIG_VE. The 've' variable moves into the guarded block:
left at function scope it would be unused with CONFIG_VE=n, which is a
build failure of its own once CONFIG_WERROR=y, as x86_64 defconfig has
it.
Fixes: e15a9e29a433 ("ve/memcg: Virtualize /proc/vmstat view inside CT")
Feature: procfs: virtualize /proc/vmstat
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
mm/vmstat.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 47cb6bf4ecec..d97eb1d33f8a 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1855,6 +1855,7 @@ static const struct seq_operations zoneinfo_op = {
(IS_ENABLED(CONFIG_VM_EVENT_COUNTERS) ? \
NR_VM_EVENT_ITEMS : 0))
+#ifdef CONFIG_VE
static void fill_vmstat_ve(unsigned long *stat, struct ve_struct *ve)
{
struct cgroup_subsys_state *css;
@@ -1863,10 +1864,10 @@ static void fill_vmstat_ve(unsigned long *stat, struct ve_struct *ve)
mem_cgroup_fill_vmstat(mem_cgroup_from_css(css), stat);
css_put(css);
}
+#endif
static void *vmstat_start(struct seq_file *m, loff_t *pos)
{
- struct ve_struct *ve;
unsigned long *v;
int i;
@@ -1880,12 +1881,18 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
if (!v)
return ERR_PTR(-ENOMEM);
- ve = get_exec_env();
- if (!ve_is_super(ve)) {
- memset(v, 0, NR_VMSTAT_ITEMS * sizeof(unsigned long));
- fill_vmstat_ve(v, ve);
- return (unsigned long *)m->private + *pos;
+#ifdef CONFIG_VE
+ {
+ struct ve_struct *ve = get_exec_env();
+
+ if (!ve_is_super(ve)) {
+ memset(v, 0,
+ NR_VMSTAT_ITEMS * sizeof(unsigned long));
+ fill_vmstat_ve(v, ve);
+ return (unsigned long *)m->private + *pos;
+ }
}
+#endif
for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
v[i] = global_zone_page_state(i);
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 12/32] mm/shmem: build the tmpfs size virtualization only with CONFIG_VE
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (10 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 11/32] mm/vmstat: build the /proc/vmstat " Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 13/32] mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n Konstantin Khorenko
` (19 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
tmpfs_ram_pages() sizes a Container's default tmpfs mounts against the
Container's memory cgroup limit, looking the cgroup up by memory_cgrp_id
and reading memcg->memory.max. The function is compiled whenever
CONFIG_TMPFS is set, so with CONFIG_MEMCG=n - which CONFIG_VE=n allows,
and plain "make defconfig" used to produce - the build fails:
mm/shmem.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
mm/shmem.c: error: invalid use of undefined type 'struct mem_cgroup'
CONFIG_VE selects CONFIG_MEMCG, so compile the Container branch under
CONFIG_VE and keep the host branch, which already returns
totalram_pages(), as the only remaining path.
Fixes: e38fda88c26d ("shmem/ve: virtualize tmpfs default size")
Feature: fs: tmpfs virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
mm/shmem.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index a86564c6637e..522322d4f359 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -143,20 +143,23 @@ static bool shmem_orders_configured __initdata;
#ifdef CONFIG_TMPFS
static unsigned long tmpfs_ram_pages(void)
{
+#ifdef CONFIG_VE
struct ve_struct *ve = get_exec_env();
- struct cgroup_subsys_state *css;
- unsigned long ve_ram_pages;
- struct mem_cgroup *memcg;
- if (ve_is_super(ve))
- return totalram_pages();
+ if (!ve_is_super(ve)) {
+ struct cgroup_subsys_state *css;
+ unsigned long ve_ram_pages;
+ struct mem_cgroup *memcg;
- css = ve_get_init_css(ve, memory_cgrp_id);
- memcg = mem_cgroup_from_css(css);
- ve_ram_pages = min(totalram_pages(), memcg->memory.max);
- css_put(css);
+ css = ve_get_init_css(ve, memory_cgrp_id);
+ memcg = mem_cgroup_from_css(css);
+ ve_ram_pages = min(totalram_pages(), memcg->memory.max);
+ css_put(css);
- return ve_ram_pages;
+ return ve_ram_pages;
+ }
+#endif
+ return totalram_pages();
}
static unsigned long shmem_default_max_blocks(void)
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 13/32] mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (11 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 12/32] mm/shmem: build the tmpfs size " Konstantin Khorenko
@ 2026-08-21 16:36 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 14/32] mm/memcontrol: build memory.numa_migrate only with CONFIG_NUMA Konstantin Khorenko
` (18 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:36 UTC (permalink / raw)
mem_cgroup_per_node::nid was added into a kABI hole in the middle of the
CONFIG_MEMCG_V1 part of the structure, but it is not a cgroup-v1 field:
percpu_stats_memcg() reads it on the lruvec stats path, to find the
matching per-node structure of the parent an update is forwarded to once a
dying memcg has had its percpu stats freed. So
CONFIG_MEMCG=y together with CONFIG_MEMCG_V1=n does not build:
mm/memcontrol.c: error: 'struct mem_cgroup_per_node' has no member
named 'nid'
Declare the field in the CONFIG_MEMCG_V1=n branch as well, next to the
other read-mostly members. The v1 branch is left exactly as it is, so
the layout of the shipped kernel - and with it the kABI checksum - does
not change.
Fixes: be640870964f ("mm/memcg: Free percpu stats memory of dying memcg's")
Feature: fix rh/mm
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Reported-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/memcontrol.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 72b6b986a08b..d47c3de71a49 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -109,6 +109,11 @@ struct mem_cgroup_per_node {
bool on_tree;
RH_KABI_FILL_HOLE(unsigned short nid)
#else
+ /*
+ * Not a v1 field: percpu_stats_memcg() needs the node id to find
+ * the matching per-node structure of the parent memcg.
+ */
+ unsigned short nid;
CACHELINE_PADDING(_pad1_);
#endif
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 14/32] mm/memcontrol: build memory.numa_migrate only with CONFIG_NUMA
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (12 preceding siblings ...)
2026-08-21 16:36 ` [Devel] [PATCH vz10 13/32] mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 15/32] ms/percpu: introduce PERCPU_PTR() macro Konstantin Khorenko
` (17 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
memcg_numa_migrate_write() is defined inside the CONFIG_NUMA block of
memcontrol.c, but its cgroup-v2 cftype entry was added after the #endif,
so CONFIG_NUMA=n does not build:
mm/memcontrol.c: error: 'memcg_numa_migrate_write' undeclared here
(not in a function)
Move the entry inside the same CONFIG_NUMA block, next to memory.numa_stat.
A kernel built without NUMA has no nodes to migrate memory between, so
not offering the file is the right behaviour rather than a limitation.
Fixes: fe28fa7a0794 ("mm/memcontrol: add memory.numa_migrate to cgroup-v2")
Feature: mm: interface to migrate memory between NUMA nodes upon userspace request
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6301319529ee..4e0c0c46689a 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5258,12 +5258,12 @@ static struct cftype memory_files[] = {
.name = "numa_stat",
.seq_show = memory_numa_stat_show,
},
-#endif
{
.name = "numa_migrate",
.flags = CFTYPE_NOT_ON_ROOT,
.write = memcg_numa_migrate_write,
},
+#endif
{
.name = "oom.group",
.flags = CFTYPE_NOT_ON_ROOT | CFTYPE_NS_DELEGATABLE,
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 15/32] ms/percpu: introduce PERCPU_PTR() macro
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (13 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 14/32] mm/memcontrol: build memory.numa_migrate only with CONFIG_NUMA Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 16/32] ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long Konstantin Khorenko
` (16 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Uros Bizjak <ubizjak@gmail.com>
Introduce PERCPU_PTR() macro to cast the percpu pointer from the percpu
address space to a generic (kernel) address space. Use it in
per_cpu_ptr() and related SHIFT_PERCPU_PTR() macros.
Also remove common knowledge from SHIFT_PERCPU_PTR() comment, "weird cast"
is just a standard way to inform sparse of a cast from the percpu address
space to a generic address space.
Link: https://lkml.kernel.org/r/20241021080856.48746-2-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 001217defda86d0d6a5a9e6cf77a6b813857e7e3)
Needed here because the RHEL10.2 base brought in the inlined
migrate_disable()/migrate_enable() from a later kernel, and the
this_rq_raw() helper they use expands to PERCPU_PTR() for the !SMP case
while the macro itself was never backported, so CONFIG_SMP=n has never
built:
include/linux/sched.h: error: implicit declaration of function
'PERCPU_PTR'
VERIFY_PERCPU_PTR() cannot be used there instead: like this_cpu_ptr() it
needs the complete type of the pointee, and struct rq is deliberately
opaque in that header - which is the reason this_rq_raw() exists at all.
Conflict resolution:
- !CONFIG_SMP hunk: this tree factors the cast out into
VERIFY_PERCPU_PTR() instead of open-coding it in per_cpu_ptr(), so
the conversion went there and per_cpu_ptr() is left alone.
- dropped the stray trailing semicolon of the upstream macro. With it,
VERIFY_PERCPU_PTR() - which uses PERCPU_PTR() inside a statement
expression - stops evaluating to a pointer and no !SMP build gets
past percpu-defs.h. The next upstream commit, dabddd687c9e ("percpu:
cast percpu pointer in PERCPU_PTR() via unsigned long"), removes the
semicolon anyway; taking it verbatim here would only make this commit
unbuildable.
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix rh/sched
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/percpu-defs.h | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 8efce7414fad..02bcd74afc6c 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -220,15 +220,17 @@ do { \
(void)__vpp_verify; \
} while (0)
+#define PERCPU_PTR(__p) \
+ (typeof(*(__p)) __force __kernel *)(__p)
+
#ifdef CONFIG_SMP
/*
- * Add an offset to a pointer but keep the pointer as-is. Use RELOC_HIDE()
- * to prevent the compiler from making incorrect assumptions about the
- * pointer value. The weird cast keeps both GCC and sparse happy.
+ * Add an offset to a pointer. Use RELOC_HIDE() to prevent the compiler
+ * from making incorrect assumptions about the pointer value.
*/
#define SHIFT_PERCPU_PTR(__p, __offset) \
- RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
+ RELOC_HIDE(PERCPU_PTR(__p), (__offset))
#define per_cpu_ptr(ptr, cpu) \
({ \
@@ -257,7 +259,7 @@ do { \
#define VERIFY_PERCPU_PTR(__p) \
({ \
__verify_pcpu_ptr(__p); \
- (typeof(*(__p)) __kernel __force *)(__p); \
+ PERCPU_PTR(__p); \
})
#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 16/32] ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (14 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 15/32] ms/percpu: introduce PERCPU_PTR() macro Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 17/32] mm/memcontrol: add missing inline to the mem_cgroup_fill_meminfo() stub Konstantin Khorenko
` (15 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Uros Bizjak <ubizjak@gmail.com>
Cast pointer from percpu address space to generic (kernel) address space
in PERCPU_PTR() macro via unsigned long intermediate cast [1]. This
intermediate cast is also required to avoid build failure when GCC's
strict named address space checks for x86 targets [2] are enabled.
Found by GCC's named address space checks.
[1] https://sparse.docs.kernel.org/en/latest/annotations.html#address-space-name
[2] https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html#x86-Named-Address-Spaces
Link: https://lkml.kernel.org/r/20241021080856.48746-3-ubizjak@gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit dabddd687c9e1a06241d6b4d1f66b9f2b60b3ad1)
Conflict resolution: the previous patch of the same upstream series had
to drop the stray trailing semicolon of PERCPU_PTR() to stay buildable
here, so only the body of the macro is replaced.
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix rh/sched
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/percpu-defs.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 02bcd74afc6c..ee236ee0bed6 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -221,7 +221,10 @@ do { \
} while (0)
#define PERCPU_PTR(__p) \
- (typeof(*(__p)) __force __kernel *)(__p)
+({ \
+ unsigned long __pcpu_ptr = (__force unsigned long)(__p); \
+ (typeof(*(__p)) __force __kernel *)(__pcpu_ptr); \
+})
#ifdef CONFIG_SMP
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 17/32] mm/memcontrol: add missing inline to the mem_cgroup_fill_meminfo() stub
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (15 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 16/32] ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 18/32] block: guard the cbt_list initialization with CONFIG_BLK_DEV_CBT Konstantin Khorenko
` (14 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
The !CONFIG_MEMCG stub of mem_cgroup_fill_meminfo() is declared "static
void", not "static inline void", so every translation unit that includes
memcontrol.h without calling it gets an unused function - an error rather
than a warning once CONFIG_WERROR=y, as x86_64 defconfig has it:
include/linux/memcontrol.h: error: 'mem_cgroup_fill_meminfo' defined
but not used [-Werror=unused-function]
Add the missing inline, like every other stub in the same #else block.
Fixes: 7710faa9d4f0 ("ve/proc: virtualize /proc/meminfo in a Container")
Feature: procfs: virtualize /proc/meminfo
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/memcontrol.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index d47c3de71a49..2772a7750fa4 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1559,7 +1559,8 @@ static inline void split_page_memcg(struct page *head, int old_order, int new_or
{
}
-static void mem_cgroup_fill_meminfo(struct mem_cgroup *memcg, struct meminfo *mi)
+static inline void mem_cgroup_fill_meminfo(struct mem_cgroup *memcg,
+ struct meminfo *mi)
{
}
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 18/32] block: guard the cbt_list initialization with CONFIG_BLK_DEV_CBT
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (16 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 17/32] mm/memcontrol: add missing inline to the mem_cgroup_fill_meminfo() stub Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 19/32] ve: include asm/vdso.h on x86 only Konstantin Khorenko
` (13 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
request_queue::cbt_list only exists when CONFIG_BLK_DEV_CBT is enabled,
but blk_alloc_queue() initializes it unconditionally, so the build fails
without that option:
block/blk-core.c: error: 'struct request_queue' has no member named
'cbt_list'
CONFIG_BLK_DEV_CBT has no default, so every configuration that does not
ask for it explicitly hits this, plain x86_64 defconfig included.
Guard the INIT_LIST_HEAD() the same way the field itself is guarded.
Fixes: e5c67003994e ("block/blk-cbt: allow multiple cbts in a single queue")
Feature: cbt: changed block tracking (for backup)
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
block/blk-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-core.c b/block/blk-core.c
index a168f2e41b7d..bcc3060de670 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -440,7 +440,9 @@ struct request_queue *blk_alloc_queue(struct queue_limits *lim, int node_id)
init_waitqueue_head(&q->mq_freeze_wq);
mutex_init(&q->mq_freeze_lock);
+#ifdef CONFIG_BLK_DEV_CBT
INIT_LIST_HEAD(&q->cbt_list);
+#endif
blkg_init_queue(q);
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 19/32] ve: include asm/vdso.h on x86 only
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (17 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 18/32] block: guard the cbt_list initialization with CONFIG_BLK_DEV_CBT Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 20/32] ve: compile the per-Container VDSO copies only on x86 Konstantin Khorenko
` (12 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
include/linux/ve.h includes asm/vdso.h for struct vdso_image, which
struct ve_struct keeps two pointers to - the per-Container copies of the
VDSO images. The header is x86-only, and ve.h is included from a lot of
generic code, so building for an architecture without it fails
everywhere at once - User Mode Linux, which we now want for KUnit, has no
asm/vdso.h at all:
include/linux/ve.h:21:10: fatal error: asm/vdso.h: No such file or
directory
A forward declaration of struct vdso_image is all the rest of the header
needs there, since nothing outside x86 dereferences one. For the same
reason compile the CONFIG_VE=n stubs of ve_get_vdso_32() /
ve_get_vdso_64() on x86 only: they hand out vdso_image_32 / vdso_image_64,
which exist nowhere else, and their callers are all in arch/x86.
Also drop the duplicated linux/binfmts.h include while touching this
block.
Feature: mm: vdso virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Reported-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/ve.h | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/linux/ve.h b/include/linux/ve.h
index cba827260d07..46e67d00cf78 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -18,11 +18,19 @@
#include <linux/kthread.h>
#include <linux/binfmts.h>
#include <linux/tty_driver.h>
-#include <asm/vdso.h>
#include <linux/time_namespace.h>
-#include <linux/binfmts.h>
#include <linux/pid.h>
+/*
+ * struct vdso_image and the static images the stubs below hand out are
+ * x86-only; User Mode Linux has no asm/vdso.h at all.
+ */
+#ifdef CONFIG_X86
+#include <asm/vdso.h>
+#else
+struct vdso_image;
+#endif
+
struct nsproxy;
struct user_namespace;
struct ve_namespace;
@@ -366,6 +374,7 @@ static inline void ve_setup_task(struct task_struct *p, struct ve_struct *ve) {
static inline void ve_set_rpc_kill_fn(void (*fn)(struct net *, bool)) { }
+#ifdef CONFIG_X86
static inline struct vdso_image *ve_get_vdso_32(struct ve_struct *ve)
{
return (struct vdso_image *)&vdso_image_32;
@@ -375,6 +384,7 @@ static inline struct vdso_image *ve_get_vdso_64(struct ve_struct *ve)
{
return (struct vdso_image *)&vdso_image_64;
}
+#endif /* CONFIG_X86 */
#endif /* CONFIG_VE */
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 20/32] ve: compile the per-Container VDSO copies only on x86
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (18 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 19/32] ve: include asm/vdso.h on x86 only Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 21/32] ve: compile the CPUID override propagation " Konstantin Khorenko
` (11 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Every Container gets its own copy of the VDSO images so that the Linux
version code inside them can be patched to whatever the Container's
os_release says. All of that is built on vdso_image_64 / vdso_image_32,
which exist on x86 only, while kernel/ve/ve.c is generic code - so the
file does not compile on an architecture without them, User Mode Linux
being the one we now want for KUnit:
kernel/ve/ve.c: error: 'vdso_image_64' undeclared here
(not in a function)
Guard the ve0 initializer, copy_vdso()/ve_free_vdso() and their callers
with CONFIG_X86, and give ve_free_vdso() a no-op stub so the error path of
ve_create() stays as it is. Its err_vdso label stays reachable either
way, since ve_mount_devtmpfs() jumps to it too. A Container on an
architecture without a patchable VDSO simply keeps the host's.
Feature: mm: vdso virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/ve/ve.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 73d1c3b4873e..3a9f3841fe55 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -85,8 +85,10 @@ struct ve_struct ve0 = {
.meminfo_val = VE_MEMINFO_SYSTEM,
.umh_running_helpers = ATOMIC_INIT(0),
.umh_helpers_waitq = __WAIT_QUEUE_HEAD_INITIALIZER(ve0.umh_helpers_waitq),
+#ifdef CONFIG_X86
.vdso_64 = (struct vdso_image*)&vdso_image_64,
.vdso_32 = (struct vdso_image*)&vdso_image_32,
+#endif
};
EXPORT_SYMBOL(ve0);
@@ -675,6 +677,7 @@ u64 ve_get_uptime(struct ve_struct *ve)
}
EXPORT_SYMBOL(ve_get_uptime);
+#ifdef CONFIG_X86
static int copy_vdso(struct vdso_image **vdso_dst, const struct vdso_image *vdso_src)
{
struct vdso_image *vdso;
@@ -712,6 +715,9 @@ static void ve_free_vdso(struct ve_struct *ve)
kfree(ve->vdso_32);
}
}
+#else
+static inline void ve_free_vdso(struct ve_struct *ve) { }
+#endif
static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_css)
{
@@ -758,6 +764,7 @@ static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_
if (err)
goto err_log;
+#ifdef CONFIG_X86
err = copy_vdso(&ve->vdso_64, &vdso_image_64);
if (err)
goto err_vdso;
@@ -765,6 +772,7 @@ static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_
err = copy_vdso(&ve->vdso_32, &vdso_image_32);
if (err)
goto err_vdso;
+#endif
err = ve_mount_devtmpfs(ve);
if (err)
@@ -1158,8 +1166,10 @@ static ssize_t ve_os_release_write(struct kernfs_open_file *of, char *buf,
if (sscanf(buf, "%d.%d.%d", &n1, &n2, &n3) == 3) {
new_version = ((n1 << 16) + (n2 << 8)) + n3;
+#ifdef CONFIG_X86
*((int *)(ve->vdso_64->data + ve->vdso_64->sym_linux_version_code)) = new_version;
*((int *)(ve->vdso_32->data + ve->vdso_32->sym_linux_version_code)) = new_version;
+#endif
}
down_write(&uts_sem);
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 21/32] ve: compile the CPUID override propagation only on x86
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (19 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 20/32] ve: compile the per-Container VDSO copies only on x86 Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 22/32] ve: mark ve0.css with CSS_NO_REF Konstantin Khorenko
` (10 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
ve_setup_task() arms TIF_CPUID_OVERRIDE for tasks of a Container whenever
/proc/vz/cpuid_override is in use. Both cpuid_override_on() and the
thread flag are x86-only, so generic kernel/ve/ve.c does not compile on
an architecture without them - User Mode Linux, for one:
kernel/ve/ve.c: error: implicit declaration of function
'cpuid_override_on'
kernel/ve/ve.c: error: 'TIF_CPUID_OVERRIDE' undeclared
Guard the propagation with CONFIG_X86. There is no CPUID to fake
elsewhere, so nothing is lost.
Feature: x86: cpu pools (cpuid override)
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/ve/ve.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 3a9f3841fe55..0f0e1a424953 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1852,8 +1852,10 @@ void ve_setup_task(struct task_struct *task, struct ve_struct *ve)
ve_set_task_start_time(ve, task);
+#ifdef CONFIG_X86
if (cpuid_override_on())
set_tsk_thread_flag(task, TIF_CPUID_OVERRIDE);
+#endif
}
EXPORT_SYMBOL(ve_setup_task);
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 22/32] ve: mark ve0.css with CSS_NO_REF
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (20 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 21/32] ve: compile the CPUID override propagation " Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:50 ` [Devel] [PATCH vz10 22/32] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 23/32] mm/memory: build the page fault latency accounting for x86 only Konstantin Khorenko
` (9 subsequent siblings)
31 siblings, 2 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
ve0.css is the root css of the ve cgroup subsystem, and ve_cgrp_subsys is
not an early_init one, so the css - its percpu_ref included - is only set
up by cgroup_init(). net_ns_init(), however, runs before cgroup_init()
in start_kernel() and takes a reference on ve0:
start_kernel()
net_ns_init() /* init/main.c, before cgroup_init() */
init_net.owner_ve = get_ve(&ve0)
css_get(&ve0.css) /* flags == 0, refcnt not set up */
percpu_ref_get(&ve0.css.refcnt)
At that point css.refcnt is all zeroes, so __ref_is_percpu() sees no
__PERCPU_REF_ATOMIC_DEAD bits, decides the counter is in percpu mode and
increments *(unsigned long __percpu *)NULL - that is, whatever happens to
live at the start of the percpu area. On x86 that quietly corrupts a
percpu variable on every boot; under User Mode Linux it faults outright,
which is how it was found.
ve0 is a permanent singleton that is never freed, exactly like the root
css objects that cgroup_init_subsys() marks CSS_NO_REF, so give it that
flag from the start. css_get()/css_put() on ve0 then become no-ops in
both windows, before and after cgroup_init().
Fixes: 6087cf234cc5 ("ve/net: thread owning ve through copy_net_ns")
Feature: ve: ve generic structures
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/ve/ve.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 0f0e1a424953..750a1b2882a7 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -53,6 +53,7 @@ static struct kmem_cache *ve_cachep;
static DEFINE_PER_CPU(struct kstat_lat_pcpu_snap_struct, ve0_lat_stats);
struct ve_struct ve0 = {
+ .css = { .flags = CSS_NO_REF },
.ve_name = "0",
.start_jiffies = INITIAL_JIFFIES,
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 23/32] mm/memory: build the page fault latency accounting for x86 only
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (21 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 22/32] ve: mark ve0.css with CSS_NO_REF Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 24/32] sched/core: include cgroup-internal.h only where it is used Konstantin Khorenko
` (8 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
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 <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
mm/memory.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mm/memory.c b/mm/memory.c
index 837194e87664..5e414c68f3a9 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -87,7 +87,9 @@
#include <linux/uaccess.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
+#ifdef CONFIG_X86
#include <asm/tsc.h>
+#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,
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 24/32] sched/core: include cgroup-internal.h only where it is used
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (22 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 23/32] mm/memory: build the page fault latency accounting for x86 only Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 25/32] kernfs: build the KERNFS_GET_NS ioctl only with CONFIG_NET Konstantin Khorenko
` (7 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
kernel/sched/core.c includes the private cgroup-internal.h for the sake of
one cgroup_task_count() call in cpu_cgroup_proc_loadavg(), which lives in
the CONFIG_CGROUP_SCHED part of the file. The include itself is
unconditional, and it does not compile without the cgroup core:
cgroup/cgroup-internal.h:188:22: error: invalid use of undefined type
'const struct cgroup'
cgroup/cgroup-internal.h:188:37: error: 'CSS_ONLINE' undeclared (first
use in this function)
Guard the include with CONFIG_CGROUP_SCHED, the same condition as its only
user. This does not make CONFIG_CGROUPS=n build by itself - struct
ve_struct embeds a struct cgroup_subsys_state, so ve.h needs the cgroup
core in any case - but it does keep another subsystem's private header out
of scheduler translation units that have no use for it.
Fixes: c0997a766674 ("ve/proc/loadavg: Virtualize /proc/loadavg in Containers")
Feature: statistics: loadavg virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/sched/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7d2214749245..fb2477cb1d07 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -152,7 +152,9 @@ __read_mostly unsigned int sysctl_sched_features =
__read_mostly int sysctl_resched_latency_warn_ms = 100;
__read_mostly int sysctl_resched_latency_warn_once = 1;
+#ifdef CONFIG_CGROUP_SCHED
#include "../cgroup/cgroup-internal.h" /* For cgroup_task_count() */
+#endif
/*
* Number of tasks to iterate in a single balance run.
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 25/32] kernfs: build the KERNFS_GET_NS ioctl only with CONFIG_NET
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (23 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 24/32] sched/core: include cgroup-internal.h only where it is used Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 26/32] fs/fs_context: build the mount option formatting only with CONFIG_VE Konstantin Khorenko
` (6 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
The KERNFS_GET_NS ioctl hands out the network namespace a sysfs directory
is tagged with, so it calls maybe_get_net_ns(), which exists only with the
networking stack:
fs/kernfs/file.c:1030:50: error: 'maybe_get_net_ns' undeclared (first
use in this function)
fs/kernfs/file.c:1029:21: error: this statement may fall through
[-Werror=implicit-fallthrough=]
Compile the whole body under CONFIG_NET and return -ENOTTY otherwise. The
three local variables move inside the guard along with it: left at function
scope they are unused with CONFIG_NET=n, which is an error once
CONFIG_WERROR=y.
The switch is replaced by an if as part of that, because it reads better
once there is an #ifdef in the picture. Keeping the switch would mean
either a second #ifdef of its own around the declarations, or a switch
whose only unconditional arm is the default one; an if plus a tail return
says the same thing under a single guard.
Fixes: 38c2983fa828 ("kernfs/sysfs: add ioctl to get fd network namespace tag")
Feature: sysfs: per-CT entries visibility and permissions configuration
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/kernfs/file.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index 092a4dcd2ebf..5c72f05a9e41 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -1018,19 +1018,19 @@ EXPORT_SYMBOL_GPL(kernfs_notify);
long kernfs_ioctl(struct file *file, unsigned int ioctl,
unsigned long arg)
{
+#ifdef CONFIG_NET
struct dentry *dentry = file->f_path.dentry;
const void *ns = kernfs_info(dentry->d_sb)->ns;
struct net *net;
- switch (ioctl) {
- case KERNFS_GET_NS:
+ if (ioctl == KERNFS_GET_NS) {
if (dentry->d_sb->s_magic != SYSFS_MAGIC || !ns)
return -ENOTTY;
net = (struct net *)ns;
return open_related_ns(&net->ns, maybe_get_net_ns);
- default:
- return -ENOTTY;
}
+#endif
+ return -ENOTTY;
}
const struct file_operations kernfs_file_fops = {
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 26/32] fs/fs_context: build the mount option formatting only with CONFIG_VE
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (24 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 25/32] kernfs: build the KERNFS_GET_NS ioctl only with CONFIG_NET Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 27/32] net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n Konstantin Khorenko
` (5 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
vfs_format_sb_flags() and the two helpers it is built on exist to render
the effective superblock flags back into an option string, which the
Container device-mount policy then checks with ve_devmnt_verify(). Their
only caller sits in the CONFIG_VE part of the file while they do not, so
CONFIG_VE=n leaves them unused - an error rather than a warning once
CONFIG_WERROR=y, as x86_64 defconfig has it:
fs/fs_context.c: error: 'vfs_format_sb_flags' defined but not used
[-Werror=unused-function]
Move the whole group under CONFIG_VE, next to its caller.
Fixes: 37940d776226 ("fs: enforce container device-mount policy in the common mount path")
Feature: ve: ve generic structures
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/fs_context.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/fs_context.c b/fs/fs_context.c
index b2bd21a42083..58fe6f0ce8e8 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -81,6 +81,7 @@ static int vfs_parse_sb_flag(struct fs_context *fc, const char *key)
return -ENOPARAM;
}
+#ifdef CONFIG_VE
/*
* Emit option @name into @buff at *@off, prefixed with ',' if the buffer
* already holds text. Advances *@off. Returns 0 or -E2BIG if @buff is full.
@@ -144,6 +145,7 @@ static int vfs_format_sb_flags(char *buff, size_t size, size_t *off,
return 0;
}
+#endif /* CONFIG_VE */
/**
* vfs_parse_fs_param_source - Handle setting "source" via parameter
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 27/32] net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (25 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 26/32] fs/fs_context: build the mount option formatting only with CONFIG_VE Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 28/32] redhat: rh_flags: make the !CONFIG_RHEL_DIFFERENCES stubs inline Konstantin Khorenko
` (4 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
The MSG_ERRQUEUE path of unix_stream_recvmsg() passes the socket to
unix_recv_error(), but 'sk' is declared inside the CONFIG_BPF_SYSCALL
block a few lines above, so the function does not build without that
option:
net/unix/af_unix.c:3073:40: error: 'sk' undeclared (first use in this
function)
x86_64 defconfig and the User Mode Linux defconfig - the one we want for
KUnit - both have CONFIG_BPF_SYSCALL=n, so neither has ever built this
file.
Declare 'sk' unconditionally; the BPF block keeps its own 'prot'.
Fixes: c9ccba858dd1 ("net: zerocopy over unix sockets")
Feature: net: zerocopy over unix sockets
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
net/unix/af_unix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index fa9038e89f83..7a37c06a097c 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -3060,9 +3060,9 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
.size = size,
.flags = flags
};
+ struct sock *sk = sock->sk;
#ifdef CONFIG_BPF_SYSCALL
- struct sock *sk = sock->sk;
const struct proto *prot = READ_ONCE(sk->sk_prot);
if (prot != &unix_stream_proto)
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 28/32] redhat: rh_flags: make the !CONFIG_RHEL_DIFFERENCES stubs inline
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (26 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 27/32] net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 29/32] ms/pcmcia: cistpl: Constify 'struct bin_attribute' Konstantin Khorenko
` (3 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
The stubs are declared "static void", not "static inline void", so every
translation unit that includes rh_flags.h without calling them gets two
unused functions. That breaks the build of any kernel that has
CONFIG_RHEL_DIFFERENCES off and CONFIG_WERROR on - x86_64 defconfig,
which we now want to keep building, is one of them:
include/linux/rh_flags.h:32:13: error: 'rh_add_flag' defined but not
used [-Werror=unused-function]
include/linux/rh_flags.h:31:13: error: 'rh_print_flags' defined but not
used [-Werror=unused-function]
Fixes: 5e75024bc506 ("redhat: rh_flags: declare proper static methods when !CONFIG_RHEL_DIFFERENCES")
Feature: fix rh/flags
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/rh_flags.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/rh_flags.h b/include/linux/rh_flags.h
index d498d319ace3..4bb0f5585df0 100644
--- a/include/linux/rh_flags.h
+++ b/include/linux/rh_flags.h
@@ -28,7 +28,7 @@ void rh_print_flags(void);
unlikely(__ret_mark_once); \
})
#else
-static void rh_print_flags(void) { }
-static void rh_add_flag(const char *flag_name) { }
+static inline void rh_print_flags(void) { }
+static inline void rh_add_flag(const char *flag_name) { }
#endif
#endif
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 29/32] ms/pcmcia: cistpl: Constify 'struct bin_attribute'
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (27 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 28/32] redhat: rh_flags: make the !CONFIG_RHEL_DIFFERENCES stubs inline Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 30/32] redhat: rh_waived: add a stub for CONFIG_RHEL_DIFFERENCES=n Konstantin Khorenko
` (2 subsequent siblings)
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
From: Thomas Wei?schuh <linux@weissschuh.net>
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.
Signed-off-by: Thomas Wei?schuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-pcmcia-v1-1-ebb82e47d834@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 05a9896fa9e15466456a1b1dc9d2eacdf3551b79)
Needed here because the RHEL10.2 base carries the sysfs side of the
conversion but not the pcmcia one, so the initializer of pccard_cis_attr
does not compile at all:
drivers/pcmcia/cistpl.c:1608:17: error: initialization of
'ssize_t (*)(struct file *, struct kobject *,
const struct bin_attribute *, char *, loff_t, size_t)'
from incompatible pointer type [-Wincompatible-pointer-types]
Our shipped configs have CONFIG_PCCARD=n so it goes unnoticed there,
while plain x86_64 defconfig - which we now want to keep building for
KUnit - enables it. Applies as is: this tree's struct bin_attribute has
both the ::read/::write and the ::read_new/::write_new members, and
sysfs_kf_bin_read() prefers the latter.
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix ms/pcmcia
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
drivers/pcmcia/cistpl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index d018f36f3a89..0c801e4ccc6c 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1540,7 +1540,7 @@ static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf,
static ssize_t pccard_show_cis(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr,
+ const struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
unsigned int size = 0x200;
@@ -1571,7 +1571,7 @@ static ssize_t pccard_show_cis(struct file *filp, struct kobject *kobj,
static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr,
+ const struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
struct pcmcia_socket *s;
@@ -1605,6 +1605,6 @@ static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj,
const struct bin_attribute pccard_cis_attr = {
.attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR },
.size = 0x200,
- .read = pccard_show_cis,
- .write = pccard_store_cis,
+ .read_new = pccard_show_cis,
+ .write_new = pccard_store_cis,
};
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 30/32] redhat: rh_waived: add a stub for CONFIG_RHEL_DIFFERENCES=n
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (28 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 29/32] ms/pcmcia: cistpl: Constify 'struct bin_attribute' Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 31/32] ext4: select LIBCRC32C Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 32/32] kunit: add the script dir to sys.path for PYTHONSAFEPATH compatibility Konstantin Khorenko
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
is_rh_waived() is compiled as part of kernel/rh_waived.c, which is built
only with CONFIG_RHEL_DIFFERENCES, but huge_pmd_unshare() calls it
unconditionally, so a kernel built without that option does not link:
ld: vmlinux.o: in function 'huge_pmd_unshare':
undefined reference to 'is_rh_waived'
x86_64 defconfig is one such kernel. Add a stub returning false: with no
way to pass
rh_waived= there is nothing waived, so every mitigation stays enabled.
Fixes: 9f055df11343 ("rh10: import RHEL10 kernel-6.12.0-211.16.1.el10")
Feature: fix rh/waived
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/rh_waived.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/rh_waived.h b/include/linux/rh_waived.h
index 8ec7aabab3ab..e6aab8818241 100644
--- a/include/linux/rh_waived.h
+++ b/include/linux/rh_waived.h
@@ -15,6 +15,13 @@ enum rh_waived_items {
RH_WAIVED_ITEMS,
};
+#ifdef CONFIG_RHEL_DIFFERENCES
bool is_rh_waived(enum rh_waived_items feat);
+#else
+static inline bool is_rh_waived(enum rh_waived_items feat)
+{
+ return false;
+}
+#endif
#endif /* _RH_WAIVED_H */
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 31/32] ext4: select LIBCRC32C
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (29 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 30/32] redhat: rh_waived: add a stub for CONFIG_RHEL_DIFFERENCES=n Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 32/32] kunit: add the script dir to sys.path for PYTHONSAFEPATH compatibility Konstantin Khorenko
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
ext4 computes its metadata checksums with crc32c(). Upstream that helper
moved into lib/crc32.c under CONFIG_CRC32, which is what ext4 selects, but
this tree still has the older layout where it lives in lib/libcrc32c.c
under CONFIG_LIBCRC32C - the RHEL10.2 base carries the ext4 side of the
conversion and not the lib one. So a kernel with ext4 built in and
nothing else pulling libcrc32c in does not link:
ld: vmlinux.o: in function 'ext4_inode_bitmap_csum_verify':
undefined reference to 'crc32c'
Our configs get away with it because other filesystems select
CONFIG_LIBCRC32C; plain x86_64 defconfig, which we now want to keep
building, does not. Select it explicitly until the lib side is caught up
with upstream, where this select becomes redundant rather than wrong.
Fixes: 9f055df11343 ("rh10: import RHEL10 kernel-6.12.0-211.16.1.el10")
Feature: fix ms/ext4
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/ext4/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index c9ca41d91a6c..8849d297102d 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -32,6 +32,7 @@ config EXT4_FS
select JBD2
select CRC16
select CRC32
+ select LIBCRC32C
select FS_IOMAP
select FS_ENCRYPTION_ALGS if FS_ENCRYPTION
help
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH vz10 32/32] kunit: add the script dir to sys.path for PYTHONSAFEPATH compatibility
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
` (30 preceding siblings ...)
2026-08-21 16:37 ` [Devel] [PATCH vz10 31/32] ext4: select LIBCRC32C Konstantin Khorenko
@ 2026-08-21 16:37 ` Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
31 siblings, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:37 UTC (permalink / raw)
The RHEL10 import changed the Python shebang of the in-tree tools from
'#!/usr/bin/python3 -s' to '#!/usr/bin/python3 -sP'. The -P flag turns on
safe path mode (PYTHONSAFEPATH, Python 3.11+), which stops Python from
prepending the script's own directory to sys.path - so kunit.py cannot
import the modules sitting right next to it, and the KUnit tool does not
start at all:
$ ./tools/testing/kunit/kunit.py run
Traceback (most recent call last):
File "tools/testing/kunit/kunit.py", line 23, in <module>
import kunit_json
ModuleNotFoundError: No module named 'kunit_json'
Add the script's directory to sys.path before the local imports in the two
executable scripts that have them, kunit.py and kunit_tool_test.py,
following commit e6c430f5a2cc ("selftests/damon: add script dir to
sys.path for PYTHONSAFEPATH compatibility") which fixed the same breakage
for the DAMON selftests.
Fixes: 9f055df11343 ("rh10: import RHEL10 kernel-6.12.0-211.16.1.el10")
Feature: fix KUnit tests
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
tools/testing/kunit/kunit.py | 1 +
tools/testing/kunit/kunit_tool_test.py | 2 ++
2 files changed, 3 insertions(+)
diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index 13ccb9993776..b4bc6c742718 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -20,6 +20,7 @@ from dataclasses import dataclass
from enum import Enum, auto
from typing import Iterable, List, Optional, Sequence, Tuple
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import kunit_json
import kunit_kernel
import kunit_parser
diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py
index 3121e133e949..265a8999aada 100755
--- a/tools/testing/kunit/kunit_tool_test.py
+++ b/tools/testing/kunit/kunit_tool_test.py
@@ -16,8 +16,10 @@ import json
import os
import signal
import subprocess
+import sys
from typing import Iterable
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import kunit_config
import kunit_parser
import kunit_kernel
--
2.47.1
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n
2026-08-21 16:36 ` [Devel] [PATCH vz10 01/32] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 1c3cd77a59f19df932ff1112315186b1dd75cbe6
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:36:47 2026 +0200
sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n
get_avenrun_tg() dereferences struct task_group, which is only defined
under CONFIG_CGROUP_SCHED in kernel/sched/sched.h. Both the function
and its unconditional caller are compiled regardless of that option:
kernel/sched/loadavg.c is pulled into build_utility.c, and do_sysinfo()
calls get_avenrun_tg() from a branch that is dead at runtime with
CONFIG_VE=n but still compiled. So CONFIG_CGROUP_SCHED=n does not
build:
kernel/sched/loadavg.c: error: invalid use of undefined type
'struct task_group'
Compile get_avenrun_tg() only when CONFIG_CGROUP_SCHED is enabled and
provide a stub otherwise. The stub returns -ENOSYS, the same error the
real implementation returns when there is no per-Container task group to
report. do_sysinfo() ignores the return value and info->loads is
already zeroed by memset(), so no caller has to change.
calc_load_ve() walks the very same task_group internals, so require
CONFIG_CGROUP_SCHED there as well: the dependency then stands where the
code is, instead of being implied by the select list of CONFIG_VE.
Fixes: c80eee4588ff ("ve/sched/loadavg: Calculate avenrun for Containers root cpu cgroups")
Feature: statistics: loadavg virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/sched/loadavg.h | 11 ++++++++++-
kernel/sched/loadavg.c | 6 ++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/linux/sched/loadavg.h b/include/linux/sched/loadavg.h
index 771e753e46700..b97635dc47d4e 100644
--- a/include/linux/sched/loadavg.h
+++ b/include/linux/sched/loadavg.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_SCHED_LOADAVG_H
#define _LINUX_SCHED_LOADAVG_H
+#include <linux/errno.h>
#include <linux/types.h>
/*
@@ -18,8 +19,16 @@ extern unsigned long avenrun[]; /* Load averages */
extern void get_avenrun(unsigned long *loads, unsigned long offset, int shift);
struct task_group;
+#ifdef CONFIG_CGROUP_SCHED
extern int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
unsigned long offset, int shift);
+#else
+static inline int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
+ unsigned long offset, int shift)
+{
+ return -ENOSYS;
+}
+#endif
#define FSHIFT 11 /* nr of bits of precision */
#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
@@ -51,7 +60,7 @@ extern unsigned long calc_load_n(unsigned long load, unsigned long exp,
extern bool calc_global_load(void);
-#ifdef CONFIG_VE
+#if defined(CONFIG_VE) && defined(CONFIG_CGROUP_SCHED)
extern void calc_load_ve(void);
#else
#define calc_load_ve() do { } while (0)
diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index bc0b6bcdae2d6..2f66772750ea8 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -78,6 +78,7 @@ void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
loads[2] = (avenrun[2] + offset) << shift;
}
+#ifdef CONFIG_CGROUP_SCHED
int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
unsigned long offset, int shift)
{
@@ -93,6 +94,7 @@ int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
return 0;
}
+#endif /* CONFIG_CGROUP_SCHED */
long calc_load_fold_active(struct rq *this_rq, long adjust)
{
@@ -109,7 +111,7 @@ long calc_load_fold_active(struct rq *this_rq, long adjust)
return delta;
}
-#ifdef CONFIG_VE
+#if defined(CONFIG_VE) && defined(CONFIG_CGROUP_SCHED)
extern struct list_head ve_root_list;
extern raw_spinlock_t load_ve_lock;
@@ -166,7 +168,7 @@ void calc_load_ve(void)
kstat_glob.nr_unint_avg[2] = calc_load(kstat_glob.nr_unint_avg[2], EXP_15, nr_unint);
write_seqcount_end(&kstat_glob.nr_unint_avg_seq);
}
-#endif /* CONFIG_VE */
+#endif /* CONFIG_VE && CONFIG_CGROUP_SCHED */
/**
* fixed_power_int - compute: x^n, in O(log n) time
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] sched/core: guard cpu_cgrp_subsys.depends_on with CONFIG_CGROUP_CPUACCT
2026-08-21 16:36 ` [Devel] [PATCH vz10 02/32] sched/core: guard cpu_cgrp_subsys.depends_on with CONFIG_CGROUP_CPUACCT Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 9ce0ac5c94b699acee8b79cb0685d38f7b5aea5c
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:36:48 2026 +0200
sched/core: guard cpu_cgrp_subsys.depends_on with CONFIG_CGROUP_CPUACCT
cpuacct_cgrp_id is only declared when CONFIG_CGROUP_CPUACCT is enabled -
SUBSYS(cpuacct) in include/linux/cgroup_subsys.h sits under
IS_ENABLED(CONFIG_CGROUP_CPUACCT) - while the cpu controller itself is
built whenever CONFIG_CGROUP_SCHED is set. With CONFIG_CGROUP_SCHED=y
and CONFIG_CGROUP_CPUACCT=n the initializer does not compile:
kernel/sched/core.c: error: 'cpuacct_cgrp_id' undeclared here
(not in a function)
There is nothing for the cpu controller to depend on when cpuacct is not
built, so simply drop the dependency in that configuration.
Fixes: 776275586407 ("cgroup: allow cpuacct to be enabled in v2 hierarchy")
Feature: sched: emulate virtual cpus for Containers
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/sched/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d5b4d8c97a0c7..7d2214749245b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -10441,7 +10441,9 @@ struct cgroup_subsys cpu_cgrp_subsys = {
.dfl_cftypes = cpu_files,
.early_init = true,
.threaded = true,
+#ifdef CONFIG_CGROUP_CPUACCT
.depends_on = 1 << cpuacct_cgrp_id,
+#endif
};
#endif /* CONFIG_CGROUP_SCHED */
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] sched: move MAX_CPU_RATE out of CONFIG_CFS_CPULIMIT
2026-08-21 16:36 ` [Devel] [PATCH vz10 03/32] sched: move MAX_CPU_RATE out of CONFIG_CFS_CPULIMIT Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 67a3a57333a074ca4bcb036da04a15ef914512d0
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:36:49 2026 +0200
sched: move MAX_CPU_RATE out of CONFIG_CFS_CPULIMIT
MAX_CPU_RATE is the scale of task_group::cpu_rate, but it was defined in
the middle of the body of struct task_group, inside the block guarded by
CONFIG_CFS_CPULIMIT. cpu_cgroup_update_vcpustat() uses it to normalize
the per-vcpu usage reported in a Container's /proc/stat, and that code is
compiled unconditionally, so CONFIG_CFS_CPULIMIT=n does not build:
kernel/sched/cpuacct.c: error: 'MAX_CPU_RATE' undeclared
(first use in this function)
x86_64 defconfig is exactly such a configuration: CONFIG_VE defaults to
y, while CONFIG_CFS_BANDWIDTH - the only thing that selects
CONFIG_CFS_CPULIMIT - is off.
Move the definition out of the struct and out of the ifdef. Nothing
else in cpu_cgroup_update_vcpustat() needs CONFIG_CFS_CPULIMIT:
tg_cpu_rate() and tg_nr_cpus() already degrade to "no limit configured",
so the vcpustat calculation keeps working and a Container simply gets
num_online_cpus() vcpus running at full rate. Compiling the calculation
out instead would leave tg->vcpustat all zeroes, and /proc/stat inside a
Container would report no CPU time at all.
Fixes: 4e99efb641da ("sched: Port CONFIG_CFS_CPULIMIT feature")
Feature: sched: ability to limit number of CPUs available to a CT
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Reported-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/sched/sched.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 1a8a0ff522cb9..2a3f73933456e 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -533,12 +533,19 @@ struct task_group {
#endif
#ifdef CONFIG_CFS_CPULIMIT
-#define MAX_CPU_RATE 1024
unsigned long cpu_rate;
unsigned int nr_cpus;
#endif
};
+/*
+ * The scale of task_group::cpu_rate: 1024 means one full CPU. It is also
+ * used to normalize the per-vcpu usage reported in a Container's /proc/stat,
+ * which is done regardless of CONFIG_CFS_CPULIMIT, so keep the definition
+ * unconditional.
+ */
+#define MAX_CPU_RATE 1024
+
#ifdef CONFIG_GROUP_SCHED_WEIGHT
#define ROOT_TASK_GROUP_LOAD NICE_0_LOAD
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT
2026-08-21 16:36 ` [Devel] [PATCH vz10 04/32] sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 f7cece73a0c7d1234d2902148a729bf7d3a7759c
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:36:50 2026 +0200
sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT
ve_root_tg() has exactly two callers, tg_cpu_rate() and tg_nr_cpus(),
and both reference it only from inside #ifdef CONFIG_CFS_CPULIMIT: the
task_group fields they read, ::cpu_rate and ::nr_cpus, do not exist
without that option. So with CONFIG_CFS_CPULIMIT=n the helper is not
used at all. x86_64 defconfig is exactly that configuration - CONFIG_VE
defaults to y while CONFIG_CFS_BANDWIDTH, the only thing that selects
CONFIG_CFS_CPULIMIT, is off - and it sets CONFIG_WERROR=y as well, so
there the unused function is not a warning but a build failure:
kernel/sched/cpuacct.c:373:27: error: 've_root_tg' defined but not
used [-Werror=unused-function]
Compile ve_root_tg() under the same condition as its call sites.
Fixes: 095994c57b84 ("ve/sched/stat: Introduce functions to calculate vcpustat data")
Feature: sched: emulate virtual cpus for Containers
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/sched/cpuacct.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c
index 01a2b2c3c5b7e..6b0ed967316e4 100644
--- a/kernel/sched/cpuacct.c
+++ b/kernel/sched/cpuacct.c
@@ -370,6 +370,7 @@ struct cgroup_subsys cpuacct_cgrp_subsys = {
.threaded = true,
};
+#ifdef CONFIG_CFS_CPULIMIT
static struct task_group *ve_root_tg(struct task_group *tg) {
struct cgroup_subsys_state *css;
@@ -379,6 +380,7 @@ static struct task_group *ve_root_tg(struct task_group *tg) {
css = css_ve_root1(&tg->css);
return css ? css_tg(css) : NULL;
}
+#endif
static unsigned int tg_cpu_rate(struct task_group *tg)
{
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ve: source Kconfig.openvz from arch/um/Kconfig
2026-08-21 16:36 ` [Devel] [PATCH vz10 05/32] ve: source Kconfig.openvz from arch/um/Kconfig Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 7af242cadc5afb5e16e5de46dec75062ea1fe949
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:36:51 2026 +0200
ve: source Kconfig.openvz from arch/um/Kconfig
kernel/Kconfig.openvz was only sourced from arch/x86/Kconfig, making
CONFIG_VE unavailable on UML. Source it from arch/um/Kconfig so that
VZ containers can be enabled when building under User-Mode Linux
(needed for KUnit testing).
CONFIG_VE is "default y", so this alone gives CONFIG_VE=y for a plain
"make ARCH=um defconfig". That is what we want, but it also means every
UML build from here on compiles the VZ code and trips over the x86-only
parts of it; those are fixed up later in this series.
The source line goes after the last endmenu of the file, like the x86 one,
so that the OpenVZ menu does not end up nested inside another menu.
Feature: fix KUnit tests
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
arch/um/Kconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index c89575d05021f..5e1b6d0257733 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -252,3 +252,5 @@ menu "Power management options"
source "kernel/power/Kconfig"
endmenu
+
+source "kernel/Kconfig.openvz"
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ve: select CGROUP_PERF only if PERF_EVENTS
2026-08-21 16:36 ` [Devel] [PATCH vz10 06/32] ve: select CGROUP_PERF only if PERF_EVENTS Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 d7679f3b4e83befd35cc80b312fc32e90ce6d024
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:36:52 2026 +0200
ve: select CGROUP_PERF only if PERF_EVENTS
CONFIG_CGROUP_PERF depends on CONFIG_PERF_EVENTS, but CONFIG_VE selects
it unconditionally. On architectures or configurations without perf
events - User Mode Linux, for one, which we now want to build for KUnit -
that produces an unmet direct dependency, and a .config with
CGROUP_PERF=y all the same:
WARNING: unmet direct dependencies detected for CGROUP_PERF
Depends on [n]: CGROUPS [=y] && PERF_EVENTS [=n]
Selected by [y]:
- VE [=y]
Such a .config does not link. CONFIG_CGROUP_PERF adds SUBSYS(perf_event)
to include/linux/cgroup_subsys.h, so cgroup.c builds its subsystem tables
with references to perf_event_cgrp_subsys and its two static keys - all of
which live in kernel/events/core.c, built only when CONFIG_PERF_EVENTS is
set:
ld: kernel/cgroup/cgroup.o:(.data+0x26b0): undefined reference to
`perf_event_cgrp_subsys'
Make the select conditional; a kernel without perf events has no use for
the perf controller anyway.
Fixes: ba3113998624 ("Kconfig.openvz: force CGROUP_PERF if compiling VZ Containers code")
Feature: internal
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/Kconfig.openvz | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/Kconfig.openvz b/kernel/Kconfig.openvz
index 9164db1f2acc3..9358727c1afad 100644
--- a/kernel/Kconfig.openvz
+++ b/kernel/Kconfig.openvz
@@ -19,7 +19,7 @@ config VE
select CGROUPS
select CGROUP_DEVICE
select CGROUP_FREEZER
- select CGROUP_PERF
+ select CGROUP_PERF if PERF_EVENTS
help
This option adds support of virtual Linux running on the original box
with fully supported virtual network driver, tty subsystem and
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ve: add missing Kconfig selects for CONFIG_VE
2026-08-21 16:36 ` [Devel] [PATCH vz10 07/32] ve: add missing Kconfig selects for CONFIG_VE Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 1a95a49afb5a7965df39c48fa6b49142ae1e82fa
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:36:53 2026 +0200
ve: add missing Kconfig selects for CONFIG_VE
The select list of CONFIG_VE only ever named the namespaces and a few
cgroup controllers, and got away with it because everything else it needs
happened to be enabled by the RHEL and Virtuozzo x86 configs. It is not
a property of the option itself, though: plain "make defconfig" already
gives CONFIG_VE=y with CONFIG_MEMCG=n, and building for User Mode Linux
(which we now want for KUnit) starts from yet another set of defaults.
Name the dependencies explicitly:
NET - NET_NS depends on it, so selecting NET_NS alone
yields an unmet direct dependency;
CGROUP_SCHED - the cpu cgroup is the per-Container task group:
cgroup_mark_ve_roots(), the per-Container loadavg
and the /proc/stat virtualization all need it;
CGROUP_CPUACCT - per-Container cpu statistics are read from it;
MEMCG, MEMCG_V1 - per-Container memory limits and the /proc/meminfo,
/proc/vmstat and oom_score virtualization are all
built on the memory controller, v1 included;
POSIX_MQUEUE - part of the IPC environment a Container expects;
SCHEDSTATS - kernel/ve/vzstat.c reads task->stats.wait_start, and
all of struct sched_statistics sits under that option.
Fixes: 82652f8a0749 ("ve: Add ve cgroup and ve_hook subsys")
Feature: ve: ve generic structures
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/Kconfig.openvz | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kernel/Kconfig.openvz b/kernel/Kconfig.openvz
index 9358727c1afad..7494048425a54 100644
--- a/kernel/Kconfig.openvz
+++ b/kernel/Kconfig.openvz
@@ -14,12 +14,19 @@ config VE
select PID_NS
select IPC_NS
select UTS_NS
+ select NET
select NET_NS
select USER_NS
select CGROUPS
+ select CGROUP_SCHED
+ select CGROUP_CPUACCT
+ select MEMCG
+ select MEMCG_V1
select CGROUP_DEVICE
select CGROUP_FREEZER
select CGROUP_PERF if PERF_EVENTS
+ select POSIX_MQUEUE
+ select SCHEDSTATS
help
This option adds support of virtual Linux running on the original box
with fully supported virtual network driver, tty subsystem and
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] mm/oom: build the berserker mode only with CONFIG_MEMCG
2026-08-21 16:36 ` [Devel] [PATCH vz10 08/32] mm/oom: build the berserker mode only with CONFIG_MEMCG Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 15359d8092f220b53802e9a86de7cf10b8acff1a
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:36:54 2026 +0200
mm/oom: build the berserker mode only with CONFIG_MEMCG
oom_berserker() works on the memory cgroup the OOM happened in: it takes
memcg->oom_rage_lock, updates memcg->oom_time/oom_rage, falls back to
root_mem_cgroup and calls task_in_mem_cgroup(). None of that exists when
CONFIG_MEMCG is disabled:
mm/oom_kill.c: error: 'root_mem_cgroup' undeclared
mm/oom_kill.c: error: invalid use of undefined type 'struct mem_cgroup'
Compile the function only when CONFIG_MEMCG is enabled and provide an
empty stub otherwise: without a memory controller there is no per-cgroup
OOM rate to get enraged about, and the caller stays unchanged.
Fixes: 6517e9ae0449 ("oom: resurrect berserker mode")
Feature: mm/oom: berserker mode
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
mm/oom_kill.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 1fd5f99ce3b92..5cf0fefade481 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -1047,6 +1047,7 @@ static int oom_kill_memcg_member(struct task_struct *task, void *message)
/*
* Kill more processes if oom happens too often in this context.
*/
+#ifdef CONFIG_MEMCG
static void oom_berserker(struct oom_control *oc)
{
static DEFINE_RATELIMIT_STATE(berserker_rs,
@@ -1150,6 +1151,9 @@ static void oom_berserker(struct oom_control *oc)
pr_err("OOM killer in rage %d: %d tasks killed\n", rage, killed);
}
+#else
+static inline void oom_berserker(struct oom_control *oc) { }
+#endif /* CONFIG_MEMCG */
atomic_t global_oom = ATOMIC_INIT(0);
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] proc: build the per-Container oom_score limit lookup only with CONFIG_MEMCG
2026-08-21 16:36 ` [Devel] [PATCH vz10 09/32] proc: build the per-Container oom_score limit lookup " Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 bcfa9f11de4857baa7b436491e2d7e3b39d5c0d9
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:36:55 2026 +0200
proc: build the per-Container oom_score limit lookup only with CONFIG_MEMCG
proc_oom_score() scales the badness against the memory cgroup limit of
the Container the task belongs to, using memory_cgrp_id,
mem_cgroup_from_css() and mem_cgroup_get_max(). None of those exist with
CONFIG_MEMCG disabled:
fs/proc/base.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
Wrap the whole lookup in CONFIG_MEMCG. totalpages is already initialized
to totalram_pages() + total_swap_pages, so without a memory controller
oom_score simply falls back to being scaled against all of the machine's
memory, which is what a kernel without memory cgroups can report.
Fixes: 708b02c17c36 ("proc,memcg: use memcg limits for showing oom_score inside CT")
Feature: mm/oom: per-CT oom_score virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/proc/base.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8174b2a8a5dc4..f7cae1c59ec47 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -692,6 +692,7 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
unsigned long points = 0;
long badness;
+#ifdef CONFIG_MEMCG
scoped_guard (rcu) {
struct cgroup_subsys_state *css = task_css(task, memory_cgrp_id);
@@ -703,6 +704,7 @@ static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
totalpages = mem_cgroup_get_max(memcg);
}
}
+#endif
badness = oom_badness(task, totalpages, NULL);
/*
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE
2026-08-21 16:36 ` [Devel] [PATCH vz10 10/32] mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 3bb167409cb19772fcb7e26a2a51afd77ef4dd1c
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:36:56 2026 +0200
mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE
The Container view of /proc/meminfo is built from the memory cgroup of
the Container: si_meminfo_ve() reads memcg->memory / memcg->memsw and
fill_meminfo_ve() looks the cgroup up by memory_cgrp_id. Both are
compiled unconditionally, so with CONFIG_MEMCG=n - which CONFIG_VE=n
allows, and plain "make defconfig" used to produce - the build fails:
mm/show_mem.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
CONFIG_VE selects CONFIG_MEMCG, so CONFIG_VE is the condition to guard
with, and it is the better one anyway: with CONFIG_VE=n the Container view
is dead code even where CONFIG_MEMCG is on. Compile si_meminfo_ve(),
fill_meminfo_ve() and the code that formats that view under it.
meminfo_proc_show_mi() has to go under the same guard as its only caller,
or it is left as an unused static function - an error rather than a
warning in a CONFIG_VE=n build with CONFIG_WERROR=y, which x86_64
defconfig sets.
The callers of si_meminfo_ve() in do_sysinfo() and swaps_open() are
reached only when !ve_is_super(get_exec_env()), which is a compile-time
false with CONFIG_VE=n, so the compiler drops those branches and no stub
is needed.
Fixes: 7710faa9d4f0 ("ve/proc: virtualize /proc/meminfo in a Container")
Feature: procfs: virtualize /proc/meminfo
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/proc/meminfo.c | 4 ++++
mm/show_mem.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index ac3c88e68728a..27e8f921f31af 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -34,6 +34,7 @@ static void show_val_kb(struct seq_file *m, const char *s, unsigned long num)
seq_write(m, " kB\n", 4);
}
+#ifdef CONFIG_VE
static int meminfo_proc_show_mi(struct seq_file *m, struct meminfo *mi)
{
unsigned long *pages;
@@ -84,6 +85,7 @@ static void fill_meminfo_ve(struct meminfo *mi, struct ve_struct *ve)
css_put(css);
}
+#endif /* CONFIG_VE */
static int meminfo_proc_show_ve(struct seq_file *m, void *v,
struct ve_struct *ve)
@@ -104,11 +106,13 @@ static int meminfo_proc_show_ve(struct seq_file *m, void *v,
mi.si = &i;
mi.ve = ve;
+#ifdef CONFIG_VE
if (!ve_is_super(ve) && ve->meminfo_val == VE_MEMINFO_DEFAULT) {
fill_meminfo_ve(&mi, ve);
return meminfo_proc_show_mi(m, &mi);
}
+#endif
committed = vm_memory_committed();
diff --git a/mm/show_mem.c b/mm/show_mem.c
index 3ab11c945bf4a..15be6c6050e4d 100644
--- a/mm/show_mem.c
+++ b/mm/show_mem.c
@@ -91,6 +91,7 @@ void si_meminfo(struct sysinfo *val)
EXPORT_SYMBOL(si_meminfo);
+#ifdef CONFIG_VE
void si_meminfo_ve(struct sysinfo *si, struct ve_struct *ve)
{
unsigned long memtotal, memused, swaptotal, swapused;
@@ -138,6 +139,7 @@ void si_meminfo_ve(struct sysinfo *si, struct ve_struct *ve)
/* bufferram, totalhigh and freehigh left 0 */
}
EXPORT_SYMBOL(si_meminfo_ve);
+#endif /* CONFIG_VE */
#ifdef CONFIG_NUMA
void si_meminfo_node(struct sysinfo *val, int nid)
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] mm/vmstat: build the /proc/vmstat virtualization only with CONFIG_VE
2026-08-21 16:36 ` [Devel] [PATCH vz10 11/32] mm/vmstat: build the /proc/vmstat " Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 22b53c9453944fb0053512af4128df347b9de26c
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:36:57 2026 +0200
mm/vmstat: build the /proc/vmstat virtualization only with CONFIG_VE
fill_vmstat_ve() fills the Container view of /proc/vmstat from the
Container's memory cgroup, looked up by memory_cgrp_id. It is compiled
unconditionally, so with CONFIG_MEMCG=n - which CONFIG_VE=n allows, and
plain "make defconfig" used to produce - the build fails:
mm/vmstat.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
CONFIG_VE selects CONFIG_MEMCG, so compile both the helper and its call
site under CONFIG_VE. The 've' variable moves into the guarded block:
left at function scope it would be unused with CONFIG_VE=n, which is a
build failure of its own once CONFIG_WERROR=y, as x86_64 defconfig has
it.
Fixes: e15a9e29a433 ("ve/memcg: Virtualize /proc/vmstat view inside CT")
Feature: procfs: virtualize /proc/vmstat
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
mm/vmstat.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 47cb6bf4ecec6..d97eb1d33f8a2 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1855,6 +1855,7 @@ static const struct seq_operations zoneinfo_op = {
(IS_ENABLED(CONFIG_VM_EVENT_COUNTERS) ? \
NR_VM_EVENT_ITEMS : 0))
+#ifdef CONFIG_VE
static void fill_vmstat_ve(unsigned long *stat, struct ve_struct *ve)
{
struct cgroup_subsys_state *css;
@@ -1863,10 +1864,10 @@ static void fill_vmstat_ve(unsigned long *stat, struct ve_struct *ve)
mem_cgroup_fill_vmstat(mem_cgroup_from_css(css), stat);
css_put(css);
}
+#endif
static void *vmstat_start(struct seq_file *m, loff_t *pos)
{
- struct ve_struct *ve;
unsigned long *v;
int i;
@@ -1880,12 +1881,18 @@ static void *vmstat_start(struct seq_file *m, loff_t *pos)
if (!v)
return ERR_PTR(-ENOMEM);
- ve = get_exec_env();
- if (!ve_is_super(ve)) {
- memset(v, 0, NR_VMSTAT_ITEMS * sizeof(unsigned long));
- fill_vmstat_ve(v, ve);
- return (unsigned long *)m->private + *pos;
+#ifdef CONFIG_VE
+ {
+ struct ve_struct *ve = get_exec_env();
+
+ if (!ve_is_super(ve)) {
+ memset(v, 0,
+ NR_VMSTAT_ITEMS * sizeof(unsigned long));
+ fill_vmstat_ve(v, ve);
+ return (unsigned long *)m->private + *pos;
+ }
}
+#endif
for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
v[i] = global_zone_page_state(i);
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] mm/shmem: build the tmpfs size virtualization only with CONFIG_VE
2026-08-21 16:36 ` [Devel] [PATCH vz10 12/32] mm/shmem: build the tmpfs size " Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 064d8fb3a0c7699ef5f0a0ff21dc86bfa60553dc
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:36:58 2026 +0200
mm/shmem: build the tmpfs size virtualization only with CONFIG_VE
tmpfs_ram_pages() sizes a Container's default tmpfs mounts against the
Container's memory cgroup limit, looking the cgroup up by memory_cgrp_id
and reading memcg->memory.max. The function is compiled whenever
CONFIG_TMPFS is set, so with CONFIG_MEMCG=n - which CONFIG_VE=n allows,
and plain "make defconfig" used to produce - the build fails:
mm/shmem.c: error: 'memory_cgrp_id' undeclared (first use in this
function)
mm/shmem.c: error: invalid use of undefined type 'struct mem_cgroup'
CONFIG_VE selects CONFIG_MEMCG, so compile the Container branch under
CONFIG_VE and keep the host branch, which already returns
totalram_pages(), as the only remaining path.
Fixes: e38fda88c26d ("shmem/ve: virtualize tmpfs default size")
Feature: fs: tmpfs virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
mm/shmem.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index a86564c6637e5..522322d4f3599 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -143,20 +143,23 @@ static bool shmem_orders_configured __initdata;
#ifdef CONFIG_TMPFS
static unsigned long tmpfs_ram_pages(void)
{
+#ifdef CONFIG_VE
struct ve_struct *ve = get_exec_env();
- struct cgroup_subsys_state *css;
- unsigned long ve_ram_pages;
- struct mem_cgroup *memcg;
- if (ve_is_super(ve))
- return totalram_pages();
+ if (!ve_is_super(ve)) {
+ struct cgroup_subsys_state *css;
+ unsigned long ve_ram_pages;
+ struct mem_cgroup *memcg;
- css = ve_get_init_css(ve, memory_cgrp_id);
- memcg = mem_cgroup_from_css(css);
- ve_ram_pages = min(totalram_pages(), memcg->memory.max);
- css_put(css);
+ css = ve_get_init_css(ve, memory_cgrp_id);
+ memcg = mem_cgroup_from_css(css);
+ ve_ram_pages = min(totalram_pages(), memcg->memory.max);
+ css_put(css);
- return ve_ram_pages;
+ return ve_ram_pages;
+ }
+#endif
+ return totalram_pages();
}
static unsigned long shmem_default_max_blocks(void)
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n
2026-08-21 16:36 ` [Devel] [PATCH vz10 13/32] mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 7e492586e01dfe5cd3a2fcbe420fcc5ec3138340
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:36:59 2026 +0200
mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n
mem_cgroup_per_node::nid was added into a kABI hole in the middle of the
CONFIG_MEMCG_V1 part of the structure, but it is not a cgroup-v1 field:
percpu_stats_memcg() reads it on the lruvec stats path, to find the
matching per-node structure of the parent an update is forwarded to once a
dying memcg has had its percpu stats freed. So
CONFIG_MEMCG=y together with CONFIG_MEMCG_V1=n does not build:
mm/memcontrol.c: error: 'struct mem_cgroup_per_node' has no member
named 'nid'
Declare the field in the CONFIG_MEMCG_V1=n branch as well, next to the
other read-mostly members. The v1 branch is left exactly as it is, so
the layout of the shipped kernel - and with it the kABI checksum - does
not change.
Fixes: be640870964f ("mm/memcg: Free percpu stats memory of dying memcg's")
Feature: fix rh/mm
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Reported-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/memcontrol.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 72b6b986a08bd..d47c3de71a491 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -109,6 +109,11 @@ struct mem_cgroup_per_node {
bool on_tree;
RH_KABI_FILL_HOLE(unsigned short nid)
#else
+ /*
+ * Not a v1 field: percpu_stats_memcg() needs the node id to find
+ * the matching per-node structure of the parent memcg.
+ */
+ unsigned short nid;
CACHELINE_PADDING(_pad1_);
#endif
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] mm/memcontrol: build memory.numa_migrate only with CONFIG_NUMA
2026-08-21 16:37 ` [Devel] [PATCH vz10 14/32] mm/memcontrol: build memory.numa_migrate only with CONFIG_NUMA Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 e597ec2243c20e0f134c7d873fd8d0785e921c1c
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:37:00 2026 +0200
mm/memcontrol: build memory.numa_migrate only with CONFIG_NUMA
memcg_numa_migrate_write() is defined inside the CONFIG_NUMA block of
memcontrol.c, but its cgroup-v2 cftype entry was added after the #endif,
so CONFIG_NUMA=n does not build:
mm/memcontrol.c: error: 'memcg_numa_migrate_write' undeclared here
(not in a function)
Move the entry inside the same CONFIG_NUMA block, next to memory.numa_stat.
A kernel built without NUMA has no nodes to migrate memory between, so
not offering the file is the right behaviour rather than a limitation.
Fixes: fe28fa7a0794 ("mm/memcontrol: add memory.numa_migrate to cgroup-v2")
Feature: mm: interface to migrate memory between NUMA nodes upon userspace request
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6301319529ee0..4e0c0c46689aa 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5258,12 +5258,12 @@ static struct cftype memory_files[] = {
.name = "numa_stat",
.seq_show = memory_numa_stat_show,
},
-#endif
{
.name = "numa_migrate",
.flags = CFTYPE_NOT_ON_ROOT,
.write = memcg_numa_migrate_write,
},
+#endif
{
.name = "oom.group",
.flags = CFTYPE_NOT_ON_ROOT | CFTYPE_NS_DELEGATABLE,
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ms/percpu: introduce PERCPU_PTR() macro
2026-08-21 16:37 ` [Devel] [PATCH vz10 15/32] ms/percpu: introduce PERCPU_PTR() macro Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 a23ef9b77c3f84b3d5a12baff833f0071300c961
Author: Uros Bizjak <ubizjak@gmail.com>
Date: Fri Aug 21 18:37:01 2026 +0200
ms/percpu: introduce PERCPU_PTR() macro
Introduce PERCPU_PTR() macro to cast the percpu pointer from the percpu
address space to a generic (kernel) address space. Use it in
per_cpu_ptr() and related SHIFT_PERCPU_PTR() macros.
Also remove common knowledge from SHIFT_PERCPU_PTR() comment, "weird cast"
is just a standard way to inform sparse of a cast from the percpu address
space to a generic address space.
Link: https://lkml.kernel.org/r/20241021080856.48746-2-ubizjak at gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 001217defda86d0d6a5a9e6cf77a6b813857e7e3)
Needed here because the RHEL10.2 base brought in the inlined
migrate_disable()/migrate_enable() from a later kernel, and the
this_rq_raw() helper they use expands to PERCPU_PTR() for the !SMP case
while the macro itself was never backported, so CONFIG_SMP=n has never
built:
include/linux/sched.h: error: implicit declaration of function
'PERCPU_PTR'
VERIFY_PERCPU_PTR() cannot be used there instead: like this_cpu_ptr() it
needs the complete type of the pointee, and struct rq is deliberately
opaque in that header - which is the reason this_rq_raw() exists at all.
Conflict resolution:
- !CONFIG_SMP hunk: this tree factors the cast out into
VERIFY_PERCPU_PTR() instead of open-coding it in per_cpu_ptr(), so
the conversion went there and per_cpu_ptr() is left alone.
- dropped the stray trailing semicolon of the upstream macro. With it,
VERIFY_PERCPU_PTR() - which uses PERCPU_PTR() inside a statement
expression - stops evaluating to a pointer and no !SMP build gets
past percpu-defs.h. The next upstream commit, dabddd687c9e ("percpu:
cast percpu pointer in PERCPU_PTR() via unsigned long"), removes the
semicolon anyway; taking it verbatim here would only make this commit
unbuildable.
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix rh/sched
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/percpu-defs.h | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 8efce7414fad6..02bcd74afc6c6 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -220,15 +220,17 @@ do { \
(void)__vpp_verify; \
} while (0)
+#define PERCPU_PTR(__p) \
+ (typeof(*(__p)) __force __kernel *)(__p)
+
#ifdef CONFIG_SMP
/*
- * Add an offset to a pointer but keep the pointer as-is. Use RELOC_HIDE()
- * to prevent the compiler from making incorrect assumptions about the
- * pointer value. The weird cast keeps both GCC and sparse happy.
+ * Add an offset to a pointer. Use RELOC_HIDE() to prevent the compiler
+ * from making incorrect assumptions about the pointer value.
*/
#define SHIFT_PERCPU_PTR(__p, __offset) \
- RELOC_HIDE((typeof(*(__p)) __kernel __force *)(__p), (__offset))
+ RELOC_HIDE(PERCPU_PTR(__p), (__offset))
#define per_cpu_ptr(ptr, cpu) \
({ \
@@ -257,7 +259,7 @@ do { \
#define VERIFY_PERCPU_PTR(__p) \
({ \
__verify_pcpu_ptr(__p); \
- (typeof(*(__p)) __kernel __force *)(__p); \
+ PERCPU_PTR(__p); \
})
#define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); VERIFY_PERCPU_PTR(ptr); })
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long
2026-08-21 16:37 ` [Devel] [PATCH vz10 16/32] ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 739f9b240ca3de6d8ead88a2990724be26366f13
Author: Uros Bizjak <ubizjak@gmail.com>
Date: Fri Aug 21 18:37:02 2026 +0200
ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long
Cast pointer from percpu address space to generic (kernel) address space
in PERCPU_PTR() macro via unsigned long intermediate cast [1]. This
intermediate cast is also required to avoid build failure when GCC's
strict named address space checks for x86 targets [2] are enabled.
Found by GCC's named address space checks.
[1] https://sparse.docs.kernel.org/en/latest/annotations.html#address-space-name
[2] https://gcc.gnu.org/onlinedocs/gcc/Named-Address-Spaces.html#x86-Named-Address-Spaces
Link: https://lkml.kernel.org/r/20241021080856.48746-3-ubizjak at gmail.com
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit dabddd687c9e1a06241d6b4d1f66b9f2b60b3ad1)
Conflict resolution: the previous patch of the same upstream series had
to drop the stray trailing semicolon of PERCPU_PTR() to stay buildable
here, so only the body of the macro is replaced.
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix rh/sched
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/percpu-defs.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h
index 02bcd74afc6c6..ee236ee0bed6c 100644
--- a/include/linux/percpu-defs.h
+++ b/include/linux/percpu-defs.h
@@ -221,7 +221,10 @@ do { \
} while (0)
#define PERCPU_PTR(__p) \
- (typeof(*(__p)) __force __kernel *)(__p)
+({ \
+ unsigned long __pcpu_ptr = (__force unsigned long)(__p); \
+ (typeof(*(__p)) __force __kernel *)(__pcpu_ptr); \
+})
#ifdef CONFIG_SMP
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] mm/memcontrol: add missing inline to the mem_cgroup_fill_meminfo() stub
2026-08-21 16:37 ` [Devel] [PATCH vz10 17/32] mm/memcontrol: add missing inline to the mem_cgroup_fill_meminfo() stub Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 e976003eb47715a1d96e05c4cb66aba9449b7157
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:37:03 2026 +0200
mm/memcontrol: add missing inline to the mem_cgroup_fill_meminfo() stub
The !CONFIG_MEMCG stub of mem_cgroup_fill_meminfo() is declared "static
void", not "static inline void", so every translation unit that includes
memcontrol.h without calling it gets an unused function - an error rather
than a warning once CONFIG_WERROR=y, as x86_64 defconfig has it:
include/linux/memcontrol.h: error: 'mem_cgroup_fill_meminfo' defined
but not used [-Werror=unused-function]
Add the missing inline, like every other stub in the same #else block.
Fixes: 7710faa9d4f0 ("ve/proc: virtualize /proc/meminfo in a Container")
Feature: procfs: virtualize /proc/meminfo
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/memcontrol.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index d47c3de71a491..2772a7750fa4e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -1559,7 +1559,8 @@ static inline void split_page_memcg(struct page *head, int old_order, int new_or
{
}
-static void mem_cgroup_fill_meminfo(struct mem_cgroup *memcg, struct meminfo *mi)
+static inline void mem_cgroup_fill_meminfo(struct mem_cgroup *memcg,
+ struct meminfo *mi)
{
}
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] block: guard the cbt_list initialization with CONFIG_BLK_DEV_CBT
2026-08-21 16:37 ` [Devel] [PATCH vz10 18/32] block: guard the cbt_list initialization with CONFIG_BLK_DEV_CBT Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 0e4bc177e1b1f228fb346caaafca08d4533302af
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:37:04 2026 +0200
block: guard the cbt_list initialization with CONFIG_BLK_DEV_CBT
request_queue::cbt_list only exists when CONFIG_BLK_DEV_CBT is enabled,
but blk_alloc_queue() initializes it unconditionally, so the build fails
without that option:
block/blk-core.c: error: 'struct request_queue' has no member named
'cbt_list'
CONFIG_BLK_DEV_CBT has no default, so every configuration that does not
ask for it explicitly hits this, plain x86_64 defconfig included.
Guard the INIT_LIST_HEAD() the same way the field itself is guarded.
Fixes: e5c67003994e ("block/blk-cbt: allow multiple cbts in a single queue")
Feature: cbt: changed block tracking (for backup)
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
block/blk-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-core.c b/block/blk-core.c
index a168f2e41b7da..bcc3060de670c 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -440,7 +440,9 @@ struct request_queue *blk_alloc_queue(struct queue_limits *lim, int node_id)
init_waitqueue_head(&q->mq_freeze_wq);
mutex_init(&q->mq_freeze_lock);
+#ifdef CONFIG_BLK_DEV_CBT
INIT_LIST_HEAD(&q->cbt_list);
+#endif
blkg_init_queue(q);
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ve: include asm/vdso.h on x86 only
2026-08-21 16:37 ` [Devel] [PATCH vz10 19/32] ve: include asm/vdso.h on x86 only Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 0f3478b52d6a28f77ae52ef788352ecbaa3ac96a
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:37:05 2026 +0200
ve: include asm/vdso.h on x86 only
include/linux/ve.h includes asm/vdso.h for struct vdso_image, which
struct ve_struct keeps two pointers to - the per-Container copies of the
VDSO images. The header is x86-only, and ve.h is included from a lot of
generic code, so building for an architecture without it fails
everywhere at once - User Mode Linux, which we now want for KUnit, has no
asm/vdso.h at all:
include/linux/ve.h:21:10: fatal error: asm/vdso.h: No such file or
directory
A forward declaration of struct vdso_image is all the rest of the header
needs there, since nothing outside x86 dereferences one. For the same
reason compile the CONFIG_VE=n stubs of ve_get_vdso_32() /
ve_get_vdso_64() on x86 only: they hand out vdso_image_32 / vdso_image_64,
which exist nowhere else, and their callers are all in arch/x86.
Also drop the duplicated linux/binfmts.h include while touching this
block.
Feature: mm: vdso virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Reported-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/ve.h | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/include/linux/ve.h b/include/linux/ve.h
index cba827260d07f..46e67d00cf783 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -18,11 +18,19 @@
#include <linux/kthread.h>
#include <linux/binfmts.h>
#include <linux/tty_driver.h>
-#include <asm/vdso.h>
#include <linux/time_namespace.h>
-#include <linux/binfmts.h>
#include <linux/pid.h>
+/*
+ * struct vdso_image and the static images the stubs below hand out are
+ * x86-only; User Mode Linux has no asm/vdso.h at all.
+ */
+#ifdef CONFIG_X86
+#include <asm/vdso.h>
+#else
+struct vdso_image;
+#endif
+
struct nsproxy;
struct user_namespace;
struct ve_namespace;
@@ -366,6 +374,7 @@ static inline void ve_setup_task(struct task_struct *p, struct ve_struct *ve) {
static inline void ve_set_rpc_kill_fn(void (*fn)(struct net *, bool)) { }
+#ifdef CONFIG_X86
static inline struct vdso_image *ve_get_vdso_32(struct ve_struct *ve)
{
return (struct vdso_image *)&vdso_image_32;
@@ -375,6 +384,7 @@ static inline struct vdso_image *ve_get_vdso_64(struct ve_struct *ve)
{
return (struct vdso_image *)&vdso_image_64;
}
+#endif /* CONFIG_X86 */
#endif /* CONFIG_VE */
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ve: compile the per-Container VDSO copies only on x86
2026-08-21 16:37 ` [Devel] [PATCH vz10 20/32] ve: compile the per-Container VDSO copies only on x86 Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 808be136dd616db003ce8cb97de125d34338d633
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:37:06 2026 +0200
ve: compile the per-Container VDSO copies only on x86
Every Container gets its own copy of the VDSO images so that the Linux
version code inside them can be patched to whatever the Container's
os_release says. All of that is built on vdso_image_64 / vdso_image_32,
which exist on x86 only, while kernel/ve/ve.c is generic code - so the
file does not compile on an architecture without them, User Mode Linux
being the one we now want for KUnit:
kernel/ve/ve.c: error: 'vdso_image_64' undeclared here
(not in a function)
Guard the ve0 initializer, copy_vdso()/ve_free_vdso() and their callers
with CONFIG_X86, and give ve_free_vdso() a no-op stub so the error path of
ve_create() stays as it is. Its err_vdso label stays reachable either
way, since ve_mount_devtmpfs() jumps to it too. A Container on an
architecture without a patchable VDSO simply keeps the host's.
Feature: mm: vdso virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/ve/ve.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 73d1c3b4873e5..3a9f3841fe55b 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -85,8 +85,10 @@ struct ve_struct ve0 = {
.meminfo_val = VE_MEMINFO_SYSTEM,
.umh_running_helpers = ATOMIC_INIT(0),
.umh_helpers_waitq = __WAIT_QUEUE_HEAD_INITIALIZER(ve0.umh_helpers_waitq),
+#ifdef CONFIG_X86
.vdso_64 = (struct vdso_image*)&vdso_image_64,
.vdso_32 = (struct vdso_image*)&vdso_image_32,
+#endif
};
EXPORT_SYMBOL(ve0);
@@ -675,6 +677,7 @@ u64 ve_get_uptime(struct ve_struct *ve)
}
EXPORT_SYMBOL(ve_get_uptime);
+#ifdef CONFIG_X86
static int copy_vdso(struct vdso_image **vdso_dst, const struct vdso_image *vdso_src)
{
struct vdso_image *vdso;
@@ -712,6 +715,9 @@ static void ve_free_vdso(struct ve_struct *ve)
kfree(ve->vdso_32);
}
}
+#else
+static inline void ve_free_vdso(struct ve_struct *ve) { }
+#endif
static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_css)
{
@@ -758,6 +764,7 @@ static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_
if (err)
goto err_log;
+#ifdef CONFIG_X86
err = copy_vdso(&ve->vdso_64, &vdso_image_64);
if (err)
goto err_vdso;
@@ -765,6 +772,7 @@ static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_
err = copy_vdso(&ve->vdso_32, &vdso_image_32);
if (err)
goto err_vdso;
+#endif
err = ve_mount_devtmpfs(ve);
if (err)
@@ -1158,8 +1166,10 @@ static ssize_t ve_os_release_write(struct kernfs_open_file *of, char *buf,
if (sscanf(buf, "%d.%d.%d", &n1, &n2, &n3) == 3) {
new_version = ((n1 << 16) + (n2 << 8)) + n3;
+#ifdef CONFIG_X86
*((int *)(ve->vdso_64->data + ve->vdso_64->sym_linux_version_code)) = new_version;
*((int *)(ve->vdso_32->data + ve->vdso_32->sym_linux_version_code)) = new_version;
+#endif
}
down_write(&uts_sem);
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ve: compile the CPUID override propagation only on x86
2026-08-21 16:37 ` [Devel] [PATCH vz10 21/32] ve: compile the CPUID override propagation " Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 18ec50574c3fdbc95e29267ed062130e14d9e0ad
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:37:07 2026 +0200
ve: compile the CPUID override propagation only on x86
ve_setup_task() arms TIF_CPUID_OVERRIDE for tasks of a Container whenever
/proc/vz/cpuid_override is in use. Both cpuid_override_on() and the
thread flag are x86-only, so generic kernel/ve/ve.c does not compile on
an architecture without them - User Mode Linux, for one:
kernel/ve/ve.c: error: implicit declaration of function
'cpuid_override_on'
kernel/ve/ve.c: error: 'TIF_CPUID_OVERRIDE' undeclared
Guard the propagation with CONFIG_X86. There is no CPUID to fake
elsewhere, so nothing is lost.
Feature: x86: cpu pools (cpuid override)
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/ve/ve.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 3a9f3841fe55b..0f0e1a424953b 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -1852,8 +1852,10 @@ void ve_setup_task(struct task_struct *task, struct ve_struct *ve)
ve_set_task_start_time(ve, task);
+#ifdef CONFIG_X86
if (cpuid_override_on())
set_tsk_thread_flag(task, TIF_CPUID_OVERRIDE);
+#endif
}
EXPORT_SYMBOL(ve_setup_task);
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ve: mark ve0.css with CSS_NO_REF
2026-08-21 16:37 ` [Devel] [PATCH vz10 22/32] ve: mark ve0.css with CSS_NO_REF Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
2026-08-21 16:50 ` [Devel] [PATCH vz10 22/32] " Konstantin Khorenko
1 sibling, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 ea72f3512a97bc7064523e24e5cd4b295db45bdc
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:37:08 2026 +0200
ve: mark ve0.css with CSS_NO_REF
ve0.css is the root css of the ve cgroup subsystem, and ve_cgrp_subsys is
not an early_init one, so the css - its percpu_ref included - is only set
up by cgroup_init(). net_ns_init(), however, runs before cgroup_init()
in start_kernel() and takes a reference on ve0:
start_kernel()
net_ns_init() /* init/main.c, before cgroup_init() */
init_net.owner_ve = get_ve(&ve0)
css_get(&ve0.css) /* flags == 0, refcnt not set up */
percpu_ref_get(&ve0.css.refcnt)
At that point css.refcnt is all zeroes, so __ref_is_percpu() sees no
__PERCPU_REF_ATOMIC_DEAD bits, decides the counter is in percpu mode and
increments *(unsigned long __percpu *)NULL - that is, whatever happens to
live at the start of the percpu area. On x86 that quietly corrupts a
percpu variable on every boot; under User Mode Linux it faults outright,
which is how it was found.
ve0 is a permanent singleton that is never freed, exactly like the root
css objects that cgroup_init_subsys() marks CSS_NO_REF, so give it that
flag from the start. css_get()/css_put() on ve0 then become no-ops in
both windows, before and after cgroup_init().
Fixes: 6087cf234cc5 ("ve/net: thread owning ve through copy_net_ns")
Feature: ve: ve generic structures
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/ve/ve.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 0f0e1a424953b..750a1b2882a7d 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -53,6 +53,7 @@ static struct kmem_cache *ve_cachep;
static DEFINE_PER_CPU(struct kstat_lat_pcpu_snap_struct, ve0_lat_stats);
struct ve_struct ve0 = {
+ .css = { .flags = CSS_NO_REF },
.ve_name = "0",
.start_jiffies = INITIAL_JIFFIES,
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] mm/memory: build the page fault latency accounting for x86 only
2026-08-21 16:37 ` [Devel] [PATCH vz10 23/32] mm/memory: build the page fault latency accounting for x86 only Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 <eva.kurchatova@virtuozzo.com>
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 <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
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 <linux/uaccess.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
+#ifdef CONFIG_X86
#include <asm/tsc.h>
+#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,
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] sched/core: include cgroup-internal.h only where it is used
2026-08-21 16:37 ` [Devel] [PATCH vz10 24/32] sched/core: include cgroup-internal.h only where it is used Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 cdd5aa0c11e9db9ca76c5088afff92da459e467f
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:37:10 2026 +0200
sched/core: include cgroup-internal.h only where it is used
kernel/sched/core.c includes the private cgroup-internal.h for the sake of
one cgroup_task_count() call in cpu_cgroup_proc_loadavg(), which lives in
the CONFIG_CGROUP_SCHED part of the file. The include itself is
unconditional, and it does not compile without the cgroup core:
cgroup/cgroup-internal.h:188:22: error: invalid use of undefined type
'const struct cgroup'
cgroup/cgroup-internal.h:188:37: error: 'CSS_ONLINE' undeclared (first
use in this function)
Guard the include with CONFIG_CGROUP_SCHED, the same condition as its only
user. This does not make CONFIG_CGROUPS=n build by itself - struct
ve_struct embeds a struct cgroup_subsys_state, so ve.h needs the cgroup
core in any case - but it does keep another subsystem's private header out
of scheduler translation units that have no use for it.
Fixes: c0997a766674 ("ve/proc/loadavg: Virtualize /proc/loadavg in Containers")
Feature: statistics: loadavg virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
kernel/sched/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7d2214749245b..fb2477cb1d076 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -152,7 +152,9 @@ __read_mostly unsigned int sysctl_sched_features =
__read_mostly int sysctl_resched_latency_warn_ms = 100;
__read_mostly int sysctl_resched_latency_warn_once = 1;
+#ifdef CONFIG_CGROUP_SCHED
#include "../cgroup/cgroup-internal.h" /* For cgroup_task_count() */
+#endif
/*
* Number of tasks to iterate in a single balance run.
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] kernfs: build the KERNFS_GET_NS ioctl only with CONFIG_NET
2026-08-21 16:37 ` [Devel] [PATCH vz10 25/32] kernfs: build the KERNFS_GET_NS ioctl only with CONFIG_NET Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 370fbd80ffc815f87e01ec8f2184141367a37e08
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Fri Aug 21 18:37:11 2026 +0200
kernfs: build the KERNFS_GET_NS ioctl only with CONFIG_NET
The KERNFS_GET_NS ioctl hands out the network namespace a sysfs directory
is tagged with, so it calls maybe_get_net_ns(), which exists only with the
networking stack:
fs/kernfs/file.c:1030:50: error: 'maybe_get_net_ns' undeclared (first
use in this function)
fs/kernfs/file.c:1029:21: error: this statement may fall through
[-Werror=implicit-fallthrough=]
Compile the whole body under CONFIG_NET and return -ENOTTY otherwise. The
three local variables move inside the guard along with it: left at function
scope they are unused with CONFIG_NET=n, which is an error once
CONFIG_WERROR=y.
The switch is replaced by an if as part of that, because it reads better
once there is an #ifdef in the picture. Keeping the switch would mean
either a second #ifdef of its own around the declarations, or a switch
whose only unconditional arm is the default one; an if plus a tail return
says the same thing under a single guard.
Fixes: 38c2983fa828 ("kernfs/sysfs: add ioctl to get fd network namespace tag")
Feature: sysfs: per-CT entries visibility and permissions configuration
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/kernfs/file.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index 092a4dcd2ebfb..5c72f05a9e41f 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -1018,19 +1018,19 @@ EXPORT_SYMBOL_GPL(kernfs_notify);
long kernfs_ioctl(struct file *file, unsigned int ioctl,
unsigned long arg)
{
+#ifdef CONFIG_NET
struct dentry *dentry = file->f_path.dentry;
const void *ns = kernfs_info(dentry->d_sb)->ns;
struct net *net;
- switch (ioctl) {
- case KERNFS_GET_NS:
+ if (ioctl == KERNFS_GET_NS) {
if (dentry->d_sb->s_magic != SYSFS_MAGIC || !ns)
return -ENOTTY;
net = (struct net *)ns;
return open_related_ns(&net->ns, maybe_get_net_ns);
- default:
- return -ENOTTY;
}
+#endif
+ return -ENOTTY;
}
const struct file_operations kernfs_file_fops = {
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] fs/fs_context: build the mount option formatting only with CONFIG_VE
2026-08-21 16:37 ` [Devel] [PATCH vz10 26/32] fs/fs_context: build the mount option formatting only with CONFIG_VE Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 ce6d25ec004839d21f02813c000995778b846f57
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:37:12 2026 +0200
fs/fs_context: build the mount option formatting only with CONFIG_VE
vfs_format_sb_flags() and the two helpers it is built on exist to render
the effective superblock flags back into an option string, which the
Container device-mount policy then checks with ve_devmnt_verify(). Their
only caller sits in the CONFIG_VE part of the file while they do not, so
CONFIG_VE=n leaves them unused - an error rather than a warning once
CONFIG_WERROR=y, as x86_64 defconfig has it:
fs/fs_context.c: error: 'vfs_format_sb_flags' defined but not used
[-Werror=unused-function]
Move the whole group under CONFIG_VE, next to its caller.
Fixes: 37940d776226 ("fs: enforce container device-mount policy in the common mount path")
Feature: ve: ve generic structures
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/fs_context.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/fs_context.c b/fs/fs_context.c
index b2bd21a420836..58fe6f0ce8e8c 100644
--- a/fs/fs_context.c
+++ b/fs/fs_context.c
@@ -81,6 +81,7 @@ static int vfs_parse_sb_flag(struct fs_context *fc, const char *key)
return -ENOPARAM;
}
+#ifdef CONFIG_VE
/*
* Emit option @name into @buff at *@off, prefixed with ',' if the buffer
* already holds text. Advances *@off. Returns 0 or -E2BIG if @buff is full.
@@ -144,6 +145,7 @@ static int vfs_format_sb_flags(char *buff, size_t size, size_t *off,
return 0;
}
+#endif /* CONFIG_VE */
/**
* vfs_parse_fs_param_source - Handle setting "source" via parameter
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n
2026-08-21 16:37 ` [Devel] [PATCH vz10 27/32] net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 9653e667efe1c8ea07954bb0b39f1a5116445afd
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:37:13 2026 +0200
net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n
The MSG_ERRQUEUE path of unix_stream_recvmsg() passes the socket to
unix_recv_error(), but 'sk' is declared inside the CONFIG_BPF_SYSCALL
block a few lines above, so the function does not build without that
option:
net/unix/af_unix.c:3073:40: error: 'sk' undeclared (first use in this
function)
x86_64 defconfig and the User Mode Linux defconfig - the one we want for
KUnit - both have CONFIG_BPF_SYSCALL=n, so neither has ever built this
file.
Declare 'sk' unconditionally; the BPF block keeps its own 'prot'.
Fixes: c9ccba858dd1 ("net: zerocopy over unix sockets")
Feature: net: zerocopy over unix sockets
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
net/unix/af_unix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index fa9038e89f838..7a37c06a097c4 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -3060,9 +3060,9 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg,
.size = size,
.flags = flags
};
+ struct sock *sk = sock->sk;
#ifdef CONFIG_BPF_SYSCALL
- struct sock *sk = sock->sk;
const struct proto *prot = READ_ONCE(sk->sk_prot);
if (prot != &unix_stream_proto)
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] redhat: rh_flags: make the !CONFIG_RHEL_DIFFERENCES stubs inline
2026-08-21 16:37 ` [Devel] [PATCH vz10 28/32] redhat: rh_flags: make the !CONFIG_RHEL_DIFFERENCES stubs inline Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 7162d0a644374f25ae0a1b50b477c53fc47c5e4b
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:37:14 2026 +0200
redhat: rh_flags: make the !CONFIG_RHEL_DIFFERENCES stubs inline
The stubs are declared "static void", not "static inline void", so every
translation unit that includes rh_flags.h without calling them gets two
unused functions. That breaks the build of any kernel that has
CONFIG_RHEL_DIFFERENCES off and CONFIG_WERROR on - x86_64 defconfig,
which we now want to keep building, is one of them:
include/linux/rh_flags.h:32:13: error: 'rh_add_flag' defined but not
used [-Werror=unused-function]
include/linux/rh_flags.h:31:13: error: 'rh_print_flags' defined but not
used [-Werror=unused-function]
Fixes: 5e75024bc506 ("redhat: rh_flags: declare proper static methods when !CONFIG_RHEL_DIFFERENCES")
Feature: fix rh/flags
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/rh_flags.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/rh_flags.h b/include/linux/rh_flags.h
index d498d319ace3a..4bb0f5585df0b 100644
--- a/include/linux/rh_flags.h
+++ b/include/linux/rh_flags.h
@@ -28,7 +28,7 @@ void rh_print_flags(void);
unlikely(__ret_mark_once); \
})
#else
-static void rh_print_flags(void) { }
-static void rh_add_flag(const char *flag_name) { }
+static inline void rh_print_flags(void) { }
+static inline void rh_add_flag(const char *flag_name) { }
#endif
#endif
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ms/pcmcia: cistpl: Constify 'struct bin_attribute'
2026-08-21 16:37 ` [Devel] [PATCH vz10 29/32] ms/pcmcia: cistpl: Constify 'struct bin_attribute' Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 889c35dad8118bbce4445b873c67a6d7a931db22
Author: Thomas Wei??schuh <linux@weissschuh.net>
Date: Fri Aug 21 18:37:15 2026 +0200
ms/pcmcia: cistpl: Constify 'struct bin_attribute'
The sysfs core now allows instances of 'struct bin_attribute' to be
moved into read-only memory. Make use of that to protect them against
accidental or malicious modifications.
Signed-off-by: Thomas Wei??schuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241215-sysfs-const-bin_attr-pcmcia-v1-1-ebb82e47d834 at weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 05a9896fa9e15466456a1b1dc9d2eacdf3551b79)
Needed here because the RHEL10.2 base carries the sysfs side of the
conversion but not the pcmcia one, so the initializer of pccard_cis_attr
does not compile at all:
drivers/pcmcia/cistpl.c:1608:17: error: initialization of
'ssize_t (*)(struct file *, struct kobject *,
const struct bin_attribute *, char *, loff_t, size_t)'
from incompatible pointer type [-Wincompatible-pointer-types]
Our shipped configs have CONFIG_PCCARD=n so it goes unnoticed there,
while plain x86_64 defconfig - which we now want to keep building for
KUnit - enables it. Applies as is: this tree's struct bin_attribute has
both the ::read/::write and the ::read_new/::write_new members, and
sysfs_kf_bin_read() prefers the latter.
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix ms/pcmcia
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
drivers/pcmcia/cistpl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c
index d018f36f3a893..0c801e4ccc6c2 100644
--- a/drivers/pcmcia/cistpl.c
+++ b/drivers/pcmcia/cistpl.c
@@ -1540,7 +1540,7 @@ static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf,
static ssize_t pccard_show_cis(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr,
+ const struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
unsigned int size = 0x200;
@@ -1571,7 +1571,7 @@ static ssize_t pccard_show_cis(struct file *filp, struct kobject *kobj,
static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr,
+ const struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
{
struct pcmcia_socket *s;
@@ -1605,6 +1605,6 @@ static ssize_t pccard_store_cis(struct file *filp, struct kobject *kobj,
const struct bin_attribute pccard_cis_attr = {
.attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR },
.size = 0x200,
- .read = pccard_show_cis,
- .write = pccard_store_cis,
+ .read_new = pccard_show_cis,
+ .write_new = pccard_store_cis,
};
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] redhat: rh_waived: add a stub for CONFIG_RHEL_DIFFERENCES=n
2026-08-21 16:37 ` [Devel] [PATCH vz10 30/32] redhat: rh_waived: add a stub for CONFIG_RHEL_DIFFERENCES=n Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 01feec3c519a85a9979fdbed970138ebd312c26c
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:37:16 2026 +0200
redhat: rh_waived: add a stub for CONFIG_RHEL_DIFFERENCES=n
is_rh_waived() is compiled as part of kernel/rh_waived.c, which is built
only with CONFIG_RHEL_DIFFERENCES, but huge_pmd_unshare() calls it
unconditionally, so a kernel built without that option does not link:
ld: vmlinux.o: in function 'huge_pmd_unshare':
undefined reference to 'is_rh_waived'
x86_64 defconfig is one such kernel. Add a stub returning false: with no
way to pass
rh_waived= there is nothing waived, so every mitigation stays enabled.
Fixes: 9f055df11343 ("rh10: import RHEL10 kernel-6.12.0-211.16.1.el10")
Feature: fix rh/waived
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
include/linux/rh_waived.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/rh_waived.h b/include/linux/rh_waived.h
index 8ec7aabab3ab7..e6aab88182411 100644
--- a/include/linux/rh_waived.h
+++ b/include/linux/rh_waived.h
@@ -15,6 +15,13 @@ enum rh_waived_items {
RH_WAIVED_ITEMS,
};
+#ifdef CONFIG_RHEL_DIFFERENCES
bool is_rh_waived(enum rh_waived_items feat);
+#else
+static inline bool is_rh_waived(enum rh_waived_items feat)
+{
+ return false;
+}
+#endif
#endif /* _RH_WAIVED_H */
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] ext4: select LIBCRC32C
2026-08-21 16:37 ` [Devel] [PATCH vz10 31/32] ext4: select LIBCRC32C Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 ff1034933e199cca8a40e9156ba2cc49df80a62b
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:37:17 2026 +0200
ext4: select LIBCRC32C
ext4 computes its metadata checksums with crc32c(). Upstream that helper
moved into lib/crc32.c under CONFIG_CRC32, which is what ext4 selects, but
this tree still has the older layout where it lives in lib/libcrc32c.c
under CONFIG_LIBCRC32C - the RHEL10.2 base carries the ext4 side of the
conversion and not the lib one. So a kernel with ext4 built in and
nothing else pulling libcrc32c in does not link:
ld: vmlinux.o: in function 'ext4_inode_bitmap_csum_verify':
undefined reference to 'crc32c'
Our configs get away with it because other filesystems select
CONFIG_LIBCRC32C; plain x86_64 defconfig, which we now want to keep
building, does not. Select it explicitly until the lib side is caught up
with upstream, where this select becomes redundant rather than wrong.
Fixes: 9f055df11343 ("rh10: import RHEL10 kernel-6.12.0-211.16.1.el10")
Feature: fix ms/ext4
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
fs/ext4/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
index c9ca41d91a6c1..8849d297102d5 100644
--- a/fs/ext4/Kconfig
+++ b/fs/ext4/Kconfig
@@ -32,6 +32,7 @@ config EXT4_FS
select JBD2
select CRC16
select CRC32
+ select LIBCRC32C
select FS_IOMAP
select FS_ENCRYPTION_ALGS if FS_ENCRYPTION
help
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] kunit: add the script dir to sys.path for PYTHONSAFEPATH compatibility
2026-08-21 16:37 ` [Devel] [PATCH vz10 32/32] kunit: add the script dir to sys.path for PYTHONSAFEPATH compatibility Konstantin Khorenko
@ 2026-08-21 16:42 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:42 UTC (permalink / raw)
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 7a2f379b54dc30a92d1f758221cddbb78f7c1f74
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date: Fri Aug 21 18:37:18 2026 +0200
kunit: add the script dir to sys.path for PYTHONSAFEPATH compatibility
The RHEL10 import changed the Python shebang of the in-tree tools from
'#!/usr/bin/python3 -s' to '#!/usr/bin/python3 -sP'. The -P flag turns on
safe path mode (PYTHONSAFEPATH, Python 3.11+), which stops Python from
prepending the script's own directory to sys.path - so kunit.py cannot
import the modules sitting right next to it, and the KUnit tool does not
start at all:
$ ./tools/testing/kunit/kunit.py run
Traceback (most recent call last):
File "tools/testing/kunit/kunit.py", line 23, in <module>
import kunit_json
ModuleNotFoundError: No module named 'kunit_json'
Add the script's directory to sys.path before the local imports in the two
executable scripts that have them, kunit.py and kunit_tool_test.py,
following commit e6c430f5a2cc ("selftests/damon: add script dir to
sys.path for PYTHONSAFEPATH compatibility") which fixed the same breakage
for the DAMON selftests.
Fixes: 9f055df11343 ("rh10: import RHEL10 kernel-6.12.0-211.16.1.el10")
Feature: fix KUnit tests
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
tools/testing/kunit/kunit.py | 1 +
tools/testing/kunit/kunit_tool_test.py | 2 ++
2 files changed, 3 insertions(+)
diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py
index 13ccb99937764..b4bc6c7427182 100755
--- a/tools/testing/kunit/kunit.py
+++ b/tools/testing/kunit/kunit.py
@@ -20,6 +20,7 @@ from dataclasses import dataclass
from enum import Enum, auto
from typing import Iterable, List, Optional, Sequence, Tuple
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import kunit_json
import kunit_kernel
import kunit_parser
diff --git a/tools/testing/kunit/kunit_tool_test.py b/tools/testing/kunit/kunit_tool_test.py
index 3121e133e9492..265a8999aada7 100755
--- a/tools/testing/kunit/kunit_tool_test.py
+++ b/tools/testing/kunit/kunit_tool_test.py
@@ -16,8 +16,10 @@ import json
import os
import signal
import subprocess
+import sys
from typing import Iterable
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import kunit_config
import kunit_parser
import kunit_kernel
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Devel] [PATCH vz10 22/32] ve: mark ve0.css with CSS_NO_REF
2026-08-21 16:37 ` [Devel] [PATCH vz10 22/32] ve: mark ve0.css with CSS_NO_REF Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
@ 2026-08-21 16:50 ` Konstantin Khorenko
2026-08-24 8:50 ` Pavel Tikhomirov
1 sibling, 1 reply; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-21 16:50 UTC (permalink / raw)
Guys, please note the current patch, this is the most important one here.
--
Best regards,
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
On 8/21/26 18:37, Konstantin Khorenko wrote:
> From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
>
> ve0.css is the root css of the ve cgroup subsystem, and ve_cgrp_subsys is
> not an early_init one, so the css - its percpu_ref included - is only set
> up by cgroup_init(). net_ns_init(), however, runs before cgroup_init()
> in start_kernel() and takes a reference on ve0:
>
> start_kernel()
> net_ns_init() /* init/main.c, before cgroup_init() */
> init_net.owner_ve = get_ve(&ve0)
> css_get(&ve0.css) /* flags == 0, refcnt not set up */
> percpu_ref_get(&ve0.css.refcnt)
>
> At that point css.refcnt is all zeroes, so __ref_is_percpu() sees no
> __PERCPU_REF_ATOMIC_DEAD bits, decides the counter is in percpu mode and
> increments *(unsigned long __percpu *)NULL - that is, whatever happens to
> live at the start of the percpu area. On x86 that quietly corrupts a
> percpu variable on every boot; under User Mode Linux it faults outright,
> which is how it was found.
>
> ve0 is a permanent singleton that is never freed, exactly like the root
> css objects that cgroup_init_subsys() marks CSS_NO_REF, so give it that
> flag from the start. css_get()/css_put() on ve0 then become no-ops in
> both windows, before and after cgroup_init().
>
> Fixes: 6087cf234cc5 ("ve/net: thread owning ve through copy_net_ns")
> Feature: ve: ve generic structures
> https://virtuozzo.atlassian.net/browse/VSTOR-134732
> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
> ---
> kernel/ve/ve.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
> index 0f0e1a424953..750a1b2882a7 100644
> --- a/kernel/ve/ve.c
> +++ b/kernel/ve/ve.c
> @@ -53,6 +53,7 @@ static struct kmem_cache *ve_cachep;
> static DEFINE_PER_CPU(struct kstat_lat_pcpu_snap_struct, ve0_lat_stats);
>
> struct ve_struct ve0 = {
> + .css = { .flags = CSS_NO_REF },
> .ve_name = "0",
> .start_jiffies = INITIAL_JIFFIES,
>
^ permalink raw reply [flat|nested] 68+ messages in thread
* Re: [Devel] [PATCH vz10 22/32] ve: mark ve0.css with CSS_NO_REF
2026-08-21 16:50 ` [Devel] [PATCH vz10 22/32] " Konstantin Khorenko
@ 2026-08-24 8:50 ` Pavel Tikhomirov
0 siblings, 0 replies; 68+ messages in thread
From: Pavel Tikhomirov @ 2026-08-24 8:50 UTC (permalink / raw)
Reviewed-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Sounds good, I somehow was under impression that we always had
CSS_NO_REF there...
On 8/21/26 18:50, Konstantin Khorenko wrote:
> Guys, please note the current patch, this is the most important one here.
>
> --
> Best regards,
>
> Konstantin Khorenko,
> Virtuozzo Linux Kernel Team
>
> On 8/21/26 18:37, Konstantin Khorenko wrote:
>> From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
>>
>> ve0.css is the root css of the ve cgroup subsystem, and ve_cgrp_subsys is
>> not an early_init one, so the css - its percpu_ref included - is only set
>> up by cgroup_init(). net_ns_init(), however, runs before cgroup_init()
>> in start_kernel() and takes a reference on ve0:
>>
>> start_kernel()
>> net_ns_init() /* init/main.c, before cgroup_init() */
>> init_net.owner_ve = get_ve(&ve0)
>> css_get(&ve0.css) /* flags == 0, refcnt not set up */
>> percpu_ref_get(&ve0.css.refcnt)
>>
>> At that point css.refcnt is all zeroes, so __ref_is_percpu() sees no
>> __PERCPU_REF_ATOMIC_DEAD bits, decides the counter is in percpu mode and
>> increments *(unsigned long __percpu *)NULL - that is, whatever happens to
>> live at the start of the percpu area. On x86 that quietly corrupts a
>> percpu variable on every boot; under User Mode Linux it faults outright,
>> which is how it was found.
>>
>> ve0 is a permanent singleton that is never freed, exactly like the root
>> css objects that cgroup_init_subsys() marks CSS_NO_REF, so give it that
>> flag from the start. css_get()/css_put() on ve0 then become no-ops in
>> both windows, before and after cgroup_init().
>>
>> Fixes: 6087cf234cc5 ("ve/net: thread owning ve through copy_net_ns")
>> Feature: ve: ve generic structures
>> https://virtuozzo.atlassian.net/browse/VSTOR-134732
>> Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
>> Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
>> ---
>> kernel/ve/ve.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
>> index 0f0e1a424953..750a1b2882a7 100644
>> --- a/kernel/ve/ve.c
>> +++ b/kernel/ve/ve.c
>> @@ -53,6 +53,7 @@ static struct kmem_cache *ve_cachep;
>> static DEFINE_PER_CPU(struct kstat_lat_pcpu_snap_struct, ve0_lat_stats);
>>
>> struct ve_struct ve0 = {
>> + .css = { .flags = CSS_NO_REF },
>> .ve_name = "0",
>> .start_jiffies = INITIAL_JIFFIES,
>>
>
--
Best regards, Pavel Tikhomirov
Senior Software Developer, Virtuozzo.
^ permalink raw reply [flat|nested] 68+ messages in thread
* [Devel] [PATCH RHEL10 COMMIT] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n
[not found] <20260625220832.2201873-1-eva.kurchatova@virtuozzo.com>
@ 2026-08-20 16:57 ` Konstantin Khorenko
0 siblings, 0 replies; 68+ messages in thread
From: Konstantin Khorenko @ 2026-08-20 16:57 UTC (permalink / raw)
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 f869ffa52901a2949cf1554e573e3500b9f85f32
Author: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Date: Thu Aug 20 18:42:45 2026 +0200
sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n
get_avenrun_tg() dereferences struct task_group, which is only defined
under CONFIG_CGROUP_SCHED in kernel/sched/sched.h. Both the function
and its unconditional caller are compiled regardless of that option:
kernel/sched/loadavg.c is pulled into build_utility.c, and do_sysinfo()
calls get_avenrun_tg() from a branch that is dead at runtime with
CONFIG_VE=n but still compiled. So CONFIG_CGROUP_SCHED=n does not
build:
kernel/sched/loadavg.c: error: invalid use of undefined type
'struct task_group'
Compile get_avenrun_tg() only when CONFIG_CGROUP_SCHED is enabled and
provide a stub otherwise. The stub returns -ENOSYS, the same error the
real implementation returns when there is no per-Container task group to
report. do_sysinfo() ignores the return value and info->loads is
already zeroed by memset(), so no caller has to change.
calc_load_ve() walks the very same task_group internals, so require
CONFIG_CGROUP_SCHED there as well instead of relying on CONFIG_VE
selecting it.
Fixes: c80eee4588ff ("ve/sched/loadavg: Calculate avenrun for Containers root cpu cgroups")
Feature: statistics: loadavg virtualization
https://virtuozzo.atlassian.net/browse/VSTOR-134732
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
include/linux/sched/loadavg.h | 11 ++++++++++-
kernel/sched/loadavg.c | 6 ++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/include/linux/sched/loadavg.h b/include/linux/sched/loadavg.h
index 771e753e4670..b97635dc47d4 100644
--- a/include/linux/sched/loadavg.h
+++ b/include/linux/sched/loadavg.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_SCHED_LOADAVG_H
#define _LINUX_SCHED_LOADAVG_H
+#include <linux/errno.h>
#include <linux/types.h>
/*
@@ -18,8 +19,16 @@ extern unsigned long avenrun[]; /* Load averages */
extern void get_avenrun(unsigned long *loads, unsigned long offset, int shift);
struct task_group;
+#ifdef CONFIG_CGROUP_SCHED
extern int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
unsigned long offset, int shift);
+#else
+static inline int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
+ unsigned long offset, int shift)
+{
+ return -ENOSYS;
+}
+#endif
#define FSHIFT 11 /* nr of bits of precision */
#define FIXED_1 (1<<FSHIFT) /* 1.0 as fixed-point */
@@ -51,7 +60,7 @@ extern unsigned long calc_load_n(unsigned long load, unsigned long exp,
extern bool calc_global_load(void);
-#ifdef CONFIG_VE
+#if defined(CONFIG_VE) && defined(CONFIG_CGROUP_SCHED)
extern void calc_load_ve(void);
#else
#define calc_load_ve() do { } while (0)
diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index bc0b6bcdae2d..2f66772750ea 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -78,6 +78,7 @@ void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
loads[2] = (avenrun[2] + offset) << shift;
}
+#ifdef CONFIG_CGROUP_SCHED
int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
unsigned long offset, int shift)
{
@@ -93,6 +94,7 @@ int get_avenrun_tg(struct task_group *tg, unsigned long *loads,
return 0;
}
+#endif /* CONFIG_CGROUP_SCHED */
long calc_load_fold_active(struct rq *this_rq, long adjust)
{
@@ -109,7 +111,7 @@ long calc_load_fold_active(struct rq *this_rq, long adjust)
return delta;
}
-#ifdef CONFIG_VE
+#if defined(CONFIG_VE) && defined(CONFIG_CGROUP_SCHED)
extern struct list_head ve_root_list;
extern raw_spinlock_t load_ve_lock;
@@ -166,7 +168,7 @@ void calc_load_ve(void)
kstat_glob.nr_unint_avg[2] = calc_load(kstat_glob.nr_unint_avg[2], EXP_15, nr_unint);
write_seqcount_end(&kstat_glob.nr_unint_avg_seq);
}
-#endif /* CONFIG_VE */
+#endif /* CONFIG_VE && CONFIG_CGROUP_SCHED */
/**
* fixed_power_int - compute: x^n, in O(log n) time
^ permalink raw reply [flat|nested] 68+ messages in thread
end of thread, other threads:[~2026-08-24 8:50 UTC | newest]
Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-21 16:36 [Devel] [PATCH vz10 00/32] Fix the VZ kernel build so that KUnit can run Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 01/32] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 02/32] sched/core: guard cpu_cgrp_subsys.depends_on with CONFIG_CGROUP_CPUACCT Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 03/32] sched: move MAX_CPU_RATE out of CONFIG_CFS_CPULIMIT Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 04/32] sched/cpuacct: guard ve_root_tg() with CONFIG_CFS_CPULIMIT Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 05/32] ve: source Kconfig.openvz from arch/um/Kconfig Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 06/32] ve: select CGROUP_PERF only if PERF_EVENTS Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 07/32] ve: add missing Kconfig selects for CONFIG_VE Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 08/32] mm/oom: build the berserker mode only with CONFIG_MEMCG Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 09/32] proc: build the per-Container oom_score limit lookup " Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 10/32] mm, proc: build the /proc/meminfo virtualization only with CONFIG_VE Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 11/32] mm/vmstat: build the /proc/vmstat " Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 12/32] mm/shmem: build the tmpfs size " Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:36 ` [Devel] [PATCH vz10 13/32] mm/memcg: keep mem_cgroup_per_node::nid available with CONFIG_MEMCG_V1=n Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 14/32] mm/memcontrol: build memory.numa_migrate only with CONFIG_NUMA Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 15/32] ms/percpu: introduce PERCPU_PTR() macro Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 16/32] ms/percpu: cast percpu pointer in PERCPU_PTR() via unsigned long Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 17/32] mm/memcontrol: add missing inline to the mem_cgroup_fill_meminfo() stub Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 18/32] block: guard the cbt_list initialization with CONFIG_BLK_DEV_CBT Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 19/32] ve: include asm/vdso.h on x86 only Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 20/32] ve: compile the per-Container VDSO copies only on x86 Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 21/32] ve: compile the CPUID override propagation " Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 22/32] ve: mark ve0.css with CSS_NO_REF Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:50 ` [Devel] [PATCH vz10 22/32] " Konstantin Khorenko
2026-08-24 8:50 ` Pavel Tikhomirov
2026-08-21 16:37 ` [Devel] [PATCH vz10 23/32] mm/memory: build the page fault latency accounting for x86 only Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 24/32] sched/core: include cgroup-internal.h only where it is used Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 25/32] kernfs: build the KERNFS_GET_NS ioctl only with CONFIG_NET Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 26/32] fs/fs_context: build the mount option formatting only with CONFIG_VE Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 27/32] net/unix: fix unix_stream_recvmsg() build with CONFIG_BPF_SYSCALL=n Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 28/32] redhat: rh_flags: make the !CONFIG_RHEL_DIFFERENCES stubs inline Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 29/32] ms/pcmcia: cistpl: Constify 'struct bin_attribute' Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 30/32] redhat: rh_waived: add a stub for CONFIG_RHEL_DIFFERENCES=n Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 31/32] ext4: select LIBCRC32C Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
2026-08-21 16:37 ` [Devel] [PATCH vz10 32/32] kunit: add the script dir to sys.path for PYTHONSAFEPATH compatibility Konstantin Khorenko
2026-08-21 16:42 ` [Devel] [PATCH RHEL10 COMMIT] " Konstantin Khorenko
[not found] <20260625220832.2201873-1-eva.kurchatova@virtuozzo.com>
2026-08-20 16:57 ` [Devel] [PATCH RHEL10 COMMIT] sched/loadavg: fix build with CONFIG_CGROUP_SCHED=n Konstantin Khorenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox