2019-08-17 04:23:50

by Joel Fernandes

[permalink] [raw]
Subject: [PATCH -rcu/dev] Please squash: fixup! rcu/tree: Add basic support for kfree_rcu() batching

xchg() on a bool is causing issues on riscv and arm32. Please squash
this into the -rcu dev branch to resolve the issue.

Please squash this fix.

Fixes: -rcu dev commit 3cbd3aa7d9c7bdf ("rcu/tree: Add basic support for kfree_rcu() batching")

Signed-off-by: Joel Fernandes (Google) <[email protected]>
---
kernel/rcu/tree.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 4f7c3096d786..33192a58b39a 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2717,7 +2717,7 @@ struct kfree_rcu_cpu {
* is busy, ->head just continues to grow and we retry flushing later.
*/
struct delayed_work monitor_work;
- bool monitor_todo; /* Is a delayed work pending execution? */
+ int monitor_todo; /* Is a delayed work pending execution? */
};

static DEFINE_PER_CPU(struct kfree_rcu_cpu, krc);
@@ -2790,7 +2790,7 @@ static inline void kfree_rcu_drain_unlock(struct kfree_rcu_cpu *krcp,
/* Previous batch that was queued to RCU did not get free yet, let us
* try again soon.
*/
- if (!xchg(&krcp->monitor_todo, true))
+ if (!xchg(&krcp->monitor_todo, 1))
schedule_delayed_work(&krcp->monitor_work, KFREE_DRAIN_JIFFIES);
spin_unlock_irqrestore(&krcp->lock, flags);
}
@@ -2806,7 +2806,7 @@ static void kfree_rcu_monitor(struct work_struct *work)
monitor_work.work);

spin_lock_irqsave(&krcp->lock, flags);
- if (xchg(&krcp->monitor_todo, false))
+ if (xchg(&krcp->monitor_todo, 0))
kfree_rcu_drain_unlock(krcp, flags);
else
spin_unlock_irqrestore(&krcp->lock, flags);
@@ -2858,7 +2858,7 @@ void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func)
krcp->head = head;

/* Schedule monitor for timely drain after KFREE_DRAIN_JIFFIES. */
- if (!xchg(&krcp->monitor_todo, true))
+ if (!xchg(&krcp->monitor_todo, 1))
schedule_delayed_work(&krcp->monitor_work, KFREE_DRAIN_JIFFIES);

spin_unlock(&krcp->lock);
--
2.23.0.rc1.153.gdeed80330f-goog


2019-08-17 04:39:58

by Paul Walmsley

[permalink] [raw]
Subject: Re: [PATCH -rcu/dev] Please squash: fixup! rcu/tree: Add basic support for kfree_rcu() batching

On Sat, 17 Aug 2019, Joel Fernandes (Google) wrote:

> xchg() on a bool is causing issues on riscv and arm32.

Indeed, it seems best not to use xchg() on any type that's not 32 bits
long or that's not the CPU's native word size. Probably we should update
the documentation.

> Please squash this into the -rcu dev branch to resolve the issue.
>
> Please squash this fix.
>
> Fixes: -rcu dev commit 3cbd3aa7d9c7bdf ("rcu/tree: Add basic support for kfree_rcu() batching")
>
> Signed-off-by: Joel Fernandes (Google) <[email protected]>

Link: https://lore.kernel.org/lkml/[email protected]/T/#me9956f66cb611b95d26ae92700e1d901f46e8c59
Reviewed-by: Paul Walmsley <[email protected]>


- Paul

2019-08-17 04:44:29

by Joel Fernandes

[permalink] [raw]
Subject: Re: [PATCH -rcu/dev] Please squash: fixup! rcu/tree: Add basic support for kfree_rcu() batching

On Fri, Aug 16, 2019 at 09:38:54PM -0700, Paul Walmsley wrote:
> On Sat, 17 Aug 2019, Joel Fernandes (Google) wrote:
>
> > xchg() on a bool is causing issues on riscv and arm32.
>
> Indeed, it seems best not to use xchg() on any type that's not 32 bits
> long or that's not the CPU's native word size. Probably we should update
> the documentation.

I would endorse any such documentation effort ;-)

> > Please squash this into the -rcu dev branch to resolve the issue.
> >
> > Please squash this fix.
> >
> > Fixes: -rcu dev commit 3cbd3aa7d9c7bdf ("rcu/tree: Add basic support for kfree_rcu() batching")
> >
> > Signed-off-by: Joel Fernandes (Google) <[email protected]>
>
> Link: https://lore.kernel.org/lkml/[email protected]/T/#me9956f66cb611b95d26ae92700e1d901f46e8c59
> Reviewed-by: Paul Walmsley <[email protected]>

Thanks Paul! And nice to meet you again after many years ;-) Glad to see you
working on riscv.

thanks,

- Joel

2019-08-17 21:43:39

by Paul E. McKenney

[permalink] [raw]
Subject: Re: [PATCH -rcu/dev] Please squash: fixup! rcu/tree: Add basic support for kfree_rcu() batching

On Sat, Aug 17, 2019 at 12:43:08AM -0400, Joel Fernandes wrote:
> On Fri, Aug 16, 2019 at 09:38:54PM -0700, Paul Walmsley wrote:
> > On Sat, 17 Aug 2019, Joel Fernandes (Google) wrote:
> >
> > > xchg() on a bool is causing issues on riscv and arm32.
> >
> > Indeed, it seems best not to use xchg() on any type that's not 32 bits
> > long or that's not the CPU's native word size. Probably we should update
> > the documentation.
>
> I would endorse any such documentation effort ;-)
>
> > > Please squash this into the -rcu dev branch to resolve the issue.
> > >
> > > Please squash this fix.

Done, please see below for updated version.

> > > Fixes: -rcu dev commit 3cbd3aa7d9c7bdf ("rcu/tree: Add basic support for kfree_rcu() batching")
> > >
> > > Signed-off-by: Joel Fernandes (Google) <[email protected]>
> >
> > Link: https://lore.kernel.org/lkml/[email protected]/T/#me9956f66cb611b95d26ae92700e1d901f46e8c59
> > Reviewed-by: Paul Walmsley <[email protected]>

I added the link, thank you Paul! If you meant the Reviewed-by to apply
to the entire kfree_rcu() patch, I will of course be very happy to apply
that as well.

> Thanks Paul! And nice to meet you again after many years ;-) Glad to see you
> working on riscv.

What Joel said! ;-)

Thanx, Paul