From patchwork Wed Aug 14 14:52:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Guzik X-Patchwork-Id: 13763598 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7CE4C3DA4A for ; Wed, 14 Aug 2024 14:53:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5D5556B007B; Wed, 14 Aug 2024 10:53:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 586116B0083; Wed, 14 Aug 2024 10:53:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 44CED6B0085; Wed, 14 Aug 2024 10:53:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 26A286B007B for ; Wed, 14 Aug 2024 10:53:11 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id BC32CA0FEA for ; Wed, 14 Aug 2024 14:53:10 +0000 (UTC) X-FDA: 82451143740.10.91669CF Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by imf16.hostedemail.com (Postfix) with ESMTP id E9EC5180005 for ; Wed, 14 Aug 2024 14:53:08 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WPa9Cfwf; spf=pass (imf16.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=mjguzik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723647117; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=lonJxsA8Fw6wOOZai80Q9J+BZK2m7M/vz+HKB4hoGGA=; b=NJacVpNtnHz2/cdXvFM+ptnXIAIPA0ID17QWWOmJkE/cVi1TjeFWnXjvKZWAyjA26FhhPe lsROHBqqmgUXALC/E3Gh0qjmi6HJpsNH7DoN4e0PFdoD380hBK+01jmmppohJKNKka2jqn L60xfK2nQq17W/HvQh+u9AiS80G+akE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723647117; a=rsa-sha256; cv=none; b=Jlis8BiDb8/uFf0PumMX57sQV2G2pExjOU122nWMUszFit2UCqMS+05wbmNVbiRURtmzAh n+n+JdX0A8btCZvaZ3Mcx4JTAoDZ/vgOqfzv1x9yUkwY7KNO0LycNjPql1auw0feKeiz/t ja+bAk3uxgcmk8WMsEbCuncQ4ui4FrE= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WPa9Cfwf; spf=pass (imf16.hostedemail.com: domain of mjguzik@gmail.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=mjguzik@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3687fd09251so11981f8f.0 for ; Wed, 14 Aug 2024 07:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723647187; x=1724251987; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=lonJxsA8Fw6wOOZai80Q9J+BZK2m7M/vz+HKB4hoGGA=; b=WPa9CfwfZrGUYAZAzPJPjCNf6CywDMkZwjFJ67MKWuphHCGZTfb8uuqbsf/kyPPS7P QrAQEaSWzyP4d5Y6tL5OaHUR0yTIFJDhzsq9B2rZJydf+VbnO/Fozxb6g/ShWgcavOtE k7NRJmtvFABi/Ss2PZpar6tW78Zf4fiZw2Xt+ztVBctch/aWwPdecMgWPiZRUBTuvbaJ UfYnk7wq6gxJH624lyc4i6/tZ3NRgNDZpfe+h52llAEIUpfrO7fs77r2kzbgBe74xuO0 blX3qfUiFJgZf2fnaFWkTDFhd7h23bN/ls/VOFUWKeksx5lwscsGeTQ+c4LfwAbFQZn+ dm1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723647187; x=1724251987; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=lonJxsA8Fw6wOOZai80Q9J+BZK2m7M/vz+HKB4hoGGA=; b=O3IEBaQ5lzha/0Xtl86ujq7B+B6NRjyuoTShauerPni6X7FEMTE/GR9OtyvZY5mBwM TfNrVdZqRWfRZdMpKbj+lZH3L/5SdvdIA5ts+ZoR+cArabWyv3B/74D8pvIKdRjR631k 7IzWiH5DSrQL/7zyBT0ttj81jLTSfep8zqSfABzli1C3FyYHO3+3fL48QtN+6PJrrPp6 oMMUl9FwxCSVddm3KcQM6XJCHgypcPeotXs8B/CTgvCrRN9073K2faHKB+fVlip9e2pY YtAk0iF/f4WFRCLXnV+5Nj9LJA28m/B30BuRIa6ul+XEDT6Hf4UlPSn9zDz8fr8JLLxJ bWtA== X-Forwarded-Encrypted: i=1; AJvYcCV4YnAG1GYSphK9vjncq6QKdTXUVrWUrrQbLhGRW5H3nptEuw//BYKG7IzgBJZTqj3j62SZwi4Kz2pJ/F6VSXOvJQk= X-Gm-Message-State: AOJu0YwPwmJS3gVjwZPwLc1l5QMo/ZKIIpIdAEmPe/Zu4q4XaniAXAVv qiamroZn5MlvNVEOjmFZIhd7abyhgWnK1cGSt3djl3Q1NuxbQNZz X-Google-Smtp-Source: AGHT+IEoJbkP+hVe6+RzMKd+SJql/ELhAn+tPz0Gyw1HW0cOooFceTJ11Wl9zFZCSz+VoMQDguNnNQ== X-Received: by 2002:adf:e546:0:b0:368:77f9:fb34 with SMTP id ffacd0b85a97d-37177763876mr2346397f8f.15.1723647186881; Wed, 14 Aug 2024 07:53:06 -0700 (PDT) Received: from f.. (cst-prg-76-86.cust.vodafone.cz. [46.135.76.86]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36e4e51ebefsm13003576f8f.89.2024.08.14.07.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 07:53:05 -0700 (PDT) From: Mateusz Guzik To: akpm@linux-foundation.org, npiggin@gmail.com Cc: david@redhat.com, willy@infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Mateusz Guzik Subject: [PATCH] mm: whack now bogus comment in pmd_install() concerning a fence Date: Wed, 14 Aug 2024 16:52:56 +0200 Message-ID: <20240814145256.1683498-1-mjguzik@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E9EC5180005 X-Stat-Signature: y44nzibc5mnpwrpqx7yekan4aw8smqmp X-HE-Tag: 1723647188-889398 X-HE-Meta: U2FsdGVkX18H43zSRSZbiB89HpW+4pE8soIZLCRPoAfkbFf3nc79m4kon9QCalTbK9bWbnCcdgW35VKLk/waHSdptt03Q00nqDDyVrCYLq7I2KPx/VUIlrFZB0PtGR3lAGG9zTKNF7AQC9MXKsU4o+McUKHewYbgu6rysveeNk82NN89AHSDIQTY7Uw1x2kbyE6M+YdMPqOb4cYATzh4veDlUurEDQD/ZlOrJohy4OOEmDpI2e1CEyzXGVL6Qfm1RwlAjBvNfl/fMn6rEXcIRxOu0WjCiWwPpQqFOVOZAVpYd9UPxf0hcdBJngWEag5RPqHkRyvhKkW7ondDKmuw2bLfyYrIjBxOcYXTldtJUo0m49iEG5THs0uU30I8/P/4spafxBTlOGmVIoe9E2a6kMgukUdMDLlExYjcxP2EsVdvu/Fi8t2r4oaHnNXha/DCSikTPHqaW3MGdH+U8IRqCWU0rdQ95w6Ey5lZAyybKvStq2Vw15ce0gbzxNgWnODBP7btvZQdEC1aV8gB/KIm047E01tSM8zj+JZfCqOqa6oWWOYsFCWXGIt+kP5L5IXBjkyoJzlkBgDUmLcvNYZoJgvpXaa3/gSXy2KbTnNZ9CyV6+V/4anFg8rQ1eMu6hxZNbcHxgCb9R4yxriCIjEq20yFUwS5UtqBhuisYLwoOs/72FiL+tYnKIjP57v/E4US8UE4JuMj1BKIK37pqujkazcEJxciISwyc8CCK/+CUE6CELjpNPktNot5X2hpnH02KcEOgttOZtaab0A79mg7yJz/YIwrW76FdUILOg1hEzsJsyRQ3QhxbB8Gv8BYRtpyPrUrkqT3cui1p5q3w7G/a5yhaSQGFb8FT+rUUzf1KsREoaqb5l9oeykptNr6XzpHpKSZzPPeZyLBiDPhgi8ns7ukVtGq5ekoJeni67MmxqHODhR75Xsuduksi9u4NwpLCXCaqQ/uYubcfSs/Vg3 WS2lQ5Ro ZPTQ4SwOwksDuXtrlM2TAV9ZSGkno4eC4eCt2KPipETKjfaslkmcFi/COzHFql3MXgh7XfQbeEnbzYt9bkdp+mIwiFFvmtbuQHzSSx6j9RDqxxf9kcXARGSh+ttvSAxCm8FK6zyXnmmbiaGTXgS4UzILTBd5uCHzhd84CzPJL/OwpTFPVTn4KnyXxEgzv0Mm+AVOpNqeHeo4FQepIcUPMpEKSg1dxPbeI5tZKQOv7fK/knNdLjoYrThG5ebg/sTeZsrCua7kb3gLmBuReYnDKhTjZ9qts2R0Ikb53YAJ49m0jasUZs5YPZ+13fuo8aecLuBeDFgvxVKNx/2bWbEK6xRIu3599qZFSc3wQzn4ypWzIeFAxr5MtdCZxJrqnrKrFQ9wOJm6i5oTufj4= 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: List-Subscribe: List-Unsubscribe: Commit 362a61ad6119 ("fix SMP data race in pagetable setup vs walking") added the following: + smp_wmb(); /* Could be smp_wmb__xxx(before|after)_spin_lock */ + spin_lock(&mm->page_table_lock); However, over the years the fence along with the comment got moved around the file, eventually landing in a spot where it is *NOT* followed by a lock acquire (or any other operation which might happen to provide any fence on a given arch), rendering the comment stale. Signed-off-by: Mateusz Guzik --- ./scripts/get_maintainer.pl only showed akpm@ and the lists, adding the --git switch showed more names, but I only picked some of them. I don't know who makes the most sense to add here. I fully concede I could not be arsed to check if the fence is still needed to begin with, I ran into this while looking at something else. The comment puzzled me for a minute suggesting pmd_populate has an immediate lock acquire inside. mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 34f8402d2046..0a6893833fac 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -436,7 +436,7 @@ void pmd_install(struct mm_struct *mm, pmd_t *pmd, pgtable_t *pte) * seen in-order. See the alpha page table accessors for the * smp_rmb() barriers in page table walking code. */ - smp_wmb(); /* Could be smp_wmb__xxx(before|after)_spin_lock */ + smp_wmb(); pmd_populate(mm, pmd, *pte); *pte = NULL; }