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=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 61C6CC4338F for ; Mon, 2 Aug 2021 11:33:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F375260FC2 for ; Mon, 2 Aug 2021 11:33:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F375260FC2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 49CB86B0033; Mon, 2 Aug 2021 07:33:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 425656B0036; Mon, 2 Aug 2021 07:33:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C60D8D0001; Mon, 2 Aug 2021 07:33:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 0F5D76B0033 for ; Mon, 2 Aug 2021 07:33:37 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A83581F232 for ; Mon, 2 Aug 2021 11:33:36 +0000 (UTC) X-FDA: 78429930432.28.A50FBF2 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by imf04.hostedemail.com (Postfix) with ESMTP id 9E99B5001B61 for ; Mon, 2 Aug 2021 11:33:35 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10063"; a="213166267" X-IronPort-AV: E=Sophos;i="5.84,288,1620716400"; d="scan'208";a="213166267" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2021 04:33:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,288,1620716400"; d="scan'208";a="510105180" Received: from shbuild999.sh.intel.com (HELO localhost) ([10.239.146.151]) by FMSMGA003.fm.intel.com with ESMTP; 02 Aug 2021 04:33:27 -0700 Date: Mon, 2 Aug 2021 19:33:26 +0800 From: Feng Tang To: Michal Hocko Cc: "linux-mm@kvack.org" , Andrew Morton , David Rientjes , "Hansen, Dave" , "Widawsky, Ben" , "linux-kernel@vger.kernel.org" , "linux-api@vger.kernel.org" , Andrea Arcangeli , Mel Gorman , Mike Kravetz , Randy Dunlap , Vlastimil Babka , Andi Kleen , "Williams, Dan J" , "Huang, Ying" , Dave Hansen Subject: Re: [PATCH v6 1/6] mm/mempolicy: Add MPOL_PREFERRED_MANY for multiple preferred nodes Message-ID: <20210802113326.GA78980@shbuild999.sh.intel.com> References: <20210729070918.GA96680@shbuild999.sh.intel.com> <20210729151242.GA42865@shbuild999.sh.intel.com> <20210730030502.GA87066@shbuild999.sh.intel.com> <20210730071840.GA87305@shbuild999.sh.intel.com> <20210802081130.GA42490@shbuild999.sh.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf04.hostedemail.com: domain of feng.tang@intel.com has no SPF policy when checking 192.55.52.115) smtp.mailfrom=feng.tang@intel.com X-Stat-Signature: fy6inhicggha7u8f8boqptdwjt4xs7by X-Rspamd-Queue-Id: 9E99B5001B61 X-Rspamd-Server: rspam01 X-HE-Tag: 1627904015-512301 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 Mon, Aug 02, 2021 at 01:14:29PM +0200, Michal Hocko wrote: > On Mon 02-08-21 16:11:30, Feng Tang wrote: > > On Fri, Jul 30, 2021 at 03:18:40PM +0800, Tang, Feng wrote: > > [snip] > > > > > One thing is, it's possible that 'nd' is not set in the preferred > > > > > nodemask. > > > > > > > > Yes, and there shouldn't be any problem with that. The given node is > > > > only used to get the respective zonelist (order distance ordered list of > > > > zones to try). get_page_from_freelist will then use the preferred node > > > > mask to filter this zone list. Is that more clear now? > > > > > > Yes, from the code, the policy_node() is always coupled with > > > policy_nodemask(), which secures the 'nodemask' limit. Thanks for > > > the clarification! > > > > Hi Michal, > > > > To ensure the nodemask limit, the policy_nodemask() also needs some > > change to return the nodemask for 'prefer-many' policy, so here is a > > updated 1/6 patch, which mainly changes the node/nodemask selection > > for 'prefer-many' policy, could you review it? thanks! > > right, I have mixed it with get_policy_nodemask > > > @@ -1875,8 +1897,13 @@ static int apply_policy_zone(struct mempolicy *policy, enum zone_type zone) > > */ > > nodemask_t *policy_nodemask(gfp_t gfp, struct mempolicy *policy) > > { > > - /* Lower zones don't get a nodemask applied for MPOL_BIND */ > > - if (unlikely(policy->mode == MPOL_BIND) && > > + int mode = policy->mode; > > + > > + /* > > + * Lower zones don't get a nodemask applied for 'bind' and > > + * 'prefer-many' policies > > + */ > > + if (unlikely(mode == MPOL_BIND || mode == MPOL_PREFERRED_MANY) && > > apply_policy_zone(policy, gfp_zone(gfp)) && > > cpuset_nodemask_valid_mems_allowed(&policy->nodes)) > > return &policy->nodes; > > Isn't this just too cryptic? Why didn't you simply > if (mode == MPOL_PREFERRED_MANY) > return &policy->mode; > > in addition to the existing code? I mean why would you even care about > cpusets? Those are handled at the page allocator layer and will further > filter the given nodemask. Ok, I will follow your suggestion and keep 'bind' handling unchanged. And to be honest, I don't fully understand the current handling for 'bind' policy, will the returning NULL for 'bind' policy open a sideway for the strict 'bind' limit. Thanks, Feng > -- > Michal Hocko > SUSE Labs