Commit c5c63b9a authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Tejun Heo

cgroup: Replace deprecated CPU-hotplug functions.

The functions get_online_cpus() and put_online_cpus() have been
deprecated during the CPU hotplug rework. They map directly to
cpus_read_lock() and cpus_read_unlock().

Replace deprecated CPU-hotplug functions with the official version.
The behavior remains unchanged.

Cc: Zefan Li <lizefan.x@bytedance.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: cgroups@vger.kernel.org
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 6ba34d3c
...@@ -979,7 +979,7 @@ partition_and_rebuild_sched_domains(int ndoms_new, cpumask_var_t doms_new[], ...@@ -979,7 +979,7 @@ partition_and_rebuild_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
* 'cpus' is removed, then call this routine to rebuild the * 'cpus' is removed, then call this routine to rebuild the
* scheduler's dynamic sched domains. * scheduler's dynamic sched domains.
* *
* Call with cpuset_mutex held. Takes get_online_cpus(). * Call with cpuset_mutex held. Takes cpus_read_lock().
*/ */
static void rebuild_sched_domains_locked(void) static void rebuild_sched_domains_locked(void)
{ {
...@@ -1040,11 +1040,11 @@ static void rebuild_sched_domains_locked(void) ...@@ -1040,11 +1040,11 @@ static void rebuild_sched_domains_locked(void)
void rebuild_sched_domains(void) void rebuild_sched_domains(void)
{ {
get_online_cpus(); cpus_read_lock();
percpu_down_write(&cpuset_rwsem); percpu_down_write(&cpuset_rwsem);
rebuild_sched_domains_locked(); rebuild_sched_domains_locked();
percpu_up_write(&cpuset_rwsem); percpu_up_write(&cpuset_rwsem);
put_online_cpus(); cpus_read_unlock();
} }
/** /**
...@@ -2288,7 +2288,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, ...@@ -2288,7 +2288,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft,
cpuset_filetype_t type = cft->private; cpuset_filetype_t type = cft->private;
int retval = 0; int retval = 0;
get_online_cpus(); cpus_read_lock();
percpu_down_write(&cpuset_rwsem); percpu_down_write(&cpuset_rwsem);
if (!is_cpuset_online(cs)) { if (!is_cpuset_online(cs)) {
retval = -ENODEV; retval = -ENODEV;
...@@ -2326,7 +2326,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, ...@@ -2326,7 +2326,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft,
} }
out_unlock: out_unlock:
percpu_up_write(&cpuset_rwsem); percpu_up_write(&cpuset_rwsem);
put_online_cpus(); cpus_read_unlock();
return retval; return retval;
} }
...@@ -2337,7 +2337,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft, ...@@ -2337,7 +2337,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft,
cpuset_filetype_t type = cft->private; cpuset_filetype_t type = cft->private;
int retval = -ENODEV; int retval = -ENODEV;
get_online_cpus(); cpus_read_lock();
percpu_down_write(&cpuset_rwsem); percpu_down_write(&cpuset_rwsem);
if (!is_cpuset_online(cs)) if (!is_cpuset_online(cs))
goto out_unlock; goto out_unlock;
...@@ -2352,7 +2352,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft, ...@@ -2352,7 +2352,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft,
} }
out_unlock: out_unlock:
percpu_up_write(&cpuset_rwsem); percpu_up_write(&cpuset_rwsem);
put_online_cpus(); cpus_read_unlock();
return retval; return retval;
} }
...@@ -2391,7 +2391,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of, ...@@ -2391,7 +2391,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
kernfs_break_active_protection(of->kn); kernfs_break_active_protection(of->kn);
flush_work(&cpuset_hotplug_work); flush_work(&cpuset_hotplug_work);
get_online_cpus(); cpus_read_lock();
percpu_down_write(&cpuset_rwsem); percpu_down_write(&cpuset_rwsem);
if (!is_cpuset_online(cs)) if (!is_cpuset_online(cs))
goto out_unlock; goto out_unlock;
...@@ -2417,7 +2417,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of, ...@@ -2417,7 +2417,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
free_cpuset(trialcs); free_cpuset(trialcs);
out_unlock: out_unlock:
percpu_up_write(&cpuset_rwsem); percpu_up_write(&cpuset_rwsem);
put_online_cpus(); cpus_read_unlock();
kernfs_unbreak_active_protection(of->kn); kernfs_unbreak_active_protection(of->kn);
css_put(&cs->css); css_put(&cs->css);
flush_workqueue(cpuset_migrate_mm_wq); flush_workqueue(cpuset_migrate_mm_wq);
...@@ -2548,7 +2548,7 @@ static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf, ...@@ -2548,7 +2548,7 @@ static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf,
return -EINVAL; return -EINVAL;
css_get(&cs->css); css_get(&cs->css);
get_online_cpus(); cpus_read_lock();
percpu_down_write(&cpuset_rwsem); percpu_down_write(&cpuset_rwsem);
if (!is_cpuset_online(cs)) if (!is_cpuset_online(cs))
goto out_unlock; goto out_unlock;
...@@ -2556,7 +2556,7 @@ static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf, ...@@ -2556,7 +2556,7 @@ static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf,
retval = update_prstate(cs, val); retval = update_prstate(cs, val);
out_unlock: out_unlock:
percpu_up_write(&cpuset_rwsem); percpu_up_write(&cpuset_rwsem);
put_online_cpus(); cpus_read_unlock();
css_put(&cs->css); css_put(&cs->css);
return retval ?: nbytes; return retval ?: nbytes;
} }
...@@ -2762,7 +2762,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) ...@@ -2762,7 +2762,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
if (!parent) if (!parent)
return 0; return 0;
get_online_cpus(); cpus_read_lock();
percpu_down_write(&cpuset_rwsem); percpu_down_write(&cpuset_rwsem);
set_bit(CS_ONLINE, &cs->flags); set_bit(CS_ONLINE, &cs->flags);
...@@ -2815,7 +2815,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css) ...@@ -2815,7 +2815,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
spin_unlock_irq(&callback_lock); spin_unlock_irq(&callback_lock);
out_unlock: out_unlock:
percpu_up_write(&cpuset_rwsem); percpu_up_write(&cpuset_rwsem);
put_online_cpus(); cpus_read_unlock();
return 0; return 0;
} }
...@@ -2834,7 +2834,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css) ...@@ -2834,7 +2834,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css)
{ {
struct cpuset *cs = css_cs(css); struct cpuset *cs = css_cs(css);
get_online_cpus(); cpus_read_lock();
percpu_down_write(&cpuset_rwsem); percpu_down_write(&cpuset_rwsem);
if (is_partition_root(cs)) if (is_partition_root(cs))
...@@ -2855,7 +2855,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css) ...@@ -2855,7 +2855,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css)
clear_bit(CS_ONLINE, &cs->flags); clear_bit(CS_ONLINE, &cs->flags);
percpu_up_write(&cpuset_rwsem); percpu_up_write(&cpuset_rwsem);
put_online_cpus(); cpus_read_unlock();
} }
static void cpuset_css_free(struct cgroup_subsys_state *css) static void cpuset_css_free(struct cgroup_subsys_state *css)
......
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