Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp337276imn; Wed, 3 Aug 2022 06:05:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vemZB4feBAVE8GASeLwKYRugEFpmuWKc8Yd+w4FET/WsxjeqJ/BZM5lSdykfB55AxQ1Xou X-Received: by 2002:aa7:d053:0:b0:43d:b75:fd96 with SMTP id n19-20020aa7d053000000b0043d0b75fd96mr25228938edo.12.1659531904109; Wed, 03 Aug 2022 06:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659531904; cv=none; d=google.com; s=arc-20160816; b=l45d+DFNa4M342CJlrluR8/wiihE3NnzFZaD9gNhMXkQJYS8bc8v+iwXDCg/wNFUMt YHk0oZfhvHg6fwOgSX+PTfn2CPILnjbOpJnYveMxCitZTq3aoTHlynlOvqUfwStV2Xp9 fSVHIEYrDUjKoaCu5Wmy9wYy8pPe4i7+HH7ZEqfBiAvi14XL1MR+zcpZiN0zFKVHuRpi 10sTzajk8vNJTtvIippMN1GDPxja9ZYdbkCnHQB7HRKIQUlslunJgJfVG5t2NAvPLD2A qPOI3HFsD3nexinF8vzwMDVDY5eeEkSNmudDJyKmQcpBGJwFx10sKiAD3S+Da/tfxiK0 798g== 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=VBjG8dobIZkku1CWQkR/K9igC2Gpo0t0c8G7EPf8X8M=; b=XXFPSocsnMSf/eEm1GTxT/RZge0a9naWdbcMXEXV9s+hypc7WVe4m6iOMyWDFAMHF2 9I9yLYH+vT2bHwf4uJGRkh4Y0OeRU9gtzRhiAE1nEByEFRsAzQzh+q9EbJHmd35tD6VF Uo/4ocTOXDy0uGYUHaMqzYu/q2eGagx/qLRn18uxfQhujLfCFEvFjfOD+tppvULdLOpy 046HEcP6IHaMZAjirK+6PYclUT/7VemmTLIK23vfyJhceZRYaMy9lt36esv9Ilind7Zw eWW/3zuLz397qlV+CRmqmUebUPiljXcdXm4XmX9ikK+ppjjrfJJ0WMPaJfn+FwBDBSb5 rgxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=V0weYV7J; 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 h9-20020a0564020e8900b0043d1c157652si11264103eda.510.2022.08.03.06.04.33; Wed, 03 Aug 2022 06:05:04 -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=V0weYV7J; 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 S236354AbiHCM4u (ORCPT + 99 others); Wed, 3 Aug 2022 08:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235594AbiHCM4s (ORCPT ); Wed, 3 Aug 2022 08:56:48 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B9E62DC5 for ; Wed, 3 Aug 2022 05:56:47 -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-out1.suse.de (Postfix) with ESMTPS id 1C7304D53C; Wed, 3 Aug 2022 12:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1659531405; 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=VBjG8dobIZkku1CWQkR/K9igC2Gpo0t0c8G7EPf8X8M=; b=V0weYV7JGTmeNz+1PQTWXbPhLVwOzwSmgj9cw1QTp/LuCKl9ek5J9/LRFtGh9pnj+bQ71I Ilq0+Q22P68fXmKnVfhFuIdP9FFoh2S9uN6V/dYZVEVrtBGmtOQLdsP/xh6eU8IQngbLcY 6E2U8fvdpFgvtryeHmh98daEEwklPsY= 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 EF84813AD8; Wed, 3 Aug 2022 12:56:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xiMdOIxw6mKNbgAAMHmgww (envelope-from ); Wed, 03 Aug 2022 12:56:44 +0000 Date: Wed, 3 Aug 2022 14:56:44 +0200 From: Michal Hocko To: Feng Tang Cc: Muchun Song , "akpm@linux-foundation.org" , "bwidawsk@kernel.org" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , Mike Kravetz 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 04:43:06, Feng Tang wrote: > On Wed, Aug 03, 2022 at 07:28:59PM +0800, Michal Hocko wrote: [...] > > +struct mempolicy *policy_mbind_nodemask(gfp_t gfp) > > +{ > > +#ifdef CONFIG_MEMPOLICY > > + struct mempolicy *mpol = get_task_policy(current); > > + > > + /* > > + * only enforce MBIND which overlaps with cpuset policy (from policy_nodemask) > > + * specifically for hugetlb case > > + */ > > + if (mpol->mode == MPOL_BIND && > > + (apply_policy_zone(mpol, gfp_zone(gfp)) && > > + cpuset_nodemask_valid_mems_allowed(&policy->nodes)) > > + return &mpol->nodes; > > +#endif > > + return NULL; > > I saw the logic is not changed, and it confused me that if there is > no qualified node, it will still return NULL which effectively equals > node_states[N_MEMORY], while I think it should return a all zero > nodemasks. This is a separate thing and I have to admit that the existing code is rather non-intuitive or even broken. I guess we do not care all that much because MBIND with completely non-overlapping cpusets is just a broken configuration. I am not sure this case is interesting or even supported. -- Michal Hocko SUSE Labs