From patchwork Mon Aug 1 08:42:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12933627 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 25F0DC00144 for ; Mon, 1 Aug 2022 08:43:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 321AE8E0001; Mon, 1 Aug 2022 04:43:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2D2246B0072; Mon, 1 Aug 2022 04:43:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19A108E0001; Mon, 1 Aug 2022 04:43:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0AD4B6B0071 for ; Mon, 1 Aug 2022 04:43:27 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D0E06140832 for ; Mon, 1 Aug 2022 08:43:26 +0000 (UTC) X-FDA: 79750384812.08.72698C1 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf11.hostedemail.com (Postfix) with ESMTP id A5CE64010D for ; Mon, 1 Aug 2022 08:43:24 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id y1so10094026pja.4 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=QYno8NRNuVTpaLOIhmDIltuHrsGN43x6j2aDnH54zepMHP+GAgNqb+gREuiO48ngPl J9CNxbOe129Z2H1t68rw+ctydlKbFw2fhn3Hp9Cu02iReevm6PNUEPPQd5n2fja5JhIv +/g2E+kn/Ki1QCm+Ix9MUp9ePLjJwngjwkMH7xxk1gXT7W2OPWqfGW5zohugWOf2X4AR KmIdwL4NrJmcuqo8UQfbr4RuJxXYg+Q/lFnD1y3S+waRcsipu3tTiiAJNkunL1PQy7UO LJMkI2Oa8dI08yJQ1Cv9iZffcKaz+r/f6ott+X2i4Jgjy7HkHF9bciNULUQZt75Lpbph pZFg== X-Gm-Message-State: ACgBeo2ErU0ZS3XiXeqS+GhNAGqiNe3N4j/G+zSixrtaS/68yQZT1bQg TB4dC00gPj99mV1HK+cwsOCFZA== X-Google-Smtp-Source: AA6agR6zTozq1E06rEH33OfjNTim5CXg32Nr1pv/teCYOEhBmNrAQCy5Nj76HGMXwdxdNdECFznnCA== 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 ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2RwEtdtl; spf=pass (imf11.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.47 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659343406; a=rsa-sha256; cv=none; b=op3PGoT+lA2pg8vwbdAqcWhFy+ewXIg8kryDPFa8pKq6fYWnBLGPPieiH6mCC+JhOTnoyF hdFNgEuy//SlPn018sjIFkLpQooLrc+OU8CcPrZaqkeainRepJiOea5TwfSc4Z0YwDaJV8 dbX4ee7OlaCbc+GUY3aHh9Qbxh4n/jQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659343406; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=qtCFUiSlY6lJ/aXJnd6fr2hStSXov8dE2EzHxWqEyIg=; b=z9Lyl8c/M1LTcWd8yqveB5bU8NAgIvhN00g9cVPsye6wublH9UYothY7MIS0rd5A5N7nD/ pZ/LyMpA1S8lY261bRAngf5Jlpg0P2jnqCBi3Ivs1TBLHK14YrDJjRw7j8JgUuAVWf7wuw MsfCn4yiERhWaKx33AzZAmgqE1wbGlk= X-Stat-Signature: w3tst39yq4nbmzema7sgrn1qswe8ojmp X-Rspamd-Queue-Id: A5CE64010D X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2RwEtdtl; spf=pass (imf11.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.47 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Server: rspam04 X-HE-Tag: 1659343404-903494 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: 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 Reported-by: Muchun Song Signed-off-by: Feng Tang --- 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; }