Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1836580imn; Mon, 1 Aug 2022 01:47:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t/Nu52M/siWENn3n/X0hIAQY862P/u9xef/4tV/D9uwBnhXfVhtRx0g7TEDza1IfzgC013 X-Received: by 2002:a17:906:2bc7:b0:72f:dc70:a3c6 with SMTP id n7-20020a1709062bc700b0072fdc70a3c6mr11830042ejg.645.1659343632374; Mon, 01 Aug 2022 01:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659343632; cv=none; d=google.com; s=arc-20160816; b=RNp4CVKtpzxvyzGQ/qHieygRwW7R7xIbmhiDTcHjFjgaeNRUkEVW8nB0PgdiwF4vun D8gTX8H5xGQGDLu32ojGROarnjVV7nw2f5MQNnSYeDnMvtLZF6Fje/CSqUUl4NNImZXw /l+Fqjv2YfVsY91jfo8UbEhaezBXxcekZdVW9iAJE7alEj2hHh+vPbzLtfqg+GNtLpy6 hP61O00XAn69zFC0udS0JW7sh90HbRSO/DIAQIN8hDlqejcq0gIRr9dZA6WY+9Eg0BNw j9i0UWNHlGZrbgkujrlZZ6IvdQWt+pGExUjoY8AvRtPdXQdbhKiwo3ofr3HlM83OEqQ7 l6fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=qtCFUiSlY6lJ/aXJnd6fr2hStSXov8dE2EzHxWqEyIg=; b=e1DWYpW0KGopiHdQ8QtGQMPf9IDv7u6AQCnVTisvtItYCzESbvxEmR3ZcknWNUmpQ/ Bylq7N2dN9s3b/6miaKgwLmmVaTZnaIlGTxgQVT/BXOAqhzOi4Li8lt/tOjrd5yueZuD XtHy5OpBCFijdE44L6k7lkwjG0Jo1HSaoE+wCAP7+wYjG7H7eGNFhEdUAD7uWsWzaHqU S1PFLMK/3jsFMQpu5HseNT0oV+cabk5Y6IP1wG/M+jDdwiFnb82b2wh9U/l0rF19XAaj gXR0rLHIDLKkhXa1ZWq5SdyrE5RRcP1dAeHyygpGXIOOpghNDljo1d7W/6S8NFoD8zoQ 4KbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2RwEtdtl; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm11-20020a05640222cb00b0043cf67ef040si8745719edb.203.2022.08.01.01.46.47; Mon, 01 Aug 2022 01:47:12 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2RwEtdtl; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbiHAIn1 (ORCPT + 99 others); Mon, 1 Aug 2022 04:43:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229816AbiHAInZ (ORCPT ); Mon, 1 Aug 2022 04:43:25 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F6152F668 for ; Mon, 1 Aug 2022 01:43:24 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id p8so9805314plq.13 for ; Mon, 01 Aug 2022 01:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=qtCFUiSlY6lJ/aXJnd6fr2hStSXov8dE2EzHxWqEyIg=; b=2RwEtdtl4E1aRxbENPLkwq3Lrm8t+tLiZrQ/ikpUivzerzB3j1S6rP1B3pvMqB1CHR MoY7Ritl2tvSA2izf4J/Ei7hI/+FVQWrR+wcsYYmAGHHS75RF5skPAksoA3Y04ImxuBX M68bJ+dZMJ8YjlTuhC0P1zBFcfNK4NnJ2gAyZqCOfTIIy1zBmNuL9aGttqqEnuPj+WYg e7W6a9PyipGs6qiQi51Du+byR9x7lssC/GLxtgvWTaP2Q82qUBctVeu7aWk5yUQmSZsj +68qMNOpm5ciS4IB4ls+WwBTyQ1xALHkGlHKCJcM6yvxCK7HgYBmV6ywJgOm6pc/Pv1v 2PdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=qtCFUiSlY6lJ/aXJnd6fr2hStSXov8dE2EzHxWqEyIg=; b=OL1mx4EJ6wzRCuwUa6YdkOkzb66CEgRoB8cvclBklLoYVqMJewOTABpKmDtEOv0KwK ITyZQN8NC9Jyw+XqRDR7SsY91ylEY5Kep2/quynoyzNqzQfI11/HsgMpSvGsDIYJH5IS xunwIhqm13iAsJ5NUV9Z9Hlj56VYh0YypORzt06vYmv52jJieO3kJAfWjnPU7laSIFHJ HeRFSPY5nBpRZj7iMi7NpkZqyMeAFEg6ZumswtC0ogQTSpcmU5Qi+jKBMireNQBj04rI iae/CkghGohfwEvKIqRdop5CLzqvP3ArI3GcBucwLohTpNyqdtjDjMTcVpOiI03Zzihc 1esQ== X-Gm-Message-State: ACgBeo2flcuT9+CqYis1kTyDIIhgwE9KKmv1skFFnthzNh2SvlH+KEgy ACSvIBNoLz30tw4Grp0XkjuiFw== X-Received: by 2002:a17:90a:1943:b0:1ef:8146:f32f with SMTP id 3-20020a17090a194300b001ef8146f32fmr18027396pjh.112.1659343403411; Mon, 01 Aug 2022 01:43:23 -0700 (PDT) Received: from FVFYT0MHHV2J.bytedance.net ([139.177.225.249]) by smtp.gmail.com with ESMTPSA id z3-20020a1709027e8300b0016dafeda062sm8826393pla.232.2022.08.01.01.43.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 01:43:23 -0700 (PDT) From: Muchun Song To: akpm@linux-foundation.org, bwidawsk@kernel.org, mhocko@suse.com, dave.hansen@linux.intel.com, feng.tang@intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH] mm: mempolicy: fix policy_nodemask() for MPOL_PREFERRED_MANY case Date: Mon, 1 Aug 2022 16:42:07 +0800 Message-Id: <20220801084207.39086-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 policy_nodemask() is supposed to be returned a nodemask representing a mempolicy for filtering nodes for page allocation, which is a hard restriction (see the user of allowed_mems_nr() in hugetlb.c). However, MPOL_PREFERRED_MANY is a preferred mode not a hard restriction. Now it breaks the user of HugeTLB. Remove it from policy_nodemask() to fix it, which will not affect current users of policy_nodemask() since all of the users already have handled the case of MPOL_PREFERRED_MANY before calling it. BTW, it is found by code inspection. Fixes: b27abaccf8e8 ("mm/mempolicy: add MPOL_PREFERRED_MANY for multiple preferred nodes") Signed-off-by: Muchun Song --- mm/mempolicy.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 6c27acb6cd63..4deec7e598c6 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1845,9 +1845,6 @@ nodemask_t *policy_nodemask(gfp_t gfp, struct mempolicy *policy) cpuset_nodemask_valid_mems_allowed(&policy->nodes)) return &policy->nodes; - if (mode == MPOL_PREFERRED_MANY) - return &policy->nodes; - return NULL; } -- 2.11.0