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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82834C61D92 for ; Wed, 22 Nov 2023 08:55:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229531AbjKVIzQ (ORCPT ); Wed, 22 Nov 2023 03:55:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbjKVIzM (ORCPT ); Wed, 22 Nov 2023 03:55:12 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFA1EE7 for ; Wed, 22 Nov 2023 00:55:08 -0800 (PST) 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 6DAF0218A2; Wed, 22 Nov 2023 08:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1700643307; 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=9EoQGFAtO5/cYeUaY+Oaom7nTtjpqsRwwEVt4XkmqR0=; b=uEBB4SXGz920+dgkLZ6bfRvDwouJI2BC8misLJkFkYB77VTWzT6WoJ07n/lFsMgbyZarrq 6R3und7SOMWPI2jUr+W+mnG4HRbmJi1lamKyIoWj7G30YPRrRTQR26P+B8rxM5tH0zJyMq +5GmYcjtykdGqD3zJz+5ZuTdcz3I9X8= 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 3FBFC139FD; Wed, 22 Nov 2023 08:55:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id PXYEDOvBXWU/ZAAAMHmgww (envelope-from ); Wed, 22 Nov 2023 08:55:07 +0000 Date: Wed, 22 Nov 2023 09:55:06 +0100 From: Michal Hocko To: "Huang, Ying" Cc: Yosry Ahmed , Liu Shixin , Yu Zhao , Andrew Morton , 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> <878r6q9sx7.fsf@yhuang6-desk2.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <878r6q9sx7.fsf@yhuang6-desk2.ccr.corp.intel.com> Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-7.80 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; NEURAL_HAM_SHORT(-0.20)[-0.998]; RCPT_COUNT_SEVEN(0.00)[10]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 22-11-23 14:57:24, Huang, Ying wrote: > Yosry Ahmed writes: > > > 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. > > We need to identify swap cache pages on file LRU firstly. It appears > hard from the current definition of page flags. > > /* Filesystems */ > PG_checked = PG_owner_priv_1, > > /* SwapBacked */ > PG_swapcache = PG_owner_priv_1, /* Swap page: swp_entry_t in private */ Checking along with folio_test_swapbacked would do the trick, right? -- Michal Hocko SUSE Labs