[PATCH]rcu classic: update qlen when cpu offline - Kernel

This is a discussion on [PATCH]rcu classic: update qlen when cpu offline - Kernel ; When callbacks are moved from offline cpu to this cpu, the qlen field of this rdp should be updated. Signed-off-by: Lai Jiangshan --- diff --git a/kernel/rcuclassic.c b/kernel/rcuclassic.c index f4ffbd0..42aead6 100644 --- a/kernel/rcuclassic.c +++ b/kernel/rcuclassic.c @@ -373,6 +373,10 @@ static void ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [PATCH]rcu classic: update qlen when cpu offline

  1. [PATCH]rcu classic: update qlen when cpu offline


    When callbacks are moved from offline cpu to this cpu,
    the qlen field of this rdp should be updated.

    Signed-off-by: Lai Jiangshan
    ---
    diff --git a/kernel/rcuclassic.c b/kernel/rcuclassic.c
    index f4ffbd0..42aead6 100644
    --- a/kernel/rcuclassic.c
    +++ b/kernel/rcuclassic.c
    @@ -373,6 +373,10 @@ static void __rcu_offline_cpu(struct rcu_data *this_rdp,
    rcu_move_batch(this_rdp, rdp->donelist, rdp->donetail);
    rcu_move_batch(this_rdp, rdp->curlist, rdp->curtail);
    rcu_move_batch(this_rdp, rdp->nxtlist, rdp->nxttail);
    +
    + local_irq_disable();
    + this_rdp->qlen += rdp->qlen;
    + local_irq_enable();
    }

    static void rcu_offline_cpu(int cpu)


    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: [PATCH]rcu classic: update qlen when cpu offline

    On Thu, Jun 26, 2008 at 10:06:43AM +0800, Lai Jiangshan wrote:
    >
    > When callbacks are moved from offline cpu to this cpu,
    > the qlen field of this rdp should be updated.


    Good catch!!!

    The effect of this bug would be for force_quiescent_state() to be invoked
    when it should not and vice versa -- wasting cycles in the first case
    and letting RCU callbacks remain piled up in the second case. The bug
    is thus "benign" in that it does not result in premature grace-period
    termination, but should of course be fixed nonetheless.

    Preemption is disabled by the caller's get_cpu_var(), so we are guaranteed
    to remain on the same CPU, as required. The local_irq_disable() is indeed
    needed, otherwise, an interrupt might invoke call_rcu() or call_rcu_bh(),
    which could cause that interrupt's increment of ->qlen to be lost.

    So this patch looks correct to me. Good job, Jiangshan!!!

    Ingo, would you be willing to add this patch to tip/core/rcu?

    Reviewed-by: Paul E. McKenney

    > Signed-off-by: Lai Jiangshan
    > ---
    > diff --git a/kernel/rcuclassic.c b/kernel/rcuclassic.c
    > index f4ffbd0..42aead6 100644
    > --- a/kernel/rcuclassic.c
    > +++ b/kernel/rcuclassic.c
    > @@ -373,6 +373,10 @@ static void __rcu_offline_cpu(struct rcu_data *this_rdp,
    > rcu_move_batch(this_rdp, rdp->donelist, rdp->donetail);
    > rcu_move_batch(this_rdp, rdp->curlist, rdp->curtail);
    > rcu_move_batch(this_rdp, rdp->nxtlist, rdp->nxttail);
    > +
    > + local_irq_disable();
    > + this_rdp->qlen += rdp->qlen;
    > + local_irq_enable();
    > }
    >
    > static void rcu_offline_cpu(int cpu)
    >
    >

    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  3. Re: [PATCH]rcu classic: update qlen when cpu offline


    * Paul E. McKenney wrote:

    > On Thu, Jun 26, 2008 at 10:06:43AM +0800, Lai Jiangshan wrote:
    > >
    > > When callbacks are moved from offline cpu to this cpu,
    > > the qlen field of this rdp should be updated.

    >
    > Good catch!!!
    >
    > The effect of this bug would be for force_quiescent_state() to be invoked
    > when it should not and vice versa -- wasting cycles in the first case
    > and letting RCU callbacks remain piled up in the second case. The bug
    > is thus "benign" in that it does not result in premature grace-period
    > termination, but should of course be fixed nonetheless.
    >
    > Preemption is disabled by the caller's get_cpu_var(), so we are guaranteed
    > to remain on the same CPU, as required. The local_irq_disable() is indeed
    > needed, otherwise, an interrupt might invoke call_rcu() or call_rcu_bh(),
    > which could cause that interrupt's increment of ->qlen to be lost.
    >
    > So this patch looks correct to me. Good job, Jiangshan!!!
    >
    > Ingo, would you be willing to add this patch to tip/core/rcu?
    >
    > Reviewed-by: Paul E. McKenney


    thanks, applied to tip/core/rcu. (sorry about the delay!)

    Ingo
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread