On 8/23/24 06:01, Chen Ridong wrote:
This patch introduces CONFIG_CPUSETS_V1 and guard cpuset-v1 code under
CONFIG_CPUSETS_V1. The default value of CONFIG_CPUSETS_V1 is N, so that
user who adopted v2 don't have 'pay' for cpuset v1.
Besides, to make code succinct, rename '__cpuset_memory_pressure_bump()'
to 'cpuset_memory_pressure_bump()', and expose it to the world, which
takes place of the old mocro 'cpuset_memory_pressure_bump'.
Signed-off-by: Chen Ridong <chenridong@xxxxxxxxxx>
---
include/linux/cpuset.h | 8 +-------
init/Kconfig | 13 +++++++++++++
kernel/cgroup/Makefile | 3 ++-
kernel/cgroup/cpuset-internal.h | 15 +++++++++++++++
kernel/cgroup/cpuset-v1.c | 10 ++++++----
kernel/cgroup/cpuset.c | 2 ++
6 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 2a6981eeebf8..f91f1f61f482 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -99,13 +99,7 @@ static inline bool cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
const struct task_struct *tsk2);
-#define cpuset_memory_pressure_bump() \
- do { \
- if (cpuset_memory_pressure_enabled) \
- __cpuset_memory_pressure_bump(); \
- } while (0)
-extern int cpuset_memory_pressure_enabled;
-extern void __cpuset_memory_pressure_bump(void);
+extern void cpuset_memory_pressure_bump(void);
extern void cpuset_task_status_allowed(struct seq_file *m,
struct task_struct *task);
As you are introducing a new CONFIG_CPUSET_V1 kconfig option, you can
use it to eliminate a useless function call if cgroup v1 isn't enabled.
Not just this function, all the v1 specific functions should have a
!CONFIG_CPUSET_V1 version that can be optimized out.
Cheers,
Longman