Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8366583ybl; Thu, 16 Jan 2020 15:27:15 -0800 (PST) X-Google-Smtp-Source: APXvYqzbXx8n0rcyM8HwDwpgTYx3sHWN/x7Zn8qVI372VYWjmVJFSS6RoEvqAA1flhXrf111jyJH X-Received: by 2002:aca:f505:: with SMTP id t5mr1345621oih.136.1579217235098; Thu, 16 Jan 2020 15:27:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579217235; cv=none; d=google.com; s=arc-20160816; b=AIfN+sYYBVmA+/hlzc8AHi4y+7oLi4HLl5DcSpyjJ3XdtYiax+f8w3u7ttwaPIB/Ft 3QD2cz31lTcyIGAjft9fSX8uNitI6v+19gZ7tisRJ7AZEAg7bREfn3NIVe+naYFJPQij pD6OUe8gtFcZAhpcMlP4F00jJ+8TC4MsvmohyuH5NI+tDxdEaypPascBM2Dfpj+Min1e bIEJcoZQZhql/vHOgcuk5zYTS5xk12/MIWmDEika4wPJ8sEAu7uyS+0RNsVgchNnnD8Z LtupR4pHIYjAXxg+gSTv/I3ymTS+ffJ8UCj1AH4qfZ168Oz3blejl6i5iUJs1q4iiHH8 vZKw== 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=K2xuhFUNXht7fcfEH+3ztlqzjosMro36By5h4pXdIHc=; b=UHrSNaDX6vwENY2ygfGLzT9sGUQ15+XuZWHc4Ju2lNF4t3BfdIOiX8lEyot+Ct62az hbNO4tHxBd2hRb/vwXU60x8C7HaKNoIDKVTyq80W4mr7b8XSX/wFkPPQP+8TY8LKQIRv TaKYeCeWoK6GnGv8v0HaQRRNrayYKr6mQfcyZ0BIGwrp2oA6ZEW860M/mtvMVxOERl0F PbBbJ3XTrjBY9wiacZ3c1CdDCpTiMdgxvd3iciU9pQYWwiWdf1zVR1zKAMK06KuGL3Uv Gk9T0939Hc+RaVZl2/fMDJyRP+PHeU9/QscswsE2GBDADWHCE/1aZpB91llpU+5ijwwn Lczg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=Aod3SYFV; 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 v25si11948787ote.90.2020.01.16.15.27.02; Thu, 16 Jan 2020 15:27:15 -0800 (PST) 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=Aod3SYFV; 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 S2387894AbgAPV5R (ORCPT + 99 others); Thu, 16 Jan 2020 16:57:17 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:33202 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387718AbgAPV5R (ORCPT ); Thu, 16 Jan 2020 16:57:17 -0500 Received: by mail-qk1-f196.google.com with SMTP id d71so20798784qkc.0 for ; Thu, 16 Jan 2020 13:57:16 -0800 (PST) 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=K2xuhFUNXht7fcfEH+3ztlqzjosMro36By5h4pXdIHc=; b=Aod3SYFVPozEToTjnYF/YiRqPUPQyOs89E5qi9CDjvx1TxXnza6a/fgZ6irmTnQt4m Fb3MVyT4sHRpVo3xNsrMfO96EWiIZ0DlApUvn8E4JEsBQ0mWcFW1osKcYKdA5Qwuq8iS HUH5QtPX06IEKYllmnlLc/9+z6lQT4LJ+I7GI= 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=K2xuhFUNXht7fcfEH+3ztlqzjosMro36By5h4pXdIHc=; b=YpCPbgiRq3Prq2W+BAThvkkeJMxo6SQAjM8wwASKCGJ0th/4hJ/IT+h6AQ/nbCdzmb RsWVxVCHwssMYTIvGy9c//rVUPJ7wTlaPOOYC31TAM4N+sn56Rg9WHlWwLoV8s10tXfb XGKkTagQB1Zn7dc1KhzODPs0QLh3D7Rw3c6f3IeJvyUcyxCPvxGiQpXPLntJ5HulA827 Eaaj0d3Sw0kiCFyAvd3o3sHDIuSampx7zIMahA+/PK8he4fEwoBFgl6YrEvfxJWvwFyy Nl/baCRWYvOsRnl2wFWL3G0y/1/Seqb7cX1rGJL/739yjvB+21qeOtb4ilbgRb+z4H1j Cd5g== X-Gm-Message-State: APjAAAVevEjcrJjZyoVOtRkh6nhfS8qsnzCgdumTxOk2DcW2t0aDntdQ VChNG6ZHtXJ1XzR2l11Llc0TaP9qq/OZxDtq1wR+9w== X-Received: by 2002:a37:6d47:: with SMTP id i68mr1496273qkc.228.1579211836142; Thu, 16 Jan 2020 13:57:16 -0800 (PST) MIME-Version: 1.0 References: <20191004145741.118292-1-joel@joelfernandes.org> <20191004154102.GA20945@redhat.com> In-Reply-To: <20191004154102.GA20945@redhat.com> From: Joel Fernandes Date: Thu, 16 Jan 2020 16:57:05 -0500 Message-ID: Subject: Re: [PATCH] Remove GP_REPLAY state from rcu_sync To: Oleg Nesterov Cc: LKML , Daniel Bristot de Oliveira , Peter Zijlstra , "Paul E. McKenney" , rcu , Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , Steven Rostedt 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 Fri, Oct 4, 2019 at 11:41 AM Oleg Nesterov wrote: > > On 10/04, Joel Fernandes (Google) wrote: > > > > But this is not always true if you consider the following events: > > I'm afraid I missed your point, but... > > > ----------------------> > > GP num 111111 22222222222222222222222222222222233333333 > > GP state i e p x r rx i > > CPU0 : rse rsx > > CPU1 : rse rsx > > CPU2 : rse rsx > > > > Here, we had 3 grace periods that elapsed, 1 for the rcu_sync_enter(), > > and 2 for the rcu_sync_exit(s). > > But this is fine? > > We only need to ensure that we have a full GP pass between the "last" > rcu_sync_exit() and GP_XXX -> GP_IDLE transition. > > > However, we had 3 rcu_sync_exit()s, not 2. In other words, the > > rcu_sync_exit() got batched. > > > > So my point here is, rcu_sync_exit() does not really always cause a new > > GP to happen > > See above, it should not. > > > Then what is the point of the GP_REPLAY state at all if it does not > > always wait for a new GP? > > Again, I don't understand... GP_REPLAY ensures that we will have a full GP > before rcu_sync_func() sets GP_IDLE, note that it does another "recursive" > call_rcu() if it sees GP_REPLAY. I finally got back to this (meanwhile life, job things happened). You are right, only the last one needs a full GP and it does get one here. Probably a comment in rcu_sync_exit() explaining this might help the future reader. Basically you are saying, if rcu_sync_exit() happens and GP_REPLAY is already set, we need not worry about starting a new GP because GP_REPLAY->GP_EXIT->GP_IDLE transition will involve a full GP anyway. And only if, GP_EXIT is already set, then we must set GP_REPLAY and wait for a full GP. This ensures the last rcu_sync_exit() gets a full GP. I think that was what I was missing. Some reason I thought that every rcu_sync_exit() needs to start a full GP. thanks! - Joel