From patchwork Tue Jun 1 15:14:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Feng Tang X-Patchwork-Id: 12291619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0F08C47093 for ; Tue, 1 Jun 2021 15:15:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6F20960FF3 for ; Tue, 1 Jun 2021 15:15:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F20960FF3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2AA596B0071; Tue, 1 Jun 2021 11:15:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 25B426B0072; Tue, 1 Jun 2021 11:15:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F8E66B0074; Tue, 1 Jun 2021 11:15:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id C8C496B0071 for ; Tue, 1 Jun 2021 11:15:02 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5C044A762 for ; Tue, 1 Jun 2021 15:15:02 +0000 (UTC) X-FDA: 78205502844.05.F955586 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by imf27.hostedemail.com (Postfix) with ESMTP id 25202801936A for ; Tue, 1 Jun 2021 15:14:46 +0000 (UTC) IronPort-SDR: sXIvvxRyGgu/67nwOUTwIYo3qB+VJd2+TEZh6bRnYmft/e0eWHYefMOFBJJn61znSB7uXy6b3T W4Jj6vzmUHdA== X-IronPort-AV: E=McAfee;i="6200,9189,10002"; a="183926896" X-IronPort-AV: E=Sophos;i="5.83,240,1616482800"; d="scan'208";a="183926896" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2021 08:14:57 -0700 IronPort-SDR: PVKf2aH7Xy0/F2b9LOkfMq171ceKiUw9WZoeDCd1E2CJc/Bk6axgZb/uz2pW4ADuuvrQxixVF/ MMUWoy5X3jMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,240,1616482800"; d="scan'208";a="482522120" Received: from shbuild999.sh.intel.com ([10.239.147.94]) by fmsmga002.fm.intel.com with ESMTP; 01 Jun 2021 08:14:53 -0700 From: Feng Tang To: linux-mm@kvack.org, Andrew Morton , Michal Hocko , David Rientjes , Dave Hansen , Ben Widawsky Cc: Andrea Arcangeli , Mel Gorman , Mike Kravetz , Randy Dunlap , Vlastimil Babka , Andi Kleen , Dan Williams , ying.huang@intel.com, Feng Tang Subject: [v4 PATCH 0/3] mm/mempolicy: some fix and semantics cleanup Date: Tue, 1 Jun 2021 23:14:49 +0800 Message-Id: <1622560492-1294-1-git-send-email-feng.tang@intel.com> X-Mailer: git-send-email 2.7.4 X-Rspamd-Queue-Id: 25202801936A Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf27.hostedemail.com: domain of feng.tang@intel.com has no SPF policy when checking 192.55.52.151) smtp.mailfrom=feng.tang@intel.com X-Rspamd-Server: rspam04 X-Stat-Signature: 5kar8dregwtu9y945rmkfyas7iwq3bzy X-HE-Tag: 1622560486-301448 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: Current memory policy code has some confusing and ambiguous part about MPOL_LOCAL policy, as it is handled as a faked MPOL_PREFERRED one, and there are many places having to distinguish them. Also the nodemask intersection check needs cleanup to be more explicit for OOM use, and handle MPOL_INTERLEAVE correctly. This patchset cleans up these and unifies the parameter sanity check for mbind() and set_mempolicy(), which helps to make further changes easier (notably MPOL_PREFERRED_MANY) The patchset has been run with some sanity test like 'stress-ng' and 'ltp', and no problem found. Thanks, Feng Changelogs: v4: * fix a problem in mpol_set_nodemask() (Michal Hocko) * update cover-letter and commit log (Andrew/Michal) * add Acked-by info v3: * fix logic of mpol_rebind_preferred() (Michal Hocko) v2: * rename mempolicy_nodemask_intersects() to mempolicy_in_oom_domain() and correct commit log (Michal Hocko) * change the mpol syscall param sanity check (Michal Hocko) * combine the 3/4 and 4/4 in v1 into one patch, and further clean the logic (Michal Hocko) v1: * use helper func instead of macro for patch 2/4 (David Rientjes) * fix a possible null pointer case in patch 3/4 * update commit log for 1/4 RFC v2: * add for oom check fix patch 1/4 * add the unification patch for mpol preprocess 2/4 Feng Tang (3): mm/mempolicy: cleanup nodemask intersection check for oom mm/mempolicy: don't handle MPOL_LOCAL like a fake MPOL_PREFERRED policy mm/mempolicy: unify the parameter sanity check for mbind and set_mempolicy include/linux/mempolicy.h | 2 +- include/uapi/linux/mempolicy.h | 1 - mm/mempolicy.c | 213 ++++++++++++++++++----------------------- mm/oom_kill.c | 2 +- 4 files changed, 94 insertions(+), 124 deletions(-)