Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp2865408rdh; Mon, 27 Nov 2023 00:14:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrdgbpaK+3vXdQ1ZISvHpvofA0GxEuexqqPBpp3YGtMy9nQiR30OFckLnoKNNkGQPKL0IZ X-Received: by 2002:a05:6830:2012:b0:6d6:3fca:db0c with SMTP id e18-20020a056830201200b006d63fcadb0cmr12107585otp.18.1701072855784; Mon, 27 Nov 2023 00:14:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701072855; cv=none; d=google.com; s=arc-20160816; b=mguzhovn6Fcd2j+8/SVNk5dHTvNHYwcBdZ13yIApbmw+p/CrGydWzWOqPqUg9uQG0l 5YMMa0Dyt2fT2jd0Bgwutmrbom4CxegDu192E6ojdpfkmsg8V+/in0y37KZ1fgWU1b3U nj+EGS9mFv+4PAfWi7KCmW9D08iG332w0k94V12+h0nUxFOdE6q71xE1xVliefZ6J6yu YXZ9beFAk7BCoFbnbu6/fZeDG+z7SB4inFRhr2GRflb0VAr+YFSRswhar+p32j7rE+H1 3rT1YDDuGoJdQwgNwW5yiBEQHkDMIJbSMRdL4yRZRxTzj1W5gv2MWlpb0JfGVFo/iJNo bf4A== 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=Gwrbmwqj22dZQcUFeolhEXpQccpz9WINwGmmOJEIN/c=; fh=zH0dKo+DBBdNhJ6nduZF6FzCBQGn0FT3P8gyt8AjxSQ=; b=iUlbLNb91f52XD7fZevBgrib2vWClWhJ45sxvrJDUKsxDOjvFIyEJfp3cKXeps08NR Fr6GzF6RzZ/D7s2rMn5P8XAxV2HGq8Sih9bNArQVIxjhAFAZgBM/UT2oEg58vcBPIVO4 JjgrVh/uvO8QsH9hZphZo4xxJKiKHKLpOltpds0oJBY5GHApUmVNRj57J/RT2nXO1ZpV LUTGv8FP6B9n99iRVRsO8dBEi+RXaTXeaSEpKK9uPhvNNtTz1v3K3LBUdNksEDHjtR4b CjJMfxQe5bmqnI9M2r5mFDTlNn4zfJ3znDA88l6MVkH/7CJfRfveUIJfwsrwWgpUTptU WerA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EygwzVfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id w19-20020a634913000000b005c1b289757dsi8749611pga.88.2023.11.27.00.14.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 00:14:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EygwzVfr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 079FB8047469; Mon, 27 Nov 2023 00:14:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232390AbjK0IN4 (ORCPT + 99 others); Mon, 27 Nov 2023 03:13:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230173AbjK0INz (ORCPT ); Mon, 27 Nov 2023 03:13:55 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAE9113A for ; Mon, 27 Nov 2023 00:14:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701072842; x=1732608842; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version:content-transfer-encoding; bh=/gVTlgLrTSDTMo/7KNUnEHr8qrr6Id/gcu9gUpWeGvQ=; b=EygwzVfr+UYwPzAfocbZ3vmfO+4NaqJMujWgkEAUP/exLbBnpHwKDZ8X m+QGxcJFSU6Xj9ISjhy6xZya7uL4EytErgSNvOWo8ZdNcIKCRa0+TCgDC IwUciyNX3KZa6SLg4lconOxNdz7twlx/GsoPRqHb7qzC3bCCLirtehxcB A39Q2OrU7gbkvt2W6z+aTe7CrnNl1FZIbn1L4PKDo9cMz+E0YQiFxh+MT dEvzPGDGE9z0z7S4TgrGIrHSU7U/pwunGQ3/ey2nLgvdUvhWq3OncJpUE K83wDwB0U1dyR+0ZIZKaDMoJaC1QIYZZb3+fHj+72F3bwrW2F47wlCVqX w==; X-IronPort-AV: E=McAfee;i="6600,9927,10906"; a="11356536" X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="11356536" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2023 00:14:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10906"; a="768101582" X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="768101582" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2023 00:13:58 -0800 From: "Huang, Ying" To: Chris Li Cc: Michal Hocko , 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 In-Reply-To: (Chris Li's message of "Sun, 26 Nov 2023 23:42:11 -0800") References: <20231121090624.1814733-1-liushixin2@huawei.com> <32fe518a-e962-14ae-badc-719390386db9@huawei.com> <87msv58068.fsf@yhuang6-desk2.ccr.corp.intel.com> <87h6l77wl5.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Mon, 27 Nov 2023 16:11:57 +0800 Message-ID: <87bkbf7gz6.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 pete.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 (pete.vger.email [0.0.0.0]); Mon, 27 Nov 2023 00:14:13 -0800 (PST) Chris Li writes: > Hi Ying, > > On Sun, Nov 26, 2023 at 6:36=E2=80=AFPM Huang, Ying wrote: >> >> Michal Hocko writes: >> >> > On Thu 23-11-23 14:15:59, Huang, Ying wrote: >> >> Michal Hocko writes: >> > [...] >> >> > Yes swapcache pages are indeed more complicated but most of the time >> >> > they just go away as well, no? >> >> >> >> When we swapin a page, we will put it in swapcache too. And the page >> >> can be in that state for long time if there is more than 50% free spa= ce >> >> in the swap device. >> > >> > True, but why is that a problem? If you encounter such a swapped in pa= ge >> > on the file LRU then the page should be referened and as such should be >> > activated, no? >> >> This just means that anonymous pages in file LRU aren't temporary or >> short-term. So we need to consider that. For example, the original >> method to balance between anonymous pages and file pages need to be >> re-designed. The anonymous pages are considered hotter than file pages >> in general. > > I agree with Ying that anonymous pages typically have different page > access patterns than file pages, so we might want to treat them > differently to reclaim them effectively. > One random idea: > How about we put the anonymous page in a swap cache in a different LRU > than the rest of the anonymous pages. Then shrinking against those > pages in the swap cache would be more effective.Instead of having > [anon, file] LRU, now we have [anon not in swap cache, anon in swap > cache, file] LRU I don't think that it is necessary. The patch is only for a special use case. Where the swap device is used up while some pages are in swap cache. The patch will kill performance, but it is used to avoid OOM only, not to improve performance. Per my understanding, we will not use up swap device space in most cases. This may be true for ZRAM, but will we keep pages in swap cache for long when we use ZRAM? -- Best Regards, Huang, Ying