Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2067866imm; Sun, 23 Sep 2018 19:29:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV60OY6PrQ2aU+EWgl8tTejSmL6Xqm3iz6jp+QYCeQ8ya9W24ndKTlHLtnaeGEAfVOrZ80Ns2 X-Received: by 2002:a63:e806:: with SMTP id s6-v6mr7574364pgh.176.1537756167957; Sun, 23 Sep 2018 19:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537756167; cv=none; d=google.com; s=arc-20160816; b=CSy7sa7l6AXhUjyptWAUq3BniZGHd58P5G1Lh4sf5oLMAto4R+vBHQKLdjH680gZtn ciMf0KTHNWsYUDcOTz7ffVH/zORMtWP9gUzbE3wbio2aa2MAtb7ho1XRQFvoBFamviV4 TgUKRLJfe+tGXQtsCmizH65VAuFwwlrHUmuSIMksLEgzOu73uNlPnseJfxkcBgHiUwLy WA6PkNKRJXoMbWmSZnnDhFYPp7tdBnifEFbTyHEkdWr7F5ETqvhJ17YcXaAzTk6gWxeO aivCCVXGNinGsl9qAS1UUVUeaPdTVfmN6lg+L3Pl6R34opwTAZjmRgFFn/c9fAmi5Z5f 3vwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DcGRGJ9NwQK3sueXhQJvkqJ+L4hKV0ez70Jn5RmNtVo=; b=JeRPYN3C4bogicoy5VkZCPZ2B1+yNGXEDiXTABWtVtLctsaSGMx8Ib+ugq3vA5SrHS KLDb7Wc+e/vixEY2E2VoXxU2fQw3fWd4VHDzFTQopEX+0kJjrL5jkjhbGDKOWscMReKN IZl+7DTghSiMY4+GeafWXOBwmlGSBI4reN5DEKddSReX8kCofV9Cr5BPdEKHeYASma5d D6HswXMRZmO7GcBL0LimHhlVdLMnZwyZ4nL2MhQBsXJFbxDiK56L9UZyXnSeLoO0q/4j aqCAa2pS1pI59ZEU1hZ33IcK05GlQbuy0fheEDPxjA6ntPTG6MV3ksWqRuKyTx2CVQ0K lspw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=V7Wb+hRI; 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 d11-v6si36300150pln.471.2018.09.23.19.28.41; Sun, 23 Sep 2018 19:29:27 -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 header.s=google header.b=V7Wb+hRI; 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 S1726490AbeIXIZu (ORCPT + 99 others); Mon, 24 Sep 2018 04:25:50 -0400 Received: from mail-lf1-f43.google.com ([209.85.167.43]:41543 "EHLO mail-lf1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725854AbeIXIZu (ORCPT ); Mon, 24 Sep 2018 04:25:50 -0400 Received: by mail-lf1-f43.google.com with SMTP id l26-v6so15311413lfc.8 for ; Sun, 23 Sep 2018 19:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DcGRGJ9NwQK3sueXhQJvkqJ+L4hKV0ez70Jn5RmNtVo=; b=V7Wb+hRI2AsJQYaxouuKRFhz3yJIOCiJcERCzpKbu8BjqXwACSSCyu0Cg6DSMUBQV4 Wuo/+VczuV4p9UCqTXdASReiyHU4HSYW0jCMCFCTLX4UABQdk5L640wjB5USV4PNmvuJ aO2Ff4j1smgTpgsiD1JCUcLtwOwPZLcGUtkJw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DcGRGJ9NwQK3sueXhQJvkqJ+L4hKV0ez70Jn5RmNtVo=; b=WMLKwp4j6Bkm4uMw/jVTovV2//v83a/lSBJD7fdEdo8OwiKdxn0oQp8PJN3z4L4UGz yHNLNFwOT33dN7X8EQeUI0x9weCoqNlrjfGYCDuCj8zd8N/pItW6778oVrTZXZA1GnX8 NMPTLe+SuTJCdLne7Ev5JEYVgAy8kbdeX0E4FR+5Tc0PykICskmm2OVDhE14CNbG1iu7 Cc5eVYvRW6LzbBFgGpwid38hLk/wLsSbyVDaQD0Xg52KW/B0YJ8Ox/fHYHIIiP37j6Sc qIvDZGPZndzRYuxyd5KKX0qu1aDc5RahC+9AVWowALwlkbkHlMTGVPtNIIS26nOdTgml KSFg== X-Gm-Message-State: APzg51Bg+jEzIR/69OhZh7UahNsoZ3T2YqJnaHQuDn9uhIfz3r1nWMS7 bVF7r5VAZQrzkmRv8hyP2i4afU2nromEUR/zLYlQYg== X-Received: by 2002:a19:e495:: with SMTP id x21-v6mr4598721lfi.29.1537755956700; Sun, 23 Sep 2018 19:25:56 -0700 (PDT) MIME-Version: 1.0 References: <20180923235413.GA4222@linux.ibm.com> In-Reply-To: <20180923235413.GA4222@linux.ibm.com> From: Joel Fernandes Date: Sun, 23 Sep 2018 22:25:44 -0400 Message-ID: Subject: Re: Question about ->head field of rcu_segcblist To: "Paul E. McKenney" Cc: LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 23, 2018 at 7:54 PM Paul E. McKenney wrote: > > On Sun, Sep 23, 2018 at 07:30:30PM -0400, Joel Fernandes wrote: > > Hi Paul, > > > > I was parsing the Data-Structures document and had a question about > > the following "Important note" text. > > > > Could it be clarified in the below text better why "remaining > > callbacks are placed back on the RCU_DONE_TAIL segment", is a reason > > for not depending on ->head for determining if no callbacks are > > associated with the rcu_segcblist? If callbacks are added back to the > > DONE_TAIL segment, then I would think rcu_head should be != NULL. > > Infact the "rsclp->head = *rsclp->tails[RCU_DONE_TAIL];" in > > rcu_segcblist_extract_done_cbs should set the ->head to NULL if I > > understand correctly. > > The rcu_segcblist_extract_done_cbs() function will set rsclp->head > to NULL only if there were no non-done callbacks on the rsclp list. > Otherwise, if there are non-done callbacks, then rsclp->head will > be set to the first non-done callback. > > Either way, the problem is that the done callbacks can be removed > and re-added, but the count is not adjusted until the re-add. So > you have to look at the count to see if there are callbacks. > > Testing rsclp->head fails because it can be temporarily NULL, even > though there are callbacks hanging off of a pointer in rcu_do_batch()'s > stack frame. > > Or am I misunderstanding your question? Thanks yes that clears it up, I see what you mean that that ->head field is temporarily volatile and really the ->len tells the real story :-) - Joel