Skip to content

Commit 7625ecc

Browse files
Sebastian Andrzej SiewiorKAGA-KOKO
authored andcommitted
mm: 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. Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 252034e commit 7625ecc

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

mm/swap_slots.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ void disable_swap_slots_cache_lock(void)
7070
swap_slot_cache_enabled = false;
7171
if (swap_slot_cache_initialized) {
7272
/* serialize with cpu hotplug operations */
73-
get_online_cpus();
73+
cpus_read_lock();
7474
__drain_swap_slots_cache(SLOTS_CACHE|SLOTS_CACHE_RET);
75-
put_online_cpus();
75+
cpus_read_unlock();
7676
}
7777
}
7878

mm/vmstat.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ static void sum_vm_events(unsigned long *ret)
129129
*/
130130
void all_vm_events(unsigned long *ret)
131131
{
132-
get_online_cpus();
132+
cpus_read_lock();
133133
sum_vm_events(ret);
134-
put_online_cpus();
134+
cpus_read_unlock();
135135
}
136136
EXPORT_SYMBOL_GPL(all_vm_events);
137137

@@ -1948,7 +1948,7 @@ static void vmstat_shepherd(struct work_struct *w)
19481948
{
19491949
int cpu;
19501950

1951-
get_online_cpus();
1951+
cpus_read_lock();
19521952
/* Check processors whose vmstat worker threads have been disabled */
19531953
for_each_online_cpu(cpu) {
19541954
struct delayed_work *dw = &per_cpu(vmstat_work, cpu);
@@ -1958,7 +1958,7 @@ static void vmstat_shepherd(struct work_struct *w)
19581958

19591959
cond_resched();
19601960
}
1961-
put_online_cpus();
1961+
cpus_read_unlock();
19621962

19631963
schedule_delayed_work(&shepherd,
19641964
round_jiffies_relative(sysctl_stat_interval));
@@ -2037,9 +2037,9 @@ void __init init_mm_internals(void)
20372037
if (ret < 0)
20382038
pr_err("vmstat: failed to register 'online' hotplug state\n");
20392039

2040-
get_online_cpus();
2040+
cpus_read_lock();
20412041
init_cpu_node_state();
2042-
put_online_cpus();
2042+
cpus_read_unlock();
20432043

20442044
start_shepherd_timer();
20452045
#endif

0 commit comments

Comments
 (0)