mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
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>
This commit is contained in:
parent
56805c1bb1
commit
4ef42c645f
|
|
@ -144,8 +144,6 @@ struct cpuset {
|
|||
*/
|
||||
nodemask_t old_mems_allowed;
|
||||
|
||||
struct fmeter fmeter; /* memory_pressure filter */
|
||||
|
||||
/*
|
||||
* Tasks are being attached to this cpuset. Used to prevent
|
||||
* zeroing cpus/mems_allowed between ->can_attach() and ->attach().
|
||||
|
|
@ -181,6 +179,10 @@ struct cpuset {
|
|||
|
||||
/* Used to merge intersecting subsets for generate_sched_domains */
|
||||
struct uf_node node;
|
||||
|
||||
#ifdef CONFIG_CPUSETS_V1
|
||||
struct fmeter fmeter; /* memory_pressure filter */
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline struct cpuset *css_cs(struct cgroup_subsys_state *css)
|
||||
|
|
@ -285,7 +287,6 @@ void cpuset_full_unlock(void);
|
|||
*/
|
||||
#ifdef CONFIG_CPUSETS_V1
|
||||
extern struct cftype cpuset1_files[];
|
||||
void fmeter_init(struct fmeter *fmp);
|
||||
void cpuset1_update_task_spread_flags(struct cpuset *cs,
|
||||
struct task_struct *tsk);
|
||||
void cpuset1_update_tasks_flags(struct cpuset *cs);
|
||||
|
|
@ -293,9 +294,9 @@ void cpuset1_hotplug_update_tasks(struct cpuset *cs,
|
|||
struct cpumask *new_cpus, nodemask_t *new_mems,
|
||||
bool cpus_updated, bool mems_updated);
|
||||
int cpuset1_validate_change(struct cpuset *cur, struct cpuset *trial);
|
||||
void cpuset1_init(struct cpuset *cs);
|
||||
void cpuset1_online_css(struct cgroup_subsys_state *css);
|
||||
#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) {}
|
||||
|
|
@ -304,6 +305,7 @@ static inline void cpuset1_hotplug_update_tasks(struct cpuset *cs,
|
|||
bool cpus_updated, bool mems_updated) {}
|
||||
static inline int cpuset1_validate_change(struct cpuset *cur,
|
||||
struct cpuset *trial) { return 0; }
|
||||
static inline void cpuset1_init(struct cpuset *cs) {}
|
||||
static inline void cpuset1_online_css(struct cgroup_subsys_state *css) {}
|
||||
#endif /* CONFIG_CPUSETS_V1 */
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ struct cpuset_remove_tasks_struct {
|
|||
#define FM_SCALE 1000 /* faux fixed point scale */
|
||||
|
||||
/* Initialize a frequency meter */
|
||||
void fmeter_init(struct fmeter *fmp)
|
||||
static void fmeter_init(struct fmeter *fmp)
|
||||
{
|
||||
fmp->cnt = 0;
|
||||
fmp->val = 0;
|
||||
|
|
@ -499,6 +499,11 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft,
|
|||
return retval;
|
||||
}
|
||||
|
||||
void cpuset1_init(struct cpuset *cs)
|
||||
{
|
||||
fmeter_init(&cs->fmeter);
|
||||
}
|
||||
|
||||
void cpuset1_online_css(struct cgroup_subsys_state *css)
|
||||
{
|
||||
struct cpuset *tmp_cs;
|
||||
|
|
|
|||
|
|
@ -3602,7 +3602,7 @@ cpuset_css_alloc(struct cgroup_subsys_state *parent_css)
|
|||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
__set_bit(CS_SCHED_LOAD_BALANCE, &cs->flags);
|
||||
fmeter_init(&cs->fmeter);
|
||||
cpuset1_init(cs);
|
||||
cs->relax_domain_level = -1;
|
||||
|
||||
/* Set CS_MEMORY_MIGRATE for default hierarchy */
|
||||
|
|
@ -3836,7 +3836,7 @@ int __init cpuset_init(void)
|
|||
cpumask_setall(top_cpuset.exclusive_cpus);
|
||||
nodes_setall(top_cpuset.effective_mems);
|
||||
|
||||
fmeter_init(&top_cpuset.fmeter);
|
||||
cpuset1_init(&top_cpuset);
|
||||
|
||||
BUG_ON(!alloc_cpumask_var(&cpus_attach, GFP_KERNEL));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user