Re: [PATCH] rcu: Force quiescent states only for ongoing grace period

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
> On Wed, Nov 01, 2023 at 11:35:07AM +0800, Zqiang wrote:
> > Currently, when running the rcutorture testing, if the fqs_task
> > kthread was created, the periodic fqs operations will be performed,
> > regardless of whether the grace-period is ongoing. however, if there
> > is no ongoing grace-period, invoke the rcu_force_quiescent_state() has
> > no effect, because when the new grace-period starting, will clear all
> > flags int rcu_state.gp_flags in rcu_gp_init(). this commit therefore add
> > rcu_gp_in_progress() check in rcu_force_quiescent_state(), if there is
> > no ongoing grace-period, return directly.
> >
> > Signed-off-by: Zqiang <qiang.zhang1211@xxxxxxxxx>
>
> Nice optimization, but one question below.
>
>                                                 Thanx, Paul
>
> > ---
> >  kernel/rcu/tree.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > index aa4c808978b8..5b4279ef66da 100644
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -2338,6 +2338,8 @@ void rcu_force_quiescent_state(void)
> >       struct rcu_node *rnp;
> >       struct rcu_node *rnp_old = NULL;
> >
> > +     if (!rcu_gp_in_progress())
> > +             return;
>
> Suppose that the grace period that was in progress above ends right
> at this point in the code.  We will still do the useless grace
> forcing of quiescent states.  Which means that this code path
> does need to be tested.
>
> So, when you run rcutorture with this change, how often has the
> grace period ended before this function returns?  If that happens
> reasonably often, say more than once per minute or so, then this
> works nicely.  If not, we do need to do something to make sure
> that that code path gets tested.
>
> Thoughts?

Thanks for the suggestion, I will add some debug information to test again.

Thanks
Zqiang

>
> >       /* Funnel through hierarchy to reduce memory contention. */
> >       rnp = raw_cpu_read(rcu_data.mynode);
> >       for (; rnp != NULL; rnp = rnp->parent) {
> > --
> > 2.17.1
> >



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux