Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cpuset: add cpuset1_init helper for v1 initialization

This patch introduces the cpuset1_init helper in cpuset_v1.c to initialize
v1-specific fields, including the fmeter and relax_domain_level members.

The relax_domain_level related code will be moved to cpuset_v1.c in a
subsequent patch. After this move, v1-specific members will only be
visible when CONFIG_CPUSETS_V1=y.

Signed-off-by: Chen Ridong <chenridong@huawei.com>
Reviewed-by: Waiman Long <longman@redhat.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Chen Ridong and committed by
Tejun Heo
4ef42c64 56805c1b

+14 -7
+6 -4
kernel/cgroup/cpuset-internal.h
··· 144 144 */ 145 145 nodemask_t old_mems_allowed; 146 146 147 - struct fmeter fmeter; /* memory_pressure filter */ 148 - 149 147 /* 150 148 * Tasks are being attached to this cpuset. Used to prevent 151 149 * zeroing cpus/mems_allowed between ->can_attach() and ->attach(). ··· 179 181 180 182 /* Used to merge intersecting subsets for generate_sched_domains */ 181 183 struct uf_node node; 184 + 185 + #ifdef CONFIG_CPUSETS_V1 186 + struct fmeter fmeter; /* memory_pressure filter */ 187 + #endif 182 188 }; 183 189 184 190 static inline struct cpuset *css_cs(struct cgroup_subsys_state *css) ··· 287 285 */ 288 286 #ifdef CONFIG_CPUSETS_V1 289 287 extern struct cftype cpuset1_files[]; 290 - void fmeter_init(struct fmeter *fmp); 291 288 void cpuset1_update_task_spread_flags(struct cpuset *cs, 292 289 struct task_struct *tsk); 293 290 void cpuset1_update_tasks_flags(struct cpuset *cs); ··· 294 293 struct cpumask *new_cpus, nodemask_t *new_mems, 295 294 bool cpus_updated, bool mems_updated); 296 295 int cpuset1_validate_change(struct cpuset *cur, struct cpuset *trial); 296 + void cpuset1_init(struct cpuset *cs); 297 297 void cpuset1_online_css(struct cgroup_subsys_state *css); 298 298 #else 299 - static inline void fmeter_init(struct fmeter *fmp) {} 300 299 static inline void cpuset1_update_task_spread_flags(struct cpuset *cs, 301 300 struct task_struct *tsk) {} 302 301 static inline void cpuset1_update_tasks_flags(struct cpuset *cs) {} ··· 305 304 bool cpus_updated, bool mems_updated) {} 306 305 static inline int cpuset1_validate_change(struct cpuset *cur, 307 306 struct cpuset *trial) { return 0; } 307 + static inline void cpuset1_init(struct cpuset *cs) {} 308 308 static inline void cpuset1_online_css(struct cgroup_subsys_state *css) {} 309 309 #endif /* CONFIG_CPUSETS_V1 */ 310 310
+6 -1
kernel/cgroup/cpuset-v1.c
··· 62 62 #define FM_SCALE 1000 /* faux fixed point scale */ 63 63 64 64 /* Initialize a frequency meter */ 65 - void fmeter_init(struct fmeter *fmp) 65 + static void fmeter_init(struct fmeter *fmp) 66 66 { 67 67 fmp->cnt = 0; 68 68 fmp->val = 0; ··· 497 497 out_unlock: 498 498 cpuset_full_unlock(); 499 499 return retval; 500 + } 501 + 502 + void cpuset1_init(struct cpuset *cs) 503 + { 504 + fmeter_init(&cs->fmeter); 500 505 } 501 506 502 507 void cpuset1_online_css(struct cgroup_subsys_state *css)
+2 -2
kernel/cgroup/cpuset.c
··· 3602 3602 return ERR_PTR(-ENOMEM); 3603 3603 3604 3604 __set_bit(CS_SCHED_LOAD_BALANCE, &cs->flags); 3605 - fmeter_init(&cs->fmeter); 3605 + cpuset1_init(cs); 3606 3606 cs->relax_domain_level = -1; 3607 3607 3608 3608 /* Set CS_MEMORY_MIGRATE for default hierarchy */ ··· 3836 3836 cpumask_setall(top_cpuset.exclusive_cpus); 3837 3837 nodes_setall(top_cpuset.effective_mems); 3838 3838 3839 - fmeter_init(&top_cpuset.fmeter); 3839 + cpuset1_init(&top_cpuset); 3840 3840 3841 3841 BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL)); 3842 3842