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 E9B64C433FE for ; Wed, 30 Nov 2022 05:40:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B6D46B0074; Wed, 30 Nov 2022 00:40:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 367126B0075; Wed, 30 Nov 2022 00:40:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22EDC6B0078; Wed, 30 Nov 2022 00:40:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 14BA66B0074 for ; Wed, 30 Nov 2022 00:40:16 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D56BD40B1D for ; Wed, 30 Nov 2022 05:40:15 +0000 (UTC) X-FDA: 80189007990.08.C026B45 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by imf19.hostedemail.com (Postfix) with ESMTP id 3A41C1A000B for ; Wed, 30 Nov 2022 05:40:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669786815; x=1701322815; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version; bh=7bushIMDrKj/fAEl186WlCQe8w0m5wH7S69eqHtJo14=; b=Z+B+xfcGxlMwmdQt5KrYIYjlAgYreTSsie8VhzpVaDexgAu45jSXsNxh kmcm7AJA/Is3HZd1K/WMj7N6XoGGhvK+8vLldAHlQXqOujdF1Etnhhc9K SD07Mz5CfrEibDO7/aGOonCPX8Vmc9lJv3S9jPl8DHt+iXbwUuhm8l9iI 1/87x9wgwaFZBHUJ1Qqoz5QPFHF93Bb31s7R3NBmL8lGz+vLCqLzQ0Pej nPBPwKak0uWCDB2MC1KG21tsoK+QtLypAURNLPWK9+5futb+cS0L6SzYC MV0l8H0VhxGvSaExXRlhIadflNRZAoB7M7nS1YezEPUUjX7kwlT3gZL0A w==; X-IronPort-AV: E=McAfee;i="6500,9779,10546"; a="295005343" X-IronPort-AV: E=Sophos;i="5.96,205,1665471600"; d="scan'208";a="295005343" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2022 21:40:13 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10546"; a="768706794" X-IronPort-AV: E=Sophos;i="5.96,205,1665471600"; d="scan'208";a="768706794" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2022 21:40:09 -0800 From: "Huang, Ying" To: Mina Almasry Cc: Johannes Weiner , Yang Shi , Yosry Ahmed , Tim Chen , weixugc@google.com, shakeelb@google.com, gthelen@google.com, fvdl@google.com, Michal Hocko , Roman Gushchin , Muchun Song , Andrew Morton , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH V1] mm: Disable demotion from proactive reclaim References: <20221122203850.2765015-1-almasrymina@google.com> <874juonbmv.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Wed, 30 Nov 2022 13:39:19 +0800 In-Reply-To: (Mina Almasry's message of "Tue, 29 Nov 2022 18:14:49 -0800") Message-ID: <87edtlatmg.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=Z+B+xfcG; spf=pass (imf19.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669786815; a=rsa-sha256; cv=none; b=lZByofWuzTjpgM6Du3vR+mtNBUzvjYNwyOjFb0gFGMhrlc7xfV8vD3iI9gwk0x93pAoRZG Dl53F6GuhidEDBsSCdkWNtH+dZ12n/bs0GA3+16jLKdNNZKLSeHrWbNVrZij713HJzUdqp xkl6Qu+s+Tk4DyYgW3CBvNl05TuKB9M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669786815; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iOmdX8AQL2rwkOmRsWDc2zLV8pXXNbUFZHlK55XDAow=; b=n1WADO0HXa23HUBWrMeAXc/nM4iaX+R0NLsuzJ1FFLy4lgI2HpO+hix1ru5EFva/PgvRcv 5uAV0ccy4JbDIng9/hnI9YSFe85251IpxNi16lJaM2/yEUiArXuNJXdjz+GYiqQk1FIKL1 wGAEI62slUyLaXeribVu4DsOPZAZvMU= Authentication-Results: imf19.hostedemail.com; dkim=none ("invalid DKIM record") header.d=intel.com header.s=Intel header.b=Z+B+xfcG; spf=pass (imf19.hostedemail.com: domain of ying.huang@intel.com designates 192.55.52.136 as permitted sender) smtp.mailfrom=ying.huang@intel.com; dmarc=pass (policy=none) header.from=intel.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3A41C1A000B X-Stat-Signature: s4hj1h4aphe57quzx7pm5i3zrqyjoj1x X-Rspam-User: X-HE-Tag: 1669786814-132148 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Mina Almasry writes: > On Wed, Nov 23, 2022 at 9:52 PM Huang, Ying wrote: >> >> Hi, Johannes, >> >> Johannes Weiner writes: >> [...] >> > >> > The fallback to reclaim actually strikes me as wrong. >> > >> > Think of reclaim as 'demoting' the pages to the storage tier. If we >> > have a RAM -> CXL -> storage hierarchy, we should demote from RAM to >> > CXL and from CXL to storage. If we reclaim a page from RAM, it means >> > we 'demote' it directly from RAM to storage, bypassing potentially a >> > huge amount of pages colder than it in CXL. That doesn't seem right. >> > >> > If demotion fails, IMO it shouldn't satisfy the reclaim request by >> > breaking the layering. Rather it should deflect that pressure to the >> > lower layers to make room. This makes sure we maintain an aging >> > pipeline that honors the memory tier hierarchy. >> >> Yes. I think that we should avoid to fall back to reclaim as much as >> possible too. Now, when we allocate memory for demotion >> (alloc_demote_page()), __GFP_KSWAPD_RECLAIM is used. So, we will trigger > > I may be missing something but as far I can tell reclaim is disabled > for allocations from lower tier memory: > https://elixir.bootlin.com/linux/v6.1-rc7/source/mm/vmscan.c#L1583 #define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM) We have GFP_NOWAIT set in gfp. > I think this is maybe a good thing when doing proactive demotion. In > this case we probably don't want to try to reclaim from lower tier > nodes and instead fail the proactive demotion. Do you have some real use cases for this? If so, we can tweak the logic. > However I can see this being desirable when the top tier nodes are > under real memory pressure to deflect that pressure to the lower tier > nodes. Yes. Best Regards, Huang, Ying >> kswapd reclaim on lower tier node to free some memory to avoid fall back >> to reclaim on current (higher tier) node. This may be not good enough, >> for example, the following patch from Hasan may help via waking up >> kswapd earlier. >> >> https://lore.kernel.org/linux-mm/b45b9bf7cd3e21bca61d82dcd1eb692cd32c122c.1637778851.git.hasanalmaruf@fb.com/ >> >> Do you know what is the next step plan for this patch? >> >> Should we do even more? >> >> From another point of view, I still think that we can use falling back >> to reclaim as the last resort to avoid OOM in some special situations, >> for example, most pages in the lowest tier node are mlock() or too hot >> to be reclaimed. >> >> > So I'm hesitant to design cgroup controls around the current behavior. > > I sent RFC v2 patch: > https://lore.kernel.org/linux-mm/20221130020328.1009347-1-almasrymina@google.com/T/#u > > Please take a look when convenient. Thanks! > >> > >> >> Best Regards, >> Huang, Ying >>