From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lgeamrelo03.lge.com (lgeamrelo03.lge.com [156.147.51.102]) (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 386B24314A0 for ; Thu, 6 Aug 2026 19:21:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.147.51.102 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044100; cv=none; b=XrNM5HxHukNj6arg07mltpxcP/Tfn7yjXJCXNhKxJdFajY6Hq5/jca00xjPUaaxClFxHeiZhtD99H9e+YDJmeWgDUxbJ899H885tcerBMHKDzasQEwZgO/5t2z5Ipkokv/Z3bMxOIky1YCBdfpg8iZmn52esiCNf1XXlfjCD/K0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044100; c=relaxed/simple; bh=eamNiRxzzAgCNKSmJb42LRvczYR/SnxQ2Z3nQrPmBNo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=G1/aXnzQiXBm6aDp5M4cpNSBwd18SOWTAQHv7DzYeepo0qbvdekAswLnBvL8LKYHxSnI/jIERop1LRrgQNWphNYeTaKkjVKPkuHxyRJN7SfV1W3rE4Lh9wZfBu+a0IFASOzDo3zLd3IHAX9Ehtk+ZndTPsVmyoxiTIzdrkuepV8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lge.com; spf=pass smtp.mailfrom=lge.com; arc=none smtp.client-ip=156.147.51.102 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lge.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lge.com Received: from unknown (HELO yjaykim-PowerEdge-T330.lge.net) (10.177.112.156) by 156.147.51.102 with ESMTP; 7 Aug 2026 04:06:36 +0900 X-Original-SENDERIP: 10.177.112.156 X-Original-MAILFROM: youngjun.park@lge.com From: Youngjun Park To: Andrew Morton Cc: Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Jianyue Wu , Youngjun Park , her0gyugyu@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] mm, swap: drop the swap cache guard and reclaim in swap_free_hibernation_slot() Date: Fri, 7 Aug 2026 04:06:36 +0900 Message-Id: <20260806190636.446205-5-youngjun.park@lge.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260806190636.446205-1-youngjun.park@lge.com> References: <20260806190636.446205-1-youngjun.park@lge.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Both are there for a folio that readahead might have put on the slot. The previous patch turns these slots away at the swap cache boundary, so no such folio can exist. Signed-off-by: Youngjun Park --- mm/swapfile.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index a337387f7431..4fba1770ce61 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2203,18 +2203,8 @@ void swap_free_hibernation_slot(swp_entry_t entry) pgoff_t offset = swp_offset(entry); ci = swap_cluster_lock(si, offset); - /* - * A slot with a folio in the swap cache is freed when the folio - * leaves the cache, the same rule swap_put_entries_cluster() follows. - * Readahead can put a folio here, and freeing the slot now would - * leave that folio with no entry behind it. - */ - if (!swp_tb_is_folio(__swap_table_get(ci, offset % SWAPFILE_CLUSTER))) - __swap_cluster_free_entries(si, ci, offset % SWAPFILE_CLUSTER, 1); + __swap_cluster_free_entries(si, ci, offset % SWAPFILE_CLUSTER, 1); swap_cluster_unlock(ci); - - /* In theory readahead might add it to the swap cache by accident */ - __try_to_reclaim_swap(si, offset, TTRS_ANYWAY); } static int __find_hibernation_swap_type(dev_t device, sector_t offset) -- 2.48.1