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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 B1CC7C48BE5 for ; Wed, 16 Jun 2021 07:31:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5113F6044F for ; Wed, 16 Jun 2021 07:31:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5113F6044F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9416F6B007D; Wed, 16 Jun 2021 03:31:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 92C976B007E; Wed, 16 Jun 2021 03:31:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 830F46B007E; Wed, 16 Jun 2021 03:31:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0088.hostedemail.com [216.40.44.88]) by kanga.kvack.org (Postfix) with ESMTP id 52BD16B007B for ; Wed, 16 Jun 2021 03:31:52 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id EC4CF181AC9BF for ; Wed, 16 Jun 2021 07:31:51 +0000 (UTC) X-FDA: 78258767622.07.BEAFD02 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id B3F1737C for ; Wed, 16 Jun 2021 07:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Fl3DdxiotfbJW41rurXe7Q6sPhCdtUvqest464jkbyM=; b=LioT44BF3C0/SbJehA4uhP8re5 MEo6fFLHkkm4X31U4PVvUfSYs4blO2O12qyoUM3Nj8gI+qefFa7+nITyI/jYUB0kaUkhkFL7sAbfr 4X0RYrXr/+tG15PhxAMPGDD5Wo3X3EM7dWjbSdJbNlVIqThpc0jqauiihreMahb2Gm0IE56O8uJDh y38LBkt3mICzcR8DIx/3m1trnqf8R/3Lhj+7Tvbqj1rg7rPVB644Ky5QfjbiXxw5vIn0009JFpv8y wlrCxInNx72/O9AmmASyRmIFFz6yD87dpgQ5/7lFN/C6pEMOATLk+tRjr55neduNSAlRNj7vMbAef J6RfiQZA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ltQ0h-007kdA-M3; Wed, 16 Jun 2021 07:30:58 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B4471300252; Wed, 16 Jun 2021 09:30:50 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 601902C76DB8D; Wed, 16 Jun 2021 09:30:50 +0200 (CEST) Date: Wed, 16 Jun 2021 09:30:50 +0200 From: Peter Zijlstra To: Nicholas Piggin Cc: Andy Lutomirski , x86@kernel.org, Andrew Morton , Dave Hansen , LKML , linux-mm@kvack.org, Mathieu Desnoyers Subject: Re: [PATCH 1/8] membarrier: Document why membarrier() works Message-ID: References: <1623814509.xcl6pmt93d.astroid@bobo.none> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1623814509.xcl6pmt93d.astroid@bobo.none> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B3F1737C X-Stat-Signature: qksqs7q8iwggc98mzoink8msth8amsny Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=LioT44BF; dmarc=none; spf=none (imf29.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org X-HE-Tag: 1623828697-179427 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 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.