From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (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 61B38230BEC for ; Mon, 9 Mar 2026 08:06:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773043588; cv=none; b=eHKoXYP5W/PV9Aq9HU2IPSN0+yaKQ2RY437GWPPI+XLrvBkPxzTG8O/DX6Johbsxch8D/s0qlqJf6WQzK2lvDKxcL2REK+8wwJW9MkbOTUw/JU5Lc1JVotRsPPQleC5B9V9BnOwA4uVBxLaukI1XboL0UZqj71Pgdkd8NUsXuBo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773043588; c=relaxed/simple; bh=PE3iu2cJ2mC7yJvaAaGEhB5fB9xDJFak7ER5Hy/bkxY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=CddEjHdXA8sfom2KBaayLBQmMoveFwRwWv6lTbkNniJvbX0J+XtkIDJK1htq4IBeIKMdZTemJc1pyGOSQxGiMv82v7GtyyGm/2SUMEd3kJBQsEhmwhwgp8hTM1144tDgGao/c5Qhx+QKCbnFjIAEJkcmKr/t3VxxxtmARR773Vs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=M/zHX531; arc=none smtp.client-ip=95.215.58.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="M/zHX531" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1773043584; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=+FqI0gHA031QQBMAtt9J8dHkFUnPoZqRMUQFOrt22u8=; b=M/zHX531aYs9dkvPc46Rnm+wa2XLzC7x0M7Tob0MInfGZICR0HI23cv6nLNX13Ea1lQixy ixR3pWpSVVFubOendXpGNvSFOdP5A91RBRjjTX2XwjOqkCKf5546ZPrAiWl99+wN7RISLg s8yE95KjPAAm/w3Pw/TXCfqErv7rIV8= From: Hui Zhu To: Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , YoungJun Park , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Hui Zhu Subject: [PATCH v2 0/2] mm/swap: enhance swap cluster allocation checks Date: Mon, 9 Mar 2026 16:05:40 +0800 Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Hui Zhu This series enhances safety and debugging for swap cluster allocation paths in mm/swapfile.c. Patch 1 adds a VM_WARN_ON in isolate_lock_cluster() to verify that full clusters (which should already have allocated tables) are not processed by swap_cluster_alloc_table(). Patch 2 adds lockdep_assert_held for si->global_cluster_lock on non-SSD devices and adjusts the assertion order to match the actual lock acquisition sequence. Changelog: v2: According to the comments of YoungJun Park, Kairui Song and Chris Li, change acquire locks in swap_reclaim_work() to adds a VM_WARN_ON in isolate_lock_cluster(). According to the comments of YoungJun Park, add code in patch 2 to Change the order of lockdep_assert_held() to match the actual lock acquisition order. Hui Zhu (2): mm/swap: Add VM_WARN_ON to isolate_lock_cluster() mm/swap: Add lockdep for si->global_cluster_lock in swap_cluster_alloc_table() mm/swapfile.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.43.0