[Devel] [PATCH vz10 06/32] ve: select CGROUP_PERF only if PERF_EVENTS

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 21 19:36:52 MSK 2026


From: Eva Kurchatova <eva.kurchatova at 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 at virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko at 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



More information about the Devel mailing list