Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp231886imn; Thu, 4 Aug 2022 03:52:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Pgbd/kTPmcAm/Y36ILmR4wy87erfx8zQ54Z4f0SvtuoyHyD5SlXzKxVOepm9buQ249t2S X-Received: by 2002:a17:907:2cef:b0:72b:5b3e:3d7a with SMTP id hz15-20020a1709072cef00b0072b5b3e3d7amr959038ejc.293.1659610320343; Thu, 04 Aug 2022 03:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659610320; cv=none; d=google.com; s=arc-20160816; b=Iq1NpmsBLPxrBerkKAc3R/qFOM5C5ZQaBwWXnuou+X6u6ma+2oXEb8YjALimwA1E2S uX165EG1qUFf3gtxhKM1IDkj8BJQo3Tu6rh70TmwZLcJRnGyDuNIuDB4vVMqIk3jI99I i+dZ4eAB2BdGyS4zU6AChQGpBZFEfQkYBLS+Ji46MXiil0r7n9Hgb5F2NhxsTVMHdur8 wTIW3FPSrxvAChiC7aE6vf1uxbm0iDXITMTAVPjdKi/qjTq6fYJUOJ3uaTfKf4PZqVKm sip7bawosUt75np+b/YWKb4Vsyac4+vn1fw+8sbkJapqfVKlN7Fs8Mdn7Zbla0bKu5fS VLEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bSiyZjW9ioJq224VNQyTCMBHDlfySwyLJt96GrmgCyg=; b=p8/gYFh8RXhqAytFFemrV0sKDIeWn0ea9aePp5mXPTnvy88MAz/BWQKs80rkiGxelU dEK+8FE0pRP4PhshFX2HG5vL6VOg3NH2EW2gjEM5UuZ15ubpkQgxfixX9oeF+kBee7wS EpXVrMNsj7Q0ScfL/jL1V+wod+cdjKb/d1MSUQpUSvScXqcbqu+hmYxoQtlvbreu4wzs IuOHp35u3c6KFcYYVYFIkEerWkhsWiYm8VF1qEYzZtmKK343DrK73vLFWqjXazSx+8i6 sMtudW5EKcJ2p2jBqyvDVkiBc4d83Z5OEVp0EPSEeNecBl4wa5+NNz7rsaziExMUI4eA qEVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=FxG2vQ7y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e15-20020aa7d7cf000000b0043a1312a2bbsi906752eds.472.2022.08.04.03.51.35; Thu, 04 Aug 2022 03:52:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=FxG2vQ7y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233576AbiHDKnc (ORCPT + 99 others); Thu, 4 Aug 2022 06:43:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbiHDKna (ORCPT ); Thu, 4 Aug 2022 06:43:30 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 076DD2AC54 for ; Thu, 4 Aug 2022 03:43:29 -0700 (PDT) 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: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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