Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1542801

Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp()

From Colin Ian King <colin.king@canonical.com>
Newsgroups linux.kernel
Subject Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp()
Date 2016-12-15 16:00 +0100
Message-ID <sOFFM-72d-15@gated-at.bofh.it> (permalink)
References <sOuhj-8sr-5@gated-at.bofh.it> <sOuhj-8sr-9@gated-at.bofh.it> <sOD1g-5AK-23@gated-at.bofh.it> <sOFw6-6Xv-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 15/12/16 14:42, Boqun Feng wrote:
> On Thu, Dec 15, 2016 at 12:04:59PM +0000, Mark Rutland wrote:
>> On Thu, Dec 15, 2016 at 10:42:03AM +0800, Boqun Feng wrote:
>>> ->qsmask of an RCU leaf node is usually more sparse than the
>>> corresponding cpu_possible_mask. So replace the
>>> for_each_leaf_node_possible_cpu() in force_qs_rnp() with
>>> for_each_leaf_node_cpu() to save several checks.
>>>
>>> [Note we need to use "1UL << bit" instead of "1 << bit" to generate the
>>> corresponding mask for a bit because @mask is unsigned long, this was
>>> spotted by Colin Ian King <colin.king@canonical.com> and CoverityScan in
>>> a previous version of this patch.]
>>
>> Nit: This note can go now that we use leaf_node_cpu_bit(). ;)
>>
> 
> I kinda keep this here for honoring the effort of finding out this bug
> from Colin, but yes, it's no longer needed here for the current code.

Yep, remove it.

> 
> Regards,
> Boqun
> 
>> Thanks,
>> Mark.
>>
>>> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
>>> ---
>>>  kernel/rcu/tree.c | 12 +++++-------
>>>  1 file changed, 5 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
>>> index 4e5b81c843de..1ef13e63bc95 100644
>>> --- a/kernel/rcu/tree.c
>>> +++ b/kernel/rcu/tree.c
>>> @@ -3046,13 +3046,11 @@ static void force_qs_rnp(struct rcu_state *rsp,
>>>  				continue;
>>>  			}
>>>  		}
>>> -		for_each_leaf_node_possible_cpu(rnp, cpu) {
>>> -			unsigned long bit = leaf_node_cpu_bit(rnp, cpu);
>>> -			if ((rnp->qsmask & bit) != 0) {
>>> -				if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj))
>>> -					mask |= bit;
>>> -			}
>>> -		}
>>> +
>>> +		for_each_leaf_node_cpu(rnp, rnp->qsmask, cpu)
>>> +			if (f(per_cpu_ptr(rsp->rda, cpu), isidle, maxj))
>>> +				mask |= leaf_node_cpu_bit(rnp, cpu);
>>> +
>>>  		if (mask != 0) {
>>>  			/* Idle/offline CPUs, report (releases rnp->lock. */
>>>  			rcu_report_qs_rnp(mask, rsp, rnp, rnp->gpnum, flags);
>>> -- 
>>> 2.10.2
>>>


Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v2 0/5] rcu: Introduce for_each_leaf_node_cpu() Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 03:50 +0100
  [RFC v2 1/5] rcu: Introduce for_each_leaf_node_cpu() Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 03:50 +0100
    Re: [RFC v2 1/5] rcu: Introduce for_each_leaf_node_cpu() Mark Rutland <mark.rutland@arm.com> - 2016-12-15 12:50 +0100
      Re: [RFC v2 1/5] rcu: Introduce for_each_leaf_node_cpu() Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 15:40 +0100
        Re: [RFC v2 1/5] rcu: Introduce for_each_leaf_node_cpu() Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 16:20 +0100
        Re: [RFC v2 1/5] rcu: Introduce for_each_leaf_node_cpu() Mark Rutland <mark.rutland@arm.com> - 2016-12-15 16:20 +0100
    [RFC v2.1 1/5] rcu: Introduce for_each_leaf_node_cpu() Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 16:30 +0100
      Re: [RFC v2.1 1/5] rcu: Introduce for_each_leaf_node_cpu() Mark Rutland <mark.rutland@arm.com> - 2016-12-15 16:40 +0100
  [RFC v2 2/5] rcu: Use for_each_leaf_node_cpu() in RCU stall checking Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 03:50 +0100
  [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 03:50 +0100
    Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Mark Rutland <mark.rutland@arm.com> - 2016-12-15 13:10 +0100
      Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 15:50 +0100
        Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Colin Ian King <colin.king@canonical.com> - 2016-12-15 16:00 +0100
          Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Boqun Feng <boqun.feng@gmail.com> - 2016-12-19 16:20 +0100
            Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-12-20 06:10 +0100
              Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Boqun Feng <boqun.feng@gmail.com> - 2016-12-20 07:00 +0100
                Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Boqun Feng <boqun.feng@gmail.com> - 2016-12-20 09:20 +0100
                Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-12-20 16:40 +0100
                Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-12-20 16:30 +0100
                Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Boqun Feng <boqun.feng@gmail.com> - 2016-12-21 03:40 +0100
                Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-12-21 04:50 +0100
                Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Boqun Feng <boqun.feng@gmail.com> - 2016-12-21 05:20 +0100
                Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-12-21 17:50 +0100
                Re: [RFC v2 4/5] rcu: Use for_each_leaf_node_cpu() in force_qs_rnp() Boqun Feng <boqun.feng@gmail.com> - 2016-12-22 02:10 +0100
  [RFC v2 5/5] rcu: Use for_each_leaf_node_cpu() in online CPU iteration Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 03:50 +0100
  [RFC v2 3/5] rcu: Use for_each_leaf_node_cpu() in ->expmask iteration Boqun Feng <boqun.feng@gmail.com> - 2016-12-15 03:50 +0100

csiph-web