[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200814185124.GA2113@pc636>
Date: Fri, 14 Aug 2020 20:51:24 +0200
From: Uladzislau Rezki <urezki@...il.com>
To: qiang.zhang@...driver.com, Joel Fernandes <joel@...lfernandes.org>
Cc: paulmck@...nel.org, josh@...htriplett.org, rostedt@...dmis.org,
mathieu.desnoyers@...icios.com, jiangshanlai@...il.com,
joel@...lfernandes.org, rcu@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rcu: shrink each possible cpu krcp
> From: Zqiang <qiang.zhang@...driver.com>
>
> Due to cpu hotplug. some cpu may be offline after call "kfree_call_rcu"
> func, if the shrinker is triggered at this time, we should drain each
> possible cpu "krcp".
>
> Signed-off-by: Zqiang <qiang.zhang@...driver.com>
> ---
> kernel/rcu/tree.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 8ce77d9ac716..619ccbb3fe4b 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -3443,7 +3443,7 @@ kfree_rcu_shrink_count(struct shrinker *shrink, struct shrink_control *sc)
> unsigned long count = 0;
>
> /* Snapshot count of all CPUs */
> - for_each_online_cpu(cpu) {
> + for_each_possible_cpu(cpu) {
> struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu);
>
> count += READ_ONCE(krcp->count);
> @@ -3458,7 +3458,7 @@ kfree_rcu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
> int cpu, freed = 0;
> unsigned long flags;
>
> - for_each_online_cpu(cpu) {
> + for_each_possible_cpu(cpu) {
> int count;
> struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu);
>
> @@ -3491,7 +3491,7 @@ void __init kfree_rcu_scheduler_running(void)
> int cpu;
> unsigned long flags;
>
> - for_each_online_cpu(cpu) {
> + for_each_possible_cpu(cpu) {
> struct kfree_rcu_cpu *krcp = per_cpu_ptr(&krc, cpu);
>
> raw_spin_lock_irqsave(&krcp->lock, flags);
>
I agree that it can happen.
Joel, what is your view?
Thanks!
--
Vlad Rezki
Powered by blists - more mailing lists