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 01A4C1A3178; Thu, 17 Apr 2025 18:13:20 +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=1744913601; cv=none; b=s5ZG+X/nh+og22Yq1P8ZPGw7OvkU2Gc9GMl2WEQTlLD8xavY0OUKq1ZEtZgTXeKWLza56rQsyAAQzZZLX74F+hzVoGPT2AC4CFKojI7fcje2+g1ZIK2Y0UVte6Cumk6ym6x38Kf1Y/jc67p2xbcLsiZIs6rll2DgZNND52E9R/8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744913601; c=relaxed/simple; bh=lFV6f4YSmfWkhH8H5CJNo+i6pJ9IXmVF2HA+NsWJj3Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YKW5+UyQntQ5oj8Sqer5wWlsPdVNvrhyJSrBk+G8AfzXLMsgSSPVkg/Ru8Im0GLUfQpFwsL9A2XxKEBEhYrjw9foKDfJwaR4KZ2zI4BJrSeT3AlL19BAv0136YOVRNVySMiDJjp9ncYtFhYJxOjJ7c7zDVAwKVFcCQC74zMiZnw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YEqNAzT9; 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="YEqNAzT9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C101C4CEE4; Thu, 17 Apr 2025 18:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744913600; bh=lFV6f4YSmfWkhH8H5CJNo+i6pJ9IXmVF2HA+NsWJj3Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YEqNAzT9Pqw7KH4DOOqq0HZ09PZSfyQYT53M2aoaI61+f4JreAopWQknDPBFWappM twZYd01+R69S+4smDtmZ4qtO7+0d2YfDSUb7b/LXkRkoiZFhUke+J0nBdMMs/met0Q QORr45QQnOthMZGtkRKc2qwaJdG754gfhAryINq8= 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.14 362/449] mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock Date: Thu, 17 Apr 2025 19:50:50 +0200 Message-ID: <20250417175132.801372216@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250417175117.964400335@linuxfoundation.org> References: <20250417175117.964400335@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.14-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 @@ -7580,7 +7580,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);