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 2F15D25525C; Thu, 17 Apr 2025 18:33:08 +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=1744914788; cv=none; b=bOmKgQlKkuxBOP3zWghWWKZU/4D0O1lSQ6gd1fbkoxEXlcnKiFYGiEztQh7QNwgsOKAmYq4Y9xgT4NKP+fvXa6hQJVlE10dd96rNqe69csghCMaJmVnFmYEOu7YzMqabp3RA+DGwLQCqKuQsXmrsoZLzg1EcPrFdLl8agEWKRws= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744914788; c=relaxed/simple; bh=Cuvyt1wgGRlq1zL5z9Mj5j6CqPi6Ftuwvya84jQiCxc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ky/jDs5erf3bH9tiTP8jeS8kprLNF9kcnXI0xYHyABfkfdQXu9WGimwAkoO/kKA+DiatBDRAAO6mZ0th+9xX8nPYbBlheSLcZyq1Ul7fwRa34U/FrQo8+5pHqaX0yahv7BgTaNcvfUADIJ6RhbQXSX9R9Kipnr3epT+vQZPKeaM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LCqrILzW; 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="LCqrILzW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B330C4CEE4; Thu, 17 Apr 2025 18:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744914788; bh=Cuvyt1wgGRlq1zL5z9Mj5j6CqPi6Ftuwvya84jQiCxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LCqrILzWgubrmi5/JEhAsOpX3wupBNTVFFKbHKkBogAxkW1ELDhTcmL3mB3lK70YX OFUix3yKlhHtxklB3eoVJ7RwhtT3v412Bl4LE4q3ioEdM1gqxBWpjuCmnj194iu7NQ O/0nsnEqO33RrX56pN0ac8nTUFjLG55jDU8yWEo4= 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.13 330/414] mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock Date: Thu, 17 Apr 2025 19:51:28 +0200 Message-ID: <20250417175124.702785503@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250417175111.386381660@linuxfoundation.org> References: <20250417175111.386381660@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.13-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 @@ -7571,7 +7571,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);