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 3C04AC19F2B for ; Thu, 4 Aug 2022 10:43:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7CE2A8E0002; Thu, 4 Aug 2022 06:43:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 77D638E0001; Thu, 4 Aug 2022 06:43:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 645358E0002; Thu, 4 Aug 2022 06:43:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 50B8E8E0001 for ; Thu, 4 Aug 2022 06:43:27 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1B5FB120392 for ; Thu, 4 Aug 2022 10:43:27 +0000 (UTC) X-FDA: 79761573654.22.4B4773A Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf06.hostedemail.com (Postfix) with ESMTP id 9992C18010E for ; Thu, 4 Aug 2022 10:43:25 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2BB1A20E9D; Thu, 4 Aug 2022 10:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1659609804; 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=bSiyZjW9ioJq224VNQyTCMBHDlfySwyLJt96GrmgCyg=; b=FxG2vQ7yf3Oi1tC0pFA1LYxrYFEtt8SiG4ULKdm3WwjWEFblbaUJ5NCEakAdyCNSlVmbrR 5prZAR8nwLG7LuOHsVFuel5efS1MLOknIpVTuTfuUOLhLuURsq9mLKRnbTZRgTiTh+sD5+ p3M1KEzNE72vzbi2gU15LD3D/uM2Uwc= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6503E13A94; Thu, 4 Aug 2022 10:43:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id J95HB8Oi62L9FQAAMHmgww (envelope-from ); Thu, 04 Aug 2022 10:43:15 +0000 Date: Thu, 4 Aug 2022 12:43:00 +0200 From: Michal Hocko To: Feng Tang Cc: Muchun Song , Mike Kravetz , Andrew Morton , "bwidawsk@kernel.org" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] mm: mempolicy: fix policy_nodemask() for MPOL_PREFERRED_MANY case Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659609805; a=rsa-sha256; cv=none; b=5IlHroqFPZ1dyBtQpTNzvsSWIXnJK1egQNe6g1DKIABBUkRc8Py/8FdF9vxyOtvyYmrOFh 5DQcaH3iV9Mu1yp8MjTp0WrawMyCUCZp0bgN2qU+Qn9ERFq36yi2IBv0bNNAFW6/CAeIFn ooIvxosvkjCPH21OWv5v6KPrHP6pkgg= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=FxG2vQ7y; spf=pass (imf06.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659609805; 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=bSiyZjW9ioJq224VNQyTCMBHDlfySwyLJt96GrmgCyg=; b=tMxvJW0NTP5WgCKvKunfqnfk9s2gG4kyQDRXHbsM2T8VExhKXKpF32qLcyfuvdR+fZaxn2 9muvXLSmcORiPEsqyr/xd3kdU+TI3VTvOE+EfoFhVPpNeoYukYNZSetj3XRoJXKpW4QfZg EdtD0rqv3BFfQM9IRSmyIm1Z/15HOnE= X-Rspam-User: X-Stat-Signature: zfedk1ge9opfp81ak99xxag6wbrmk97e X-Rspamd-Queue-Id: 9992C18010E Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=FxG2vQ7y; spf=pass (imf06.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspamd-Server: rspam02 X-HE-Tag: 1659609805-930856 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 Thu 04-08-22 16:27:24, Feng Tang wrote: [...] > >From a2db9a57da616bb3ea21e48a4a9ceb5c2cf4f7a2 Mon Sep 17 00:00:00 2001 > From: Feng Tang > Date: Thu, 4 Aug 2022 09:39:24 +0800 > Subject: [PATCH RFC] mm/hugetlb: add dedicated func to get 'allowed' nodemask for > current process > > Muchun Song found that after MPOL_PREFERRED_MANY policy was introduced > in commit b27abaccf8e8 ("mm/mempolicy: add MPOL_PREFERRED_MANY for multiple preferred nodes") > [1], the policy_nodemask_current()'s semantics for this new policy > has been changed, which returns 'preferred' nodes instead of 'allowed' > nodes, and could hurt the usage of its caller in hugetlb: > allowed_mems_nr(). > > Michal found the policy_nodemask_current() is only used by hugetlb, > and suggested to move it to hugetlb code with more explicit name to > enforce the 'allowed' semantics for which only MPOL_BIND policy > matters. > > One note for the new policy_mbind_nodemask() is, the cross check > from MPOL_BIND, gfp flags and cpuset configuration can lead to > a no available node case, which is considered to be broken > configuration and 'NULL' (equals all nodes) is returned. > > [1]. https://lore.kernel.org/lkml/20220801084207.39086-1-songmuchun@bytedance.com/t/ > Reported-by: Muchun Song > Suggested-by: Michal Hocko > Signed-off-by: Feng Tang LGTM I would just make apply_policy_zone extern rather than making it static inline in a header which can turn out to cause other header dependencies. Thanks! -- Michal Hocko SUSE Labs