Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3865887imm; Sun, 13 May 2018 22:06:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoDY4nQ4VjYApKZN/NZ164ipVh9VY/1rjzuCIhEt4BJkf9uc+3vfSXfn0du6cIWfVHhz30s X-Received: by 2002:a63:ae42:: with SMTP id e2-v6mr3058841pgp.424.1526274371210; Sun, 13 May 2018 22:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526274371; cv=none; d=google.com; s=arc-20160816; b=02rXveTYSiTWCINN1C7v4RfAjaka5O1eK4ICK1fvxRhR/3k99f1bx7XAhk168HELjG gXrrwuFVI9Q3zd4kmn5fPtTusKESknkpbE1uFAU1r9HcXpNnrd/G5WR3I9OydQve/JvF I6WK1g7UJlb5i9sjCvjNE5zBu8iSwTB7B/206GVOh8QpD9+mbJHLCpMdFHqSwWMTOKue iYgeoj8qOzbCdoH+8mS+jJIwR7NDh+nCcnv0Dei3fK0BhT51X4GJWKuFZmPGZ7ng38Bh WNUqmj3pZhAZCTjfoUA883k0nbypQ3lPTpfNRMJWcz1wLq9xJSLFNJ7x+C/Y24g2rJku Kvsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=2e6ibhxwD3KYNe3haninlnlElMvy2QsnCKWk4oLKW+w=; b=wz4QKUeQSPtt27qepc1S+/0AUxh7V8HUIumZNIj3Cy57/zGph+bNAbZ67PrJerZ1fR gYzIL7M6DXitUgRA8Rn89MtPUATQ7iXj/9jreauf/v7+xFcn2334JDHGJ1KnWX+FhgK8 Dndo10Il1C9jGB394Z8XguvELXmTrxsd3xyhA7IgzKdYxUq+GtmuGIily9+qTKQE56+j tM0q8HCL4WeRUD5zT5sUfRmYP1KZ3vhdc+eQ21A6v/s40zz+UuXiFseInlA36D+zUiEr p41SxYoSR1nT4+Xn+5Zvgtz8TzaujomcLThPYx3JkmHwtzCZ/tSFrjpR95LL+0OG0LvR Q8Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes-org.20150623.gappssmtp.com header.s=20150623 header.b=ssvJRGpN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1-v6si6815083pga.417.2018.05.13.22.05.56; Sun, 13 May 2018 22:06:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes-org.20150623.gappssmtp.com header.s=20150623 header.b=ssvJRGpN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751980AbeENFFi (ORCPT + 99 others); Mon, 14 May 2018 01:05:38 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:35246 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751387AbeENFFh (ORCPT ); Mon, 14 May 2018 01:05:37 -0400 Received: by mail-pl0-f66.google.com with SMTP id i5-v6so6637575plt.2 for ; Sun, 13 May 2018 22:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2e6ibhxwD3KYNe3haninlnlElMvy2QsnCKWk4oLKW+w=; b=ssvJRGpNVYC6ljDGND60f+/nB2MvXAkCyYxklt0sjPOrspLZCfVR2Plxo0EkOfGFp3 hk6VZh9u8hCAYpUJFULCDTMMBN3iMZfgmGSXbOrdIICrryIepkcCbKn8RsvjQby1VUBe bbznJVZFFR8cuT7Ji77AAXpyRd/B5eaCCt5S29MawwY8e2NWE4Xxa+Tasxy9PyMpE0t1 AXBZrgYIdQk5H9Xvnbgjpa4sKWZcA+kgJMjc1lywQkTTRfKMxdZ31Oabtt+8KIlw0Tdt 3Vzc2x9Mtn70xA1AsKjDoIPw/Fd/JL9y/bZYYEsv04kbpDeQ7JiM4VxE49HW9IGRtvw3 4MTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2e6ibhxwD3KYNe3haninlnlElMvy2QsnCKWk4oLKW+w=; b=UegHw+S9aMi5uwb86IXs+O9ZgUA5lk3cEC9XAM9XFUvpmIDAhN/GqCoWs9Oc1EH2pA Ncyw6SIH28mpALX5LZrEo8vwS6Qmgqzw1tD5JjxJSgR9C1IDib53SUEyZj/OaSUAYw5f nL6ZRMSQBfSU/ljZGqH/RTN8gFTq2XIy+7mctpZGxwnC0KAniXaaQKUyBZNxFHrBYDRc Z7z2oTrs3mkxLJ7WzEeiR/1xxzlErLzAnNz0muURIO7hY3QcLYaKfZsNS0JTS8KB3QWO VGBzEW6wd8wmIzC9FC0p5Jgp7Dfe9lUw55zSNp6gmMX74b1MoRS3E0xYCfgASkvy4lN9 kolA== X-Gm-Message-State: ALKqPwetCx1BU5SZiUl6g00sn/7PVvEDyhKF0RLeRwrX6jghDUOPsQQT kXEqTaBtt7M+Kp4CQxVcebfb3g== X-Received: by 2002:a17:902:3281:: with SMTP id z1-v6mr8158697plb.226.1526274337327; Sun, 13 May 2018 22:05:37 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id w134-v6sm14123861pfd.187.2018.05.13.22.05.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 May 2018 22:05:36 -0700 (PDT) Date: Sun, 13 May 2018 22:05:36 -0700 From: Joel Fernandes To: Randy Dunlap Cc: linux-kernel@vger.kernel.org, "Paul E. McKenney" , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , byungchul.park@lge.com, kernel-team@android.com Subject: Re: [PATCH RFC 1/8] rcu: Add comment documenting how rcu_seq_snap works Message-ID: <20180514050536.GB80415@joelaf.mtv.corp.google.com> References: <20180514031541.67247-1-joel@joelfernandes.org> <20180514031541.67247-2-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 13, 2018 at 08:47:24PM -0700, Randy Dunlap wrote: > On 05/13/2018 08:15 PM, Joel Fernandes (Google) wrote: > > rcu_seq_snap may be tricky for someone looking at it for the first time. > > Lets document how it works with an example to make it easier. > > > > Signed-off-by: Joel Fernandes (Google) > > --- > > kernel/rcu/rcu.h | 24 +++++++++++++++++++++++- > > 1 file changed, 23 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/rcu/rcu.h b/kernel/rcu/rcu.h > > index 003671825d62..fc3170914ac7 100644 > > --- a/kernel/rcu/rcu.h > > +++ b/kernel/rcu/rcu.h > > @@ -91,7 +91,29 @@ static inline void rcu_seq_end(unsigned long *sp) > > WRITE_ONCE(*sp, rcu_seq_endval(sp)); > > } > > > > -/* Take a snapshot of the update side's sequence number. */ > > +/* > > + * Take a snapshot of the update side's sequence number. > > + * > > + * This function predicts what the grace period number will be the next > > + * time an RCU callback will be executed, given the current grace period's > > + * number. This can be gp+1 if RCU is idle, or gp+2 if a grace period is > > + * already in progress. > > + * > > + * We do this with a single addition and masking. > > + * For example, if RCU_SEQ_STATE_MASK=1 and the least significant bit (LSB) of > > + * the seq is used to track if a GP is in progress or not, its sufficient if we > > it's Pardon my english. Fixed, thanks, - Joel