Commit 1abab1ba authored by Chen Ridong's avatar Chen Ridong Committed by Tejun Heo

cgroup/cpuset: guard cpuset-v1 code under CONFIG_CPUSETS_V1

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.
Signed-off-by: default avatarChen Ridong <chenridong@huawei.com>
Acked-by: default avatarWaiman Long <longman@redhat.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 381b53c3
...@@ -99,6 +99,7 @@ static inline bool cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) ...@@ -99,6 +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, extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
const struct task_struct *tsk2); const struct task_struct *tsk2);
#ifdef CONFIG_CPUSETS_V1
#define cpuset_memory_pressure_bump() \ #define cpuset_memory_pressure_bump() \
do { \ do { \
if (cpuset_memory_pressure_enabled) \ if (cpuset_memory_pressure_enabled) \
...@@ -106,6 +107,9 @@ extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, ...@@ -106,6 +107,9 @@ extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
} while (0) } while (0)
extern int cpuset_memory_pressure_enabled; extern int cpuset_memory_pressure_enabled;
extern void __cpuset_memory_pressure_bump(void); extern void __cpuset_memory_pressure_bump(void);
#else
static inline void cpuset_memory_pressure_bump(void) { }
#endif
extern void cpuset_task_status_allowed(struct seq_file *m, extern void cpuset_task_status_allowed(struct seq_file *m,
struct task_struct *task); struct task_struct *task);
......
...@@ -1143,6 +1143,19 @@ config CPUSETS ...@@ -1143,6 +1143,19 @@ config CPUSETS
Say N if unsure. Say N if unsure.
config CPUSETS_V1
bool "Legacy cgroup v1 cpusets controller"
depends on CPUSETS
default n
help
Legacy cgroup v1 cpusets controller which has been deprecated by
cgroup v2 implementation. The v1 is there for legacy applications
which haven't migrated to the new cgroup v2 interface yet. If you
do not have any such application then you are completely fine leaving
this option disabled.
Say N if unsure.
config PROC_PID_CPUSET config PROC_PID_CPUSET
bool "Include legacy /proc/<pid>/cpuset file" bool "Include legacy /proc/<pid>/cpuset file"
depends on CPUSETS depends on CPUSETS
......
...@@ -4,6 +4,7 @@ obj-y := cgroup.o rstat.o namespace.o cgroup-v1.o freezer.o ...@@ -4,6 +4,7 @@ obj-y := cgroup.o rstat.o namespace.o cgroup-v1.o freezer.o
obj-$(CONFIG_CGROUP_FREEZER) += legacy_freezer.o obj-$(CONFIG_CGROUP_FREEZER) += legacy_freezer.o
obj-$(CONFIG_CGROUP_PIDS) += pids.o obj-$(CONFIG_CGROUP_PIDS) += pids.o
obj-$(CONFIG_CGROUP_RDMA) += rdma.o obj-$(CONFIG_CGROUP_RDMA) += rdma.o
obj-$(CONFIG_CPUSETS) += cpuset.o cpuset-v1.o obj-$(CONFIG_CPUSETS) += cpuset.o
obj-$(CONFIG_CPUSETS_V1) += cpuset-v1.o
obj-$(CONFIG_CGROUP_MISC) += misc.o obj-$(CONFIG_CGROUP_MISC) += misc.o
obj-$(CONFIG_CGROUP_DEBUG) += debug.o obj-$(CONFIG_CGROUP_DEBUG) += debug.o
...@@ -279,6 +279,7 @@ int cpuset_common_seq_show(struct seq_file *sf, void *v); ...@@ -279,6 +279,7 @@ int cpuset_common_seq_show(struct seq_file *sf, void *v);
/* /*
* cpuset-v1.c * cpuset-v1.c
*/ */
#ifdef CONFIG_CPUSETS_V1
extern struct cftype cpuset1_files[]; extern struct cftype cpuset1_files[];
void fmeter_init(struct fmeter *fmp); void fmeter_init(struct fmeter *fmp);
void cpuset1_update_task_spread_flags(struct cpuset *cs, void cpuset1_update_task_spread_flags(struct cpuset *cs,
...@@ -288,5 +289,16 @@ void cpuset1_hotplug_update_tasks(struct cpuset *cs, ...@@ -288,5 +289,16 @@ void cpuset1_hotplug_update_tasks(struct cpuset *cs,
struct cpumask *new_cpus, nodemask_t *new_mems, struct cpumask *new_cpus, nodemask_t *new_mems,
bool cpus_updated, bool mems_updated); bool cpus_updated, bool mems_updated);
int cpuset1_validate_change(struct cpuset *cur, struct cpuset *trial); int cpuset1_validate_change(struct cpuset *cur, struct cpuset *trial);
#else
static inline void fmeter_init(struct fmeter *fmp) {}
static inline void cpuset1_update_task_spread_flags(struct cpuset *cs,
struct task_struct *tsk) {}
static inline void cpuset1_update_tasks_flags(struct cpuset *cs) {}
static inline void cpuset1_hotplug_update_tasks(struct cpuset *cs,
struct cpumask *new_cpus, nodemask_t *new_mems,
bool cpus_updated, bool mems_updated) {}
static inline int cpuset1_validate_change(struct cpuset *cur,
struct cpuset *trial) { return 0; }
#endif /* CONFIG_CPUSETS_V1 */
#endif /* __CPUSET_INTERNAL_H */ #endif /* __CPUSET_INTERNAL_H */
...@@ -3623,7 +3623,9 @@ struct cgroup_subsys cpuset_cgrp_subsys = { ...@@ -3623,7 +3623,9 @@ struct cgroup_subsys cpuset_cgrp_subsys = {
.can_fork = cpuset_can_fork, .can_fork = cpuset_can_fork,
.cancel_fork = cpuset_cancel_fork, .cancel_fork = cpuset_cancel_fork,
.fork = cpuset_fork, .fork = cpuset_fork,
#ifdef CONFIG_CPUSETS_V1
.legacy_cftypes = cpuset1_files, .legacy_cftypes = cpuset1_files,
#endif
.dfl_cftypes = dfl_files, .dfl_cftypes = dfl_files,
.early_init = true, .early_init = true,
.threaded = true, .threaded = true,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment