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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36633C433ED for ; Fri, 16 Apr 2021 14:26:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B5FFB610FC for ; Fri, 16 Apr 2021 14:26:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5FFB610FC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0F0F16B0036; Fri, 16 Apr 2021 10:26:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0A1126B006C; Fri, 16 Apr 2021 10:26:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5D436B0070; Fri, 16 Apr 2021 10:26:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id BD0356B0036 for ; Fri, 16 Apr 2021 10:26:47 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6CDC1180458E8 for ; Fri, 16 Apr 2021 14:26:47 +0000 (UTC) X-FDA: 78038456454.16.461F2C9 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf05.hostedemail.com (Postfix) with ESMTP id A831EE000108 for ; Fri, 16 Apr 2021 14:26:45 +0000 (UTC) IronPort-SDR: oaAhsNsIAFwi/yOAf0BaTUPPMrDyIyhWh1q+4iqFjVTZpU+EfpHBXibFiqS3bd1fNkxQnYLeNw 5WnbChPa5fHg== X-IronPort-AV: E=McAfee;i="6200,9189,9956"; a="175153613" X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="175153613" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2021 07:26:44 -0700 IronPort-SDR: 0w32KQlFl1AWpDccPudMMQAdGFtLJ9GaOahaij1O3FWLPpbn3ABJ1uRjQ14OetOX/aI9NTMwzM 5c7qEWokIu1A== X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="453355311" Received: from mhsedler-mobl1.amr.corp.intel.com (HELO [10.212.149.97]) ([10.212.149.97]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2021 07:26:44 -0700 Subject: Re: [PATCH 00/10] [v7][RESEND] Migrate Pages in lieu of discard To: Michal Hocko , Dave Hansen Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, yang.shi@linux.alibaba.com, rientjes@google.com, ying.huang@intel.com, dan.j.williams@intel.com, david@redhat.com, osalvador@suse.de, weixugc@google.com References: <20210401183216.443C4443@viggo.jf.intel.com> From: Dave Hansen Autocrypt: addr=dave.hansen@intel.com; keydata= xsFNBE6HMP0BEADIMA3XYkQfF3dwHlj58Yjsc4E5y5G67cfbt8dvaUq2fx1lR0K9h1bOI6fC oAiUXvGAOxPDsB/P6UEOISPpLl5IuYsSwAeZGkdQ5g6m1xq7AlDJQZddhr/1DC/nMVa/2BoY 2UnKuZuSBu7lgOE193+7Uks3416N2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SNT+nRqdl1ugJx9Ymsp8kXKMk9GSfmZpuMQB9c6io1qZc6nW/3TtvK pNGz7KPPtaDzvKA4S5tfrWPnDr7n15AU5vsIZvgMjU42gkbemkjJwP0B1RkifIK60yQqAAlT YZ14P0dIPdIPIlfEPiAWcg5BtLQU4Wg3cNQdpWrCJ1E3m/RIlXy/2Y3YOVVohfSy+4kvvYU3 lXUdPb04UPw4VWwjcVZPg7cgR7Izion61bGHqVqURgSALt2yvHl7cr68NYoFkzbNsGsye9ft M9ozM23JSgMkRylPSXTeh5JIK9pz2+etco3AfLCKtaRVysjvpysukmWMTrx8QnI5Nn5MOlJj 1Ov4/50JY9pXzgIDVSrgy6LYSMc4vKZ3QfCY7ipLRORyalFDF3j5AGCMRENJjHPD6O7bl3Xo 4DzMID+8eucbXxKiNEbs21IqBZbbKdY1GkcEGTE7AnkA3Y6YB7I/j9mQ3hCgm5muJuhM/2Fr OPsw5tV/LmQ5GXH0JQ/TZXWygyRFyyI2FqNTx4WHqUn3yFj8rwTAU1tluRUYyeLy0ayUlKBH ybj0N71vWO936MqP6haFERzuPAIpxj2ezwu0xb1GjTk4ynna6h5GjnKgdfOWoRtoWndMZxbA z5cecg== Message-ID: <9cd0dcde-f257-1b94-17d0-f2e24a3ce979@intel.com> Date: Fri, 16 Apr 2021 07:26:43 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US X-Rspamd-Queue-Id: A831EE000108 X-Stat-Signature: iu7gxw1b54sfrq4yoaojhghjwp8dst4n X-Rspamd-Server: rspam02 Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf05; identity=mailfrom; envelope-from=""; helo=mga17.intel.com; client-ip=192.55.52.151 X-HE-DKIM-Result: none/none X-HE-Tag: 1618583205-809330 Content-Transfer-Encoding: quoted-printable 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: On 4/16/21 5:35 AM, Michal Hocko wrote: > I have to confess that I haven't grasped the initialization > completely. There is a nice comment explaining a 2 socket system with > 3 different NUMA nodes attached to it with one node being terminal. > This is OK if the terminal node is PMEM but how that fits into usual > NUMA setups. E.g. > 4 nodes each with its set of CPUs > node distances: > node 0 1 2 3 > 0: 10 20 20 20 > 1: 20 10 20 20 > 2: 20 20 10 20 > 3: 20 20 20 10 > Do I get it right that Node 3 would be terminal? Yes, I think Node 3 would end up being the terminal node in that setup. That said, I'm not sure how much I expect folks to use this on traditional, non-tiered setups. It's also hard to argue what the migration order *should* be when all the nodes are uniform. > - The demotion is controlled by node_reclaim_mode but unlike other mode= s > it applies to both direct and kswapd reclaims. > I do not see that explained anywhere though. That's an interesting observation. Let me do a bit of research and I'll update the Documentation/ and the changelog. > - The demotion is implemented at shrink_page_list level which migrates > pages in the first round and then falls back to the regular reclaim > when migration fails. This means that the reclaim context > (PF_MEMALLOC) will allocate memory so it has access to full memory > reserves. Btw. I do not __GFP_NO_MEMALLOC anywhere in the allocation > mask which looks like a bug rather than an intention. Btw. using > GFP_NOWAIT in the allocation callback would make more things clear > IMO. Yes, the lack of __GFP_NO_MEMALLOC is a bug. I'll fix that up. GFP_NOWAIT _seems_ like it will work. I'll give it a shot. > - Memcg reclaim is excluded from all this because it is not NUMA aware > which makes sense to me. > - Anonymous pages are bit tricky because they can be demoted even when > they cannot be reclaimed due to no (or no available) swap storage. > Unless I have missed something the second round will try to reclaim > them even the later is true and I am not sure this is completely OK. What we want is something like this: Swap Space / Demotion OK -> Can Reclaim Swap Space / Demotion Off -> Can Reclaim Swap Full / Demotion OK -> Can Reclaim Swap Full / Demotion Off -> No Reclaim I *think* that's what can_reclaim_anon_pages() ends up doing. Maybe I'm misunderstanding what you are referring to, though. By "second round" did you mean when we do reclaim on a node which is a terminal node? > I am still trying to digest the whole thing but at least jamming > node_reclaim logic into kswapd seems strange to me. Need to think more > about that though. I'm entirely open to other ways to do the opt-in. It seemed sane at the time, but I also understand the kswapd concern. > Btw. do you have any numbers from running this with some real work > workload? Yes, quite a bit. Do you have a specific scenario in mind? Folks seem to come at this in two different ways: Some want to know how much DRAM they can replace by buying some PMEM. They tend to care about how much adding the (cheaper) PMEM slows them down versus (expensive) DRAM. They're making a cost-benefit call Others want to repurpose some PMEM they already have. They want to know how much using PMEM in this way will speed them up. They will basically take any speedup they can get. I ask because as a kernel developer with PMEM in my systems, I find the "I'll take what I can get" case more personally appealing. But, the business folks are much more keen on the "DRAM replacement" use. Do you have any thoughts on what you would like to see?