From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4EDD257435; Thu, 17 Apr 2025 18:53:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744915998; cv=none; b=QGceX55n+Ofn1o08hNgv5llJA9EFdyLZGIkZdDFG78cPTCiW4SUVuUptIYSK/5vJNALb8DsNEH8iymQMHlUu9P0oeVnZ91rb8qpQbsRYZxSmG0NLEKmKr7tnfcUXkLKUIAP/Az/sLJc+3gG1jQwtb1eAOVqqH1r0S4s27CmJzL8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744915998; c=relaxed/simple; bh=ymyKiixD/qJwusBzyY1eQ6ECIYhkdJC7G4KL+d6nuAY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Uk2ymhxYKe8z4LH5mtsYMfszg4GZmHDvHjzkj6+ZMCq5hscLSllhJ+wSKnlzsVc/rYQK2X9m0j/M0Zmqdk8rIyzr/I8vj8KkWxKAAdPYwyflrk3BGUEa41YhSdyAU6IkYSEKY52cXSALeFfNLsT2B5nilCJNXJOW2jhXM5svNn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nBD/qU2U; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nBD/qU2U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFBA2C4CEE4; Thu, 17 Apr 2025 18:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744915995; bh=ymyKiixD/qJwusBzyY1eQ6ECIYhkdJC7G4KL+d6nuAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nBD/qU2UMqnfLWw8EOuR4yReRYCSzwtNa4/sq+7RtG1nJlchswSsO0RTV+lYIj+MA y9JGLkWVfhxd+YvaEJG+KdW1/k1lfto8AGlXaQb+lrk3W39lmSsyv4gi5RLgoUYRoN 21JURMpn3EI4Jf/2qw+lPG6ftFGudUOY7Qga35Fo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Mathieu Desnoyers , Lorenzo Stoakes , Matthew Wilcox , Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Andrew Morton Subject: [PATCH 6.12 308/393] mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock Date: Thu, 17 Apr 2025 19:51:57 +0200 Message-ID: <20250417175119.999717499@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250417175107.546547190@linuxfoundation.org> References: <20250417175107.546547190@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mathieu Desnoyers commit c0ebbb3841e07c4493e6fe351698806b09a87a37 upstream. The PGDAT_RECLAIM_LOCKED bit is used to provide mutual exclusion of node reclaim for struct pglist_data using a single bit. It is "locked" with a test_and_set_bit (similarly to a try lock) which provides full ordering with respect to loads and stores done within __node_reclaim(). It is "unlocked" with clear_bit(), which does not provide any ordering with respect to loads and stores done before clearing the bit. The lack of clear_bit() memory ordering with respect to stores within __node_reclaim() can cause a subsequent CPU to fail to observe stores from a prior node reclaim. This is not an issue in practice on TSO (e.g. x86), but it is an issue on weakly-ordered architectures (e.g. arm64). Fix this by using clear_bit_unlock rather than clear_bit to clear PGDAT_RECLAIM_LOCKED with a release memory ordering semantic. This provides stronger memory ordering (release rather than relaxed). Link: https://lkml.kernel.org/r/20250312141014.129725-1-mathieu.desnoyers@efficios.com Fixes: d773ed6b856a ("mm: test and set zone reclaim lock before starting reclaim") Signed-off-by: Mathieu Desnoyers Cc: Lorenzo Stoakes Cc: Matthew Wilcox Cc: Alan Stern Cc: Andrea Parri Cc: Will Deacon Cc: Peter Zijlstra Cc: Boqun Feng Cc: Nicholas Piggin Cc: David Howells Cc: Jade Alglave Cc: Luc Maranget Cc: "Paul E. McKenney" Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -7557,7 +7557,7 @@ int node_reclaim(struct pglist_data *pgd return NODE_RECLAIM_NOSCAN; ret = __node_reclaim(pgdat, gfp_mask, order); - clear_bit(PGDAT_RECLAIM_LOCKED, &pgdat->flags); + clear_bit_unlock(PGDAT_RECLAIM_LOCKED, &pgdat->flags); if (ret) count_vm_event(PGSCAN_ZONE_RECLAIM_SUCCESS);