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=ham 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 50343C2B9F4 for ; Thu, 17 Jun 2021 23:45:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 235D361185 for ; Thu, 17 Jun 2021 23:45:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232845AbhFQXry (ORCPT ); Thu, 17 Jun 2021 19:47:54 -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.