From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 405D4C48BE5 for ; Thu, 17 Jun 2021 23:45:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B1277613A9 for ; Thu, 17 Jun 2021 23:45:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1277613A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E5F696B0070; Thu, 17 Jun 2021 19:45:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E36B76B0071; Thu, 17 Jun 2021 19:45:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFE136B0072; Thu, 17 Jun 2021 19:45:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id A12B96B0070 for ; Thu, 17 Jun 2021 19:45:46 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 3A5B09429 for ; Thu, 17 Jun 2021 23:45:46 +0000 (UTC) X-FDA: 78264850692.23.D06E0D7 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf02.hostedemail.com (Postfix) with ESMTP id D78334202A10 for ; Thu, 17 Jun 2021 23:45:45 +0000 (UTC) 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 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=PDh8bGoK; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf02.hostedemail.com: domain of luto@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=luto@kernel.org X-Stat-Signature: y8zyt6fiujbnbdz81ppmtdf9nf3qqcex X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: D78334202A10 X-HE-Tag: 1623973545-393444 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.