From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B499E403150 for ; Tue, 11 Aug 2026 17:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786468190; cv=none; b=AtL+recnhc5Z7JhIY+bHVYqOTAGg1aOWdJ6ETJp3lguOJ0ABslWEsdTl28zRlJZ7XqqcZtenkolBuFcmqhHg3oAR39wWvOSGJ/edJqCGwXvxNCwOW6JOWj7MTYaIXvSOojiUaO+f4iEnGvJA9qM2tcxER27QwFYDse1azmw2ze8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786468190; c=relaxed/simple; bh=/rNmkE5pa807m0qgyUElVXX+X0nMXXu7lCL/yQ9Va+Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lgZrddfEMcjbSPGWpv9DJJsYSxKiatmG8kcfqLoNoqfDHswrqblp2CzWIJH5oz1xBbim1JpyyL92vSQFIPA1qZ4hTt5IsmA9GCwTlHNjbnhkjnOrNABjMggaMuP9fOpt9fh9iR84v2IdQSCTykoPdwaUwWWxE5oQHSMqYxfjgdM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=o6QLD4qJ; arc=none smtp.client-ip=209.85.216.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="o6QLD4qJ" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-38e88b60121so111733a91.3 for ; Tue, 11 Aug 2026 10:09:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786468186; x=1787072986; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=1d0Z6GiRpfaFJ122+PixKT54mSvnjy/SfDrP4mu65nU=; b=o6QLD4qJz2u+LciC/+AURcr4qUrmnxCxR0yyiVi/X34TEYCusFWOqEo1KptQeEHyta LTqN1xg7Qi2D4/6TOAuGUAzQkwkyh2Qj5riBs+Pxtr4b5hgoM8iabuR4fi4rvGcPk3my Cnt7ePlLmNSBVKI9Itc8g6eFpWyzJmffQHTEwVQBsTJUBBECst7B5vtUddP65Z1VkvTk 68OdTj97ei2f6Ca8ju8cEPW1ECyY+Otq9gujD4jVvNE+cFN+79o4S/G5Hi0T+lcIqLOJ kMzik+dAiYzaE2prNBIWZVOCTHSmFrHBROsI8IhQOCXNHnV+XtgyaFgr8KEFC9tspJo6 QQcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786468186; x=1787072986; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=1d0Z6GiRpfaFJ122+PixKT54mSvnjy/SfDrP4mu65nU=; b=EDX/SO4dB9Dst/b1EfRVidKv4ucZXG8V4J2jyED2TSknoIzq0qWRRiZJu0b22OrWQj 3r2cMJqf0ck8TC+0iuMsphOfd042prm1oGn8ifSKLnTlTgbKvM4/tF8m3r9YlZxgWFiK reqYttism5kK/wKDqw+E7ZpQ/oyY+loRXIn/dXR76uDJfrevRLceIyEavctEzetYzpEE BlaRWXppw4v1TVnIL7VpQHdchwyk90dhS02fZktMPLBJ+QAXv5yVZpasa2hZ1vEQoD36 zaV1WuMGICJ4HANUK8i4hQTefBDdnNdvtYI19lCNrjEUAx3E21J18AFDPmK6Paa8A8Hb yTKw== X-Forwarded-Encrypted: i=1; AHgh+RoF9vOcNvjWGpUgG9fIrh96AQ3rP2iunFVvQrXEaUrSEUe2Pfec8l+WLoY8sJNM7l2Nq/Ti2R3DI4d/KCQ=@vger.kernel.org X-Gm-Message-State: AOJu0YyzB655d4v0qtvoiBkH5tyrRG8ropm0eZD0EqMpAQk51uvqJ1nZ 1BdGoJo19/t6QXMsB1tQ9sYUlS7KjCOkah+PEHsXujfN0rRvML7F2Bnx X-Gm-Gg: AR+sD12PHKp/cbdd3QgEOsIWm5h6iz29Nr3IZdRxdV8XG8VqVBIHNa8fCvZ7Nt/PbuX 9UA608lNvJnasTU8Xk523kq01Y/CYg4iRpKRt9dXhY9Gn8w4Dlkl/4Y/DRlj/PUliOxtP/+FFTh ozZKGiXmgF0I2HB/5CQsOfVB0C+to7FNClVE9Pq9RETlpefnHZIrGvr0le/HcCf776euxrjbVdN rgRe3c6SSjf8YuDsoMo9yNb4bfGnNgURMKS/wYtm+9BdpKoR9pSWtMstG3ovyyypAYVXs1Zncpa 7dHzR60+hSe+3MlNPAlL+vsrxutdJqtCXM8Ge08Y9e5zAUXD+HihfAVrx6b4RkiwLsOCKrQivFW siANFyoiPplBzHf+ijXtm03a4fACXy400VFjCCH3hnX5UDUopQ0hrHDs/Cgfl/MUdTMRiTaJhxj /NPWrocS3OuFrNUHNB1WMw//DoHoipOT7cSf9xCdjTiMQRRCYh/TDhhb2aKZjTOrN/SKAXuV36f 5njeQCpItTcw5sVTdc01Kk5BlzdMbPiSqI= X-Received: by 2002:a17:90a:e7c6:b0:38d:e0c4:c955 with SMTP id 98e67ed59e1d1-392ec626baemr5074302a91.15.1786468186142; Tue, 11 Aug 2026 10:09:46 -0700 (PDT) Received: from KASONG-MC4 ([101.32.222.185]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-392f88d239esm348021a91.6.2026.08.11.10.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 10:09:45 -0700 (PDT) Date: Wed, 12 Aug 2026 01:09:28 +0800 From: Kairui Song To: Youngjun Park Cc: Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Jianyue Wu , her0gyugyu@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/4] mm, swap: drop the swap cache guard and reclaim in swap_free_hibernation_slot() Message-ID: References: <20260811132209.2862708-1-youngjun.park@lge.com> <20260811132209.2862708-5-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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260811132209.2862708-5-youngjun.park@lge.com> On Tue, Aug 11, 2026 at 10:22:09PM +0800, Youngjun Park wrote: > Both are there for a folio that readahead might have put on the slot. A > hibernation entry is not a shadow and has no swap count, so the swap cache > turns it away and 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); Nice to see this gets cleaned up. Acked-by: Kairui Song