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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 50006C4338F for ; Mon, 2 Aug 2021 11:14:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C0BDF60FC0 for ; Mon, 2 Aug 2021 11:14:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C0BDF60FC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3EEDA6B0033; Mon, 2 Aug 2021 07:14:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C5A36B0036; Mon, 2 Aug 2021 07:14:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DB9E8D0001; Mon, 2 Aug 2021 07:14:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 134E16B0033 for ; Mon, 2 Aug 2021 07:14:36 -0400 (EDT) Received: from smtpin39.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BBAF81D58C for ; Mon, 2 Aug 2021 11:14:35 +0000 (UTC) X-FDA: 78429882510.39.43EADD7 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf02.hostedemail.com (Postfix) with ESMTP id 4CE9A7002B2B for ; Mon, 2 Aug 2021 11:14:35 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 26F8521C2F; Mon, 2 Aug 2021 11:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1627902874; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pFXbUA/npgsJimUjktGzlNShlCBsUVgSGGwA9ygYx1M=; b=FMKAn1haAEGcrI4uzbLy2n503nPYCSvDqQhDAGK7UZ//DsWH9h7hNzH8tx039cr/hE1PX/ tg826pLpdqufS5qRg0DDS9k7kBKSMk0Y3uZa1760p8qCu/GOYhzgg3CG5SQFGIO2kC2h9G SPbId/Xs5TiGXkyLEyMUgUfytiXftOM= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 58655A3B83; Mon, 2 Aug 2021 11:14:33 +0000 (UTC) Date: Mon, 2 Aug 2021 13:14:29 +0200 From: Michal Hocko To: Feng Tang 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: References: <20210728141156.GC43486@shbuild999.sh.intel.com> <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: <20210802081130.GA42490@shbuild999.sh.intel.com> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 4CE9A7002B2B Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=FMKAn1ha; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf02.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com X-Stat-Signature: xshhkkfi667q3jsqmtk4a1segf8zazqh X-HE-Tag: 1627902875-102679 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 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. -- Michal Hocko SUSE Labs