Skip to content

Commit 70060b8

Browse files
Zqiang1211paulmckrcu
authored andcommitted
rcu: Shrink each possible cpu krcp
CPUs can go offline shortly after kfree_call_rcu() has been invoked, which can leave memory stranded until those CPUs come back online. This commit therefore drains the kcrp of each CPU, not just the ones that happen to be online. Acked-by: Joel Fernandes <joel@joelfernandes.org> Signed-off-by: Zqiang <qiang.zhang@windriver.com> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent 5392227 commit 70060b8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

kernel/rcu/tree.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3450,7 +3450,7 @@ kfree_rcu_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
34503450
unsigned long count = 0;
34513451

34523452
/* Snapshot count of all CPUs */
3453-
for_each_online_cpu(cpu) {
3453+
for_each_possible_cpu(cpu) {
34543454
struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu);
34553455

34563456
count += READ_ONCE(krcp->count);
@@ -3465,7 +3465,7 @@ kfree_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
34653465
int cpu, freed = 0;
34663466
unsigned long flags;
34673467

3468-
for_each_online_cpu(cpu) {
3468+
for_each_possible_cpu(cpu) {
34693469
int count;
34703470
struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu);
34713471

@@ -3498,7 +3498,7 @@ void __init kfree_rcu_scheduler_running(void)
34983498
int cpu;
34993499
unsigned long flags;
35003500

3501-
for_each_online_cpu(cpu) {
3501+
for_each_possible_cpu(cpu) {
35023502
struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu);
35033503

35043504
raw_spin_lock_irqsave(&krcp->lock, flags);

0 commit comments

Comments
 (0)