Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1040557ybp; Fri, 4 Oct 2019 08:42:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZ6LawsWKyjl4REYBKZ39XI57DigypFuqBeByGc1uaob4r5yZnJmC+u92yU6qyGx55OTjY X-Received: by 2002:a17:906:8041:: with SMTP id x1mr13082865ejw.132.1570203764757; Fri, 04 Oct 2019 08:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570203764; cv=none; d=google.com; s=arc-20160816; b=IEw0wjrlSDYvfuQAta7KKy0tpHABHTWbq4llM0p1j9aBiJ6g9NxJVgQFEpidVFQN3L mDHWWlal+EO8ztlKY1rDg1rCSmhv8Cmw7HaTQnZg7tqfoIg+9/BakgOU7V7PnUlNxAJq R6ML0wDpXH8PkxaeZ6BFrtX/ZTZaOm5VYdqbGq4MesKQEDqieMSm4POTmfwn1ZMWAkZJ MlBLypMLYgbBubQ0WOOjTtg5XIeZ3KVl/+Mr5AxZAsEfLT9EXjWkDaK6McWaRRVbqzz0 IZeB6MMz+JHG++TeBJY4TWCeR++OEL5d8DQkSslYvxK9jV3NysnjbH4F3rXqdculU8Sr D9KQ== 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; bh=HhAcTDIgvenloXenPa+9tJtBsd25jdlmzLzPXKn91mI=; b=MzeIS/yc1xfr3qyVgRmZk5DL/1mvFWjPbBJSEQ4t2oKwUeN+TU7F1nqOojfuNFEu1L Fc0EbSlDC4RlDzuTjXDX6hTci/vFxFT/RFLr4m+QudepHq6/NKwtIShpU4cM/mwtE2NY nq1WRcRiOPd7473x5kkUoOQGRXPa3PHf5dlxXNt0TreePCekIDH7I+ucr5HWo7pWvqze D3htTRVx5O15aA9mIEkFnxsx45Tz/nYb+vHZXl4O2uA4WNPXa9xiDMxO+rCaJwYMU+Ic XocVkZ2UoSa4R20TYURKvLkXKeFcxCpHXyWG9rPhY3PqEq/QZJuiBKLbrWdmSIfi8XzT G8dQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si3152349ejt.345.2019.10.04.08.42.19; Fri, 04 Oct 2019 08:42:44 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389943AbfJDPlP (ORCPT + 99 others); Fri, 4 Oct 2019 11:41:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52916 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389669AbfJDPlO (ORCPT ); Fri, 4 Oct 2019 11:41:14 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 267433086E24; Fri, 4 Oct 2019 15:41:14 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.43.17.44]) by smtp.corp.redhat.com (Postfix) with SMTP id DF5E95DAAE; Fri, 4 Oct 2019 15:41:04 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 4 Oct 2019 17:41:13 +0200 (CEST) Date: Fri, 4 Oct 2019 17:41:03 +0200 From: Oleg Nesterov To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, bristot@redhat.com, peterz@infradead.org, paulmck@kernel.org, rcu@vger.kernel.org, Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , Steven Rostedt Subject: Re: [PATCH] Remove GP_REPLAY state from rcu_sync Message-ID: <20191004154102.GA20945@redhat.com> References: <20191004145741.118292-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191004145741.118292-1-joel@joelfernandes.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 04 Oct 2019 15:41:14 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > Taking a step back, why did we intend to have > to wait for a new GP if another rcu_sync_exit() comes while one is still > in progress? To ensure that if another CPU sees rcu_sync_is_idle() (GP_IDLE) after you do rcu_sync_exit(), then it must also see all memory changes you did before rcu_sync_exit(). Oleg.