Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1005724pxj; Thu, 17 Jun 2021 19:58:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzp12ulX4O/4NEPSofvV9S90HTyHQVWIiQ9OFZTlQy/lRDYc+BUDvnAxwsi/FBz37ObvTf X-Received: by 2002:aa7:ccd4:: with SMTP id y20mr1905997edt.151.1623985097919; Thu, 17 Jun 2021 19:58:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623985097; cv=none; d=google.com; s=arc-20160816; b=bnzRYnW7Yy/UVPniO+Jm8UMWO+fMl/KcH3sq5XDuL0U799UAgjaEJr3Clnt1w2Aljs f83WfTwMYNToCCEP/5PfBBJ91YoNGQftsdq7L4bh43tsfuVW9UEnlyYjS3L5nojoms3c 4Hlf8bQzfxeaex5krCeXyN4kEep+Sagkt+8p+1aWQYIYE9lSbaiKzPk26jn9pXKpTJ3C CRghzZozu8sCse8Gu0WG5RZxNHrlV/Hpooh9WSeQcPSaJt43tzh5imOuj2JO5nnpAXIs m5842nyvgz7GfrOiv9hVe6HKR2yCzTxBmr8hpqhLzuc2QA1GQSzYMND1zIlGflR1eqbD vajQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=lnFTZ9lCPprezNdCu2tAZp7vvhH5LEQzvye9hT4IWnE=; b=kQi2Pd2VjF+ElQvA5ZRrQfXe/dlZUbjUS2Ap/px8oeHnSFaR3ZAADWU+Ru7PwteNBX 0YaFrLBzNFU25DBWTAXlDawsiZrcVahpMBo6MuERHApY8++xVoEmF4UmHVI0AaEEy6QI eGXIfGmDT/arO0CwFqrqQ1M3Xg6EtUZbd4gcFj5On2F2HWohhG2+R4vEuaWONJqII8Go yKep344U6/Cokum4FMOhvsCs6sZQfFYxva9a7GAnz8wEH5UJFsu08Kc9/FLz5u4puckV yUFeEUkZ9UM9q/6Xi37K+DVXLd9V7YmUkj1hrgNVqIllGzonYl+FVMBxc5TpHKlBN0GO WryQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PDh8bGoK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si993040ejb.555.2021.06.17.19.57.55; Thu, 17 Jun 2021 19:58:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PDh8bGoK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232678AbhFQXrx (ORCPT + 99 others); Thu, 17 Jun 2021 19:47:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:53516 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230447AbhFQXrx (ORCPT ); Thu, 17 Jun 2021 19:47:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B261061249; Thu, 17 Jun 2021 23:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623973545; bh=b9n22f59waq6Zjf5wNWLy92938cntiW3Y6K75NuR7QE=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PDh8bGoKPqQJj55E1dK77PrlYbLlNSnQvEpXdfTLOJqbrL0JTHEN+nSsKgYmSS0vL R05fK7rvcjvi70NvKCZhZrtRM/0eBHr5YIdjjBXbSuhuNEUrGCM1AdlBaJpSRfvqKi KZBbRJklnu684S5fq9Pl3Fzyeus1R+8fXFsy4bIE6jrqmntsqy598LwLEMaROBkDUk n2+w6nHhARto4z5JZwyAGyoPPiw6HRThYppFsqqLbW1OqX0sfgiNircrhF469hLz52 VzVx+5U0jB39cuXl54BpTFmWwel+y43a9imzokXA5N+mYHqpZ8CUNbipAoUZcSIG0R gFhgkpyYd2+1Q== Subject: Re: [PATCH 1/8] membarrier: Document why membarrier() works To: Peter Zijlstra , Nicholas Piggin Cc: x86@kernel.org, Andrew Morton , Dave Hansen , LKML , linux-mm@kvack.org, Mathieu Desnoyers References: <1623814509.xcl6pmt93d.astroid@bobo.none> From: Andy Lutomirski Message-ID: Date: Thu, 17 Jun 2021 16:45:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/16/21 12:30 AM, Peter Zijlstra wrote: > On Wed, Jun 16, 2021 at 02:00:37PM +1000, Nicholas Piggin wrote: >> Excerpts from Andy Lutomirski's message of June 16, 2021 1:21 pm: >>> We had a nice comment at the top of membarrier.c explaining why membarrier >>> worked in a handful of scenarios, but that consisted more of a list of >>> things not to forget than an actual description of the algorithm and why it >>> should be expected to work. >>> >>> Add a comment explaining my understanding of the algorithm. This exposes a >>> couple of implementation issues that I will hopefully fix up in subsequent >>> patches. >>> >>> Cc: Mathieu Desnoyers >>> Cc: Nicholas Piggin >>> Cc: Peter Zijlstra >>> Signed-off-by: Andy Lutomirski >>> --- >>> kernel/sched/membarrier.c | 55 +++++++++++++++++++++++++++++++++++++++ >>> 1 file changed, 55 insertions(+) >>> >>> diff --git a/kernel/sched/membarrier.c b/kernel/sched/membarrier.c >>> index b5add64d9698..3173b063d358 100644 >>> --- a/kernel/sched/membarrier.c >>> +++ b/kernel/sched/membarrier.c >>> @@ -7,6 +7,61 @@ >>> #include "sched.h" >>> >> >> Precisely describing the orderings is great, not a fan of the style of the >> comment though. > > I'm with Nick on that; I can't read it :/ It only makes things more > confusing. If you want precision, English (or any natural language) is > your enemy. > > To describe ordering use the diagrams and/or litmus tests. > I made some changes. Maybe it's better now.