From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99272C61D92 for ; Wed, 22 Nov 2023 08:52:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2276A6B052F; Wed, 22 Nov 2023 03:52:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D5A36B057B; Wed, 22 Nov 2023 03:52:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C5A66B057E; Wed, 22 Nov 2023 03:52:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id F07856B052F for ; Wed, 22 Nov 2023 03:52:46 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C19B21CB59E for ; Wed, 22 Nov 2023 08:52:46 +0000 (UTC) X-FDA: 81484974732.29.E52F2F5 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf13.hostedemail.com (Postfix) with ESMTP id A688A2000F for ; Wed, 22 Nov 2023 08:52:44 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=C5+T2qlz; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf13.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700643165; a=rsa-sha256; cv=none; b=Hcd0cVqJuc62ZZaySQxIRSVEYEOl4xqX1YbwcIbIh7pyCHRpBucHRwn9G65q6BCcxCSqJf 6UyUi2RP3xt+OObSGyUKU4AZx7fgAo+IcDsXjDgotBeGV1SJKGFmopqKHsJF1hZpnq3bfc ofGH/AM9FX4QnQM9Z+26Pcm4FRMsu8I= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=C5+T2qlz; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf13.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700643165; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2mz72/0LNu+bIFSthGKo7T7+u/FI1qMvNujptLPaEzM=; b=TvhTn+V4WI9w2iSmwxGYjljkhmCuHX75/ejw5GIn7MTeYsxm6JiBeJfQ+ZPsRTXR9XPLXn /ZWnkQu9O4n73BEcilhc8eS5uq/wmC9o3lFlfLPmRyJ6vLDXPS2M0Fzuziwi5aNvTm2zSK CdWWo5JfffkZxYm2kQaUddGHP4qI/yg= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4708621892; Wed, 22 Nov 2023 08:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700643162; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2mz72/0LNu+bIFSthGKo7T7+u/FI1qMvNujptLPaEzM=; b=C5+T2qlzNJFAC60Ee9b6iI/4vzhtDlTPtRrXFH4s5BWkBeVy9J9yWsBn0BJNc4HoyjKuaw x4SQ6urKn2C8/ibjIr1tGziXb8lQ/jRhYUjYihOiNUIzzlDiGSUZ23mmcAhQ6/WDg3uPXL 8qE/4nbVLYRaWm3t8vGRFiuKyx14AZg= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 16F28139FD; Wed, 22 Nov 2023 08:52:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VVosA1rBXWXiYgAAMHmgww (envelope-from ); Wed, 22 Nov 2023 08:52:42 +0000 Date: Wed, 22 Nov 2023 09:52:41 +0100 From: Michal Hocko To: Yosry Ahmed Cc: Liu Shixin , Yu Zhao , Andrew Morton , Huang Ying , Sachin Sant , Johannes Weiner , Kefeng Wang , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v10] mm: vmscan: try to reclaim swapcache pages if no swap space Message-ID: References: <20231121090624.1814733-1-liushixin2@huawei.com> <32fe518a-e962-14ae-badc-719390386db9@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: A688A2000F X-Stat-Signature: 473jedofw66356pdzh17ejry4op3byk4 X-HE-Tag: 1700643164-298664 X-HE-Meta: U2FsdGVkX18c3LSswc35t35drLYz+nyjmDVtQFU5ggVUFG31oya0/5bufS9DUxj82CeaTWs5bxJ3n/rDwIZ1iNJrFY+G5PvTt1PM6XkYlTruC88m3SHJ9deEoxW1b2RKH8RHTA9Bx74t6Y2TYB07ebUBDXF/0uyJb7NYYz8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icity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue 21-11-23 22:44:32, Yosry Ahmed wrote: > On Tue, Nov 21, 2023 at 10:41 PM Liu Shixin wrote: > > > > > > On 2023/11/21 21:00, Michal Hocko wrote: > > > On Tue 21-11-23 17:06:24, Liu Shixin wrote: > > > > > > However, in swapcache_only mode, the scan count still increased when scan > > > non-swapcache pages because there are large number of non-swapcache pages > > > and rare swapcache pages in swapcache_only mode, and if the non-swapcache > > > is skipped and do not count, the scan of pages in isolate_lru_folios() can > > > eventually lead to hung task, just as Sachin reported [2]. > > > I find this paragraph really confusing! I guess what you meant to say is > > > that a real swapcache_only is problematic because it can end up not > > > making any progress, correct? > > This paragraph is going to explain why checking swapcache_only after scan += nr_pages; > > > > > > AFAIU you have addressed that problem by making swapcache_only anon LRU > > > specific, right? That would be certainly more robust as you can still > > > reclaim from file LRUs. I cannot say I like that because swapcache_only > > > is a bit confusing and I do not think we want to grow more special > > > purpose reclaim types. Would it be possible/reasonable to instead put > > > swapcache pages on the file LRU instead? > > It looks like a good idea, but I'm not sure if it's possible. I can try it, is there anything to > > pay attention to? > > I think this might be more intrusive than we think. Every time a page > is added to or removed from the swap cache, we will need to move it > between LRUs. All pages on the anon LRU will need to go through the > file LRU before being reclaimed. I think this might be too big of a > change to achieve this patch's goal. TBH I am not really sure how complex that might turn out to be. Swapcache tends to be full of subtle issues. So you might be right but it would be better to know _why_ this is not possible before we end up phising for couple of swapcache pages on potentially huge anon LRU to isolate them. Think of TB sized machines in this context. -- Michal Hocko SUSE Labs