Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp944876rdf; Wed, 22 Nov 2023 00:52:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAM9tEYlisRnuzu2s2sb2Pcnyy1UmvnZ9CjM4BAGMs/8VTmvgzksjUiFke0frJ4mxHzYZV X-Received: by 2002:a05:6a20:7f94:b0:180:1b3b:d560 with SMTP id d20-20020a056a207f9400b001801b3bd560mr1856317pzj.41.1700643172140; Wed, 22 Nov 2023 00:52:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700643172; cv=none; d=google.com; s=arc-20160816; b=V7w+zf4V32BHhP6VncOav5zYyFqPst+/Rn74OCB3CqSTWOzWQNE3CGWEzEj1akBun3 zR9kCCoTG6sm1kmO+5NaJBC3A7fpHIKi+sK/RweYce+I6qzivL7n2x6/z3sWBXIsfvmf dTRupn12SR8MP3xhQba/abQCxVVPZj2Kagwx3P3b9q6WaySkV6HAPnkahXgTDcd6H6ZP Ci0cbQa8xc6Mr41Uv/AOMBqutFTrQZoi2xQkqxhbjx0aThqt9knjM+D6L9yz9LQw8ttJ 8tuqM8FptiZs83cBevIFZkWfWgdyv4HFjQ+t0ZUPRieSVp0jtiij3Lnkl89wDUDneCVH gThQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2mz72/0LNu+bIFSthGKo7T7+u/FI1qMvNujptLPaEzM=; fh=RbnbhuYXKa/9qKPDyfVFPNCeUkaXve1DAFBQDETWjkM=; b=rE4ovluKfMcEXb/VmB3SOJ34tuGK0u7X6GL59TaDhY5WVWFqfcOVO820/1wqq3bu1Q 4QzCDeN0YYwnlw+eNlS7szmch5rhvpgV220HGIXdt5VUMp8xDjHYbvUMXb9A7S8GiiIb 6xp10zNVjRwWpjkKnqbXS+Fdlqs99vHFagbpWKmZwH5l5JQ12ZvS1ewYHyYop9HRrOMh n9yRNNcbb7lmwPUUCLRGKXwUmTNBIBwGjh9hIclhCJ1VybBdiDW7nA0Ew72Nz9yBF1JF 1hMihwv5/WE0QdTFbnlCfhQuqlJJwFqwCRSxMeWQqCXTd6B58dbkKE+0ZVtQuK5iq/HP RvIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=C5+T2qlz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x13-20020a056a00188d00b0068fe0f46f27si12876618pfh.171.2023.11.22.00.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 00:52:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=C5+T2qlz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E634D81B895D; Wed, 22 Nov 2023 00:52:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230267AbjKVIwu (ORCPT + 99 others); Wed, 22 Nov 2023 03:52:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbjKVIws (ORCPT ); Wed, 22 Nov 2023 03:52:48 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B925FF9 for ; Wed, 22 Nov 2023 00:52:43 -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 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: Authentication-Results: smtp-out1.suse.de; none X-Spam-Level: X-Spam-Score: -7.80 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.997]; 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%] X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 00:52:51 -0800 (PST) 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