Skip to content

Commit c5c63b9

Browse files
Sebastian Andrzej Siewiorhtejun
authored andcommitted
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 <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: [email protected] Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 6ba34d3 commit c5c63b9

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

kernel/cgroup/cpuset.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ partition_and_rebuild_sched_domains(int ndoms_new, cpumask_var_t doms_new[],
979979
* 'cpus' is removed, then call this routine to rebuild the
980980
* scheduler's dynamic sched domains.
981981
*
982-
* Call with cpuset_mutex held. Takes get_online_cpus().
982+
* Call with cpuset_mutex held. Takes cpus_read_lock().
983983
*/
984984
static void rebuild_sched_domains_locked(void)
985985
{
@@ -1040,11 +1040,11 @@ static void rebuild_sched_domains_locked(void)
10401040

10411041
void rebuild_sched_domains(void)
10421042
{
1043-
get_online_cpus();
1043+
cpus_read_lock();
10441044
percpu_down_write(&cpuset_rwsem);
10451045
rebuild_sched_domains_locked();
10461046
percpu_up_write(&cpuset_rwsem);
1047-
put_online_cpus();
1047+
cpus_read_unlock();
10481048
}
10491049

10501050
/**
@@ -2288,7 +2288,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft,
22882288
cpuset_filetype_t type = cft->private;
22892289
int retval = 0;
22902290

2291-
get_online_cpus();
2291+
cpus_read_lock();
22922292
percpu_down_write(&cpuset_rwsem);
22932293
if (!is_cpuset_online(cs)) {
22942294
retval = -ENODEV;
@@ -2326,7 +2326,7 @@ static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft,
23262326
}
23272327
out_unlock:
23282328
percpu_up_write(&cpuset_rwsem);
2329-
put_online_cpus();
2329+
cpus_read_unlock();
23302330
return retval;
23312331
}
23322332

@@ -2337,7 +2337,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft,
23372337
cpuset_filetype_t type = cft->private;
23382338
int retval = -ENODEV;
23392339

2340-
get_online_cpus();
2340+
cpus_read_lock();
23412341
percpu_down_write(&cpuset_rwsem);
23422342
if (!is_cpuset_online(cs))
23432343
goto out_unlock;
@@ -2352,7 +2352,7 @@ static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft,
23522352
}
23532353
out_unlock:
23542354
percpu_up_write(&cpuset_rwsem);
2355-
put_online_cpus();
2355+
cpus_read_unlock();
23562356
return retval;
23572357
}
23582358

@@ -2391,7 +2391,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
23912391
kernfs_break_active_protection(of->kn);
23922392
flush_work(&cpuset_hotplug_work);
23932393

2394-
get_online_cpus();
2394+
cpus_read_lock();
23952395
percpu_down_write(&cpuset_rwsem);
23962396
if (!is_cpuset_online(cs))
23972397
goto out_unlock;
@@ -2417,7 +2417,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
24172417
free_cpuset(trialcs);
24182418
out_unlock:
24192419
percpu_up_write(&cpuset_rwsem);
2420-
put_online_cpus();
2420+
cpus_read_unlock();
24212421
kernfs_unbreak_active_protection(of->kn);
24222422
css_put(&cs->css);
24232423
flush_workqueue(cpuset_migrate_mm_wq);
@@ -2548,15 +2548,15 @@ static ssize_t sched_partition_write(struct kernfs_open_file *of, char *buf,
25482548
return -EINVAL;
25492549

25502550
css_get(&cs->css);
2551-
get_online_cpus();
2551+
cpus_read_lock();
25522552
percpu_down_write(&cpuset_rwsem);
25532553
if (!is_cpuset_online(cs))
25542554
goto out_unlock;
25552555

25562556
retval = update_prstate(cs, val);
25572557
out_unlock:
25582558
percpu_up_write(&cpuset_rwsem);
2559-
put_online_cpus();
2559+
cpus_read_unlock();
25602560
css_put(&cs->css);
25612561
return retval ?: nbytes;
25622562
}
@@ -2762,7 +2762,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
27622762
if (!parent)
27632763
return 0;
27642764

2765-
get_online_cpus();
2765+
cpus_read_lock();
27662766
percpu_down_write(&cpuset_rwsem);
27672767

27682768
set_bit(CS_ONLINE, &cs->flags);
@@ -2815,7 +2815,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
28152815
spin_unlock_irq(&callback_lock);
28162816
out_unlock:
28172817
percpu_up_write(&cpuset_rwsem);
2818-
put_online_cpus();
2818+
cpus_read_unlock();
28192819
return 0;
28202820
}
28212821

@@ -2834,7 +2834,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css)
28342834
{
28352835
struct cpuset *cs = css_cs(css);
28362836

2837-
get_online_cpus();
2837+
cpus_read_lock();
28382838
percpu_down_write(&cpuset_rwsem);
28392839

28402840
if (is_partition_root(cs))
@@ -2855,7 +2855,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css)
28552855
clear_bit(CS_ONLINE, &cs->flags);
28562856

28572857
percpu_up_write(&cpuset_rwsem);
2858-
put_online_cpus();
2858+
cpus_read_unlock();
28592859
}
28602860

28612861
static void cpuset_css_free(struct cgroup_subsys_state *css)

0 commit comments

Comments
 (0)