Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp900434rdf; Tue, 21 Nov 2023 22:59:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFL5/D/Eup4cefXx6i8QbRFvFqq3FVrCVFIjPukIuZB7tcG9Z51GkgLzl5vH6nW4BF96RMn X-Received: by 2002:a05:6808:3cf:b0:3b2:c242:aaee with SMTP id o15-20020a05680803cf00b003b2c242aaeemr1698397oie.42.1700636384315; Tue, 21 Nov 2023 22:59:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700636384; cv=none; d=google.com; s=arc-20160816; b=ibTZZ118Dxi/hezMQYSUngIu9TRFOWbw+yKGFccOQGb/LHha+8EBYHqa1eOs5YUYdq 05qbyYULq7sisavbv+k6xGh94tk3x5Vid5pcM+f+RTghxxRSzUMVPejNu+s9T88j9k2K dVLX2h0FiQMcxKIHVo4f0eMrnxVUKcidsMtnmejEs8Jx+Br7mYk1Hk5QOoO2/4QjiYdA ToIm761ilyuo1jDKETBxd/HeY2I8+TpmeDxwQZGxHgEAJfNOhOAj82HV4veLUdDtV4kS 1LnZPfN1bMem2k+/bkn9HcN8i3wczt2uBMcDwPOPR/H1L1ZZ5kavpb/QoO/AJKk5FkES kQww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from:dkim-signature; bh=1yKCr1gZf/1+mzHQUHs4Lki04Yt/Cz80ldRP8TYO6tQ=; fh=hpT9xzLFNmnpzWpUC7Qf4sVoBURb11UzZ/pb94v1iyQ=; b=AN4Lyh4wbPdnxLuZYJa4zeuRl49bgwrAVshPeqIUaAVI04zIOleakeZkdLCWv+6sMD OpazVX60EI4328/X6J81KGtP0llYypqN1yFdEDw4XhsG6bMlQuJS/HidszvvdODCe+nl Xbsfu3nc2ol8b50+Rwu3QfA36UoMsafh1O8Bpk1JBYZ3fznTlOYfx93TxsEEJb653ERI N35GdZbzl5rMVsPIsy982mU5L1V1c3FBUomaMbGkv51DXwQWNb9hMU16Oirnscrj3oXy GA2zEd4wOBHsy7ZWqI+2HRrKxGRQmLqSNDcCevkhGHAK+24mJR8pk8WWGuzWYZEo+jGK ea/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=USNUWDQn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id w9-20020a63d749000000b005ab45ee3e7esi11200935pgi.299.2023.11.21.22.59.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 22:59:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=USNUWDQn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 68BCB80D6539; Tue, 21 Nov 2023 22:59:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230137AbjKVG7d (ORCPT + 99 others); Wed, 22 Nov 2023 01:59:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229931AbjKVG7c (ORCPT ); Wed, 22 Nov 2023 01:59:32 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9770DD for ; Tue, 21 Nov 2023 22:59:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700636367; x=1732172367; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=lz4P4yyNksj4DKVXnTX7lbEklY3XdyKKBLRol+9exJI=; b=USNUWDQnEtbpf2dsMZt23opzeb0UI841eGE1fkFAEXm64V61RrRVxQje DrhYpQXYoNhznYJepTGy5smZHDvp8QZoYk0ONcJlzkjF3WipWpqvnzHFb OOxGAnpNIkCxLejZ89+RM0aX3UZ8cf7ptDwcK2UAlQfo4Vr6DjSay+h18 rRvAivUIKuUurwJmIk3iwBqN9n0UnZUtu1EeOeA+2d8Z7B58UbZjDhxHy swFhCG1RVZwUhLxF/wuRSbMn5mV/qW2hbBA3CWIvgRPUBWaLd2bFUVY1Q 9oFeTMXoYLm9DCfUyojSNp3de1irlImpLa+ijeK6adOWYCzo7Fxp3SRNs A==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="13547314" X-IronPort-AV: E=Sophos;i="6.04,218,1695711600"; d="scan'208";a="13547314" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 22:59:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="832913554" X-IronPort-AV: E=Sophos;i="6.04,218,1695711600"; d="scan'208";a="832913554" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2023 22:59:24 -0800 From: "Huang, Ying" To: Yosry Ahmed Cc: Liu Shixin , Michal Hocko , 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 In-Reply-To: (Yosry Ahmed's message of "Tue, 21 Nov 2023 22:44:32 -0800") References: <20231121090624.1814733-1-liushixin2@huawei.com> <32fe518a-e962-14ae-badc-719390386db9@huawei.com> Date: Wed, 22 Nov 2023 14:57:24 +0800 Message-ID: <878r6q9sx7.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Tue, 21 Nov 2023 22:59:41 -0800 (PST) Yosry Ahmed writes: > On Tue, Nov 21, 2023 at 10:41=E2=80=AFPM 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 s= can >> > non-swapcache pages because there are large number of non-swapcache pa= ges >> > and rare swapcache pages in swapcache_only mode, and if the non-swapca= che >> > 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 sca= n +=3D 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 =3D PG_owner_priv_1, /* SwapBacked */ PG_swapcache =3D PG_owner_priv_1, /* Swap page: swp_entry_t in priv= ate */ -- Best Regards, Huang, Ying