From mboxrd@z Thu Jan 1 00:00:00 1970 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 C1E97C35274 for ; Mon, 18 Dec 2023 19:47:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 564206B0081; Mon, 18 Dec 2023 14:47:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4ED826B0082; Mon, 18 Dec 2023 14:47:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38EE86B0085; Mon, 18 Dec 2023 14:47:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 2BFDC6B0081 for ; Mon, 18 Dec 2023 14:47:16 -0500 (EST) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D32AFA1E9C for ; Mon, 18 Dec 2023 19:47:15 +0000 (UTC) X-FDA: 81580972830.13.79DDCA8 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf23.hostedemail.com (Postfix) with ESMTP id DFE61140017 for ; Mon, 18 Dec 2023 19:47:13 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PlMnDzIk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of gourry.memverge@gmail.com designates 209.85.214.195 as permitted sender) smtp.mailfrom=gourry.memverge@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702928833; a=rsa-sha256; cv=none; b=GrWLknDjoZb1T7PugVYhLICWat+RoYOpD1ob5JcBsjMtwYOhOtGken66lN+kc3p3M/J8Z5 zI4oOXOQS3ZgPOwq76OXzhTuri2rNFFlUsIbuQpQr9vDwIoPernNTYjF3b0vB+MxhkbMIr aT3k1Gpe01ZTtEI4/Gq5KMVfgI/i7+M= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PlMnDzIk; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf23.hostedemail.com: domain of gourry.memverge@gmail.com designates 209.85.214.195 as permitted sender) smtp.mailfrom=gourry.memverge@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702928833; 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:in-reply-to:references:references:dkim-signature; bh=iHAGnEescBI+H6+nuN2AFaKvkx/2sXtk6C+MWO0ta0k=; b=ESyw1Iv55DgmIBQ3WfhJSXIT01dGjz1FF02wRB35z2J2Ixg0bzBePxhhfxZRHLv6GQPSVM ixmxoDOJX/oKUbdjuFOYukU4kzVB3ppJ8xYfHcTB0qpNuYyOg5pkbSGMAcGzYNDv4+wnqZ 1HlpO/XQedJC1uqVfmjQ6jEFoLq3Y9g= Received: by mail-pl1-f195.google.com with SMTP id d9443c01a7336-1d3c76ee799so10278185ad.3 for ; Mon, 18 Dec 2023 11:47:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702928832; x=1703533632; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iHAGnEescBI+H6+nuN2AFaKvkx/2sXtk6C+MWO0ta0k=; b=PlMnDzIkJMNKtNN5dFQDMxMMzs35k5L9TBSEO2tsr9QWKnwbc3lGstJBfmRhoCtzQ9 RzTPznk7m1SkQJ79i18liqRaO6p23r2ZOH/bI3VnhBpk8UNeyWbBMVodW8DKy4nfGRsI ATAKzKDEfW37O/zyhhpA3kEh36ZtviuV11Js7cy2vvbZzhB3RRhgtQniYo7viS/etIV0 Wz9NXS3oo/3KB6P/Y2nSnv3x97V3MiRV1myxJhMzbvUPdrIRHEDDfmTgbKa+VF+8iEiM ETft9y10+6YptJgYYTTV1h+Jtv8LBsxyYA8Af2IsCUiVGUcVUcyyo72+8zvA9x/EVIxg OQzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702928832; x=1703533632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iHAGnEescBI+H6+nuN2AFaKvkx/2sXtk6C+MWO0ta0k=; b=HihFfhUuBpvZgDyDDnUWKXEbbmsPaqxjmAG3H4as8U6gqpr6MiWFvt9+OyyAeS528Z H6aqDcxLLciuYpK1Lc/D0WOta7+myo+vv8LDrAmdOaWu9k2fx8GuroeSScze4QLYPHfZ fMb+5X0Fwz5s3eRIzZFTLGF9lwb0Nag5YvL0pzbm1Gue8zG4erGsHopqwgXeFYP7MaKF c0DcDKdZDjmTGAksWdfSKXVEg3jHgoiPm5bClWp8JSSTxfp7/JW/bEbz0jHjg+Y9xqJ+ bR2VAZiJrlQrwJLYD/QE4KZF8pc0lN3sQWD9dzJNsYmQi3SWjhVq/xP3aXDip4L5+f8T PFnw== X-Gm-Message-State: AOJu0Yx3J3AuzSvg3dFcrxs2BvTaM9/+1jPX/21N3XBwdDb0YK7b7bi+ z5qpcYGeQ6VK8buAvTfPzfhRQszyw+luh6o= X-Google-Smtp-Source: AGHT+IH68lABBd7MdPlJz2f1cHXOHBSvwu1StwzNvbHAn7HqW2kB3VG59ByjU9BE7WtdrkFq/zNRBg== X-Received: by 2002:a17:903:2442:b0:1d3:b684:fc0c with SMTP id l2-20020a170903244200b001d3b684fc0cmr1144510pls.104.1702928832513; Mon, 18 Dec 2023 11:47:12 -0800 (PST) Received: from fedora.mshome.net (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id 11-20020a170902c20b00b001ce664c05b0sm19456335pll.33.2023.12.18.11.47.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 11:47:12 -0800 (PST) From: Gregory Price X-Google-Original-From: Gregory Price To: linux-mm@kvack.org Cc: linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org, akpm@linux-foundation.org, arnd@arndb.de, tglx@linutronix.de, luto@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mhocko@kernel.org, tj@kernel.org, ying.huang@intel.com, gregory.price@memverge.com, corbet@lwn.net, rakie.kim@sk.com, hyeongtak.ji@sk.com, honggyu.kim@sk.com, vtavarespetr@micron.com, peterz@infradead.org, jgroves@micron.com, ravis.opensrc@micron.com, sthanneeru@micron.com, emirakhur@micron.com, Hasan.Maruf@amd.com, seungjun.ha@samsung.com, Frank van der Linden Subject: [PATCH v4 07/11] mm/mempolicy: add userland mempolicy arg structure Date: Mon, 18 Dec 2023 14:46:27 -0500 Message-Id: <20231218194631.21667-8-gregory.price@memverge.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231218194631.21667-1-gregory.price@memverge.com> References: <20231218194631.21667-1-gregory.price@memverge.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: DFE61140017 X-Stat-Signature: o18uk4zcya8ny1wmzi4bxqtwwfcei66j X-HE-Tag: 1702928833-535966 X-HE-Meta: U2FsdGVkX197mxXzPHGD908dFdqrd62BJDu41so6xZ/MbNqMEJOxeGpudpLRFEjGj63A0xNC0nF8wOES+pdLuJaLCX3eWqsj7/GE48FS8p21rHAJYg+2KOfKHujiAWMtgkw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3BbuzNqWf3gAh/SU6XNqsgqUkWtCUudISYk0KOF9srqfQd2xLnmkA+NArL0YvyV+U61awRhdwj2qWq23vtgP4Vjj2p1feY2ni253nuKyEXk16SaOMWcrV4HwlkYeZjjXNo98NYVLg0zSciYj3Xv2apgLhfLKRxQAaXz58LQxV2Unz7m2eVlg/Ok9wI635TyMMeWhtiSd3Ugj3poMrO/Zkuw463ueffTBBX4O+cMJUDcR02IwTI+8MnMJJclCrTlK5+dhewX1S9WZT+3MH7UoR7mH0V/Bp2tlSnWsULYsS/BsyMQoUErKXLZm3kIt+XV7ZCNyizAHSpQr0htb+Zux4IEF03SBG3Nxt8tOtm7BIZWorpuawhkpat3svUOLGxNcLKGje9NzOaJMkc8a+PXyK4jn4SAdLUH0VIuMpLpnPy+lglScs7M0aDI0r 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: List-Subscribe: List-Unsubscribe: This patch adds the new user-api argument structure intended for set_mempolicy2 and mbind2. struct mpol_args { __u16 mode; __u16 mode_flags; __s32 home_node; /* mbind2: policy home node */ __aligned_u64 *pol_nodes; __u64 pol_maxnodes; __s32 policy_node; /* get_mempolicy: policy node info */ }; This structure is intended to be extensible as new mempolicy extensions are added. For example, set_mempolicy_home_node was added to allow vma mempolicies to have a preferred/home node assigned. This structure allows the addition of that setting at the time the mempolicy is set, rather than requiring additional calls to modify the policy. Full breakdown of arguments as of this patch: mode: Mempolicy mode (MPOL_DEFAULT, MPOL_INTERLEAVE) mode_flags: Flags previously or'd into mode in set_mempolicy (e.g.: MPOL_F_STATIC_NODES, MPOL_F_RELATIVE_NODES) home_node: for mbind2. Allows the setting of a policy's home with the use of MPOL_MF_HOME_NODE pol_nodes: Policy nodemask pol_maxnodes: Max number of nodes in the policy nodemask policy_node: for get_mempolicy2. Returns extended information about a policy that was previously reported by passing MPOL_F_NODE to get_mempolicy. Instead of overriding the mode value, simply add a field. Suggested-by: Frank van der Linden Suggested-by: Vinicius Tavares Petrucci Suggested-by: Hasan Al Maruf Signed-off-by: Gregory Price Co-developed-by: Vinicius Tavares Petrucci Signed-off-by: Vinicius Tavares Petrucci --- .../admin-guide/mm/numa_memory_policy.rst | 18 ++++++++++++++++++ include/linux/syscalls.h | 1 + include/uapi/linux/mempolicy.h | 10 ++++++++++ 3 files changed, 29 insertions(+) diff --git a/Documentation/admin-guide/mm/numa_memory_policy.rst b/Documentation/admin-guide/mm/numa_memory_policy.rst index d2c8e712785b..d5fcebdd7996 100644 --- a/Documentation/admin-guide/mm/numa_memory_policy.rst +++ b/Documentation/admin-guide/mm/numa_memory_policy.rst @@ -482,6 +482,24 @@ closest to which page allocation will come from. Specifying the home node overri the default allocation policy to allocate memory close to the local node for an executing CPU. +Extended Mempolicy Arguments:: + + struct mpol_args { + __u16 mode; + __u16 mode_flags; + __s32 home_node; /* mbind2: policy home node */ + __aligned_u64 pol_nodes; /* nodemask pointer */ + __u64 pol_maxnodes; + __s32 policy_node; /* get_mempolicy2: policy node information */ + }; + +The extended mempolicy argument structure is defined to allow the mempolicy +interfaces future extensibility without the need for additional system calls. + +The core arguments (mode, mode_flags, pol_nodes, and pol_maxnodes) apply to +all interfaces relative to their non-extended counterparts. Each additional +field may only apply to specific extended interfaces. See the respective +extended interface man page for more details. Memory Policy Command Line Interface ==================================== diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index fd9d12de7e92..a52395ca3f00 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -74,6 +74,7 @@ struct landlock_ruleset_attr; enum landlock_rule_type; struct cachestat_range; struct cachestat; +struct mpol_args; #include #include diff --git a/include/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h index 1f9bb10d1a47..c06f2afa7fe3 100644 --- a/include/uapi/linux/mempolicy.h +++ b/include/uapi/linux/mempolicy.h @@ -27,6 +27,16 @@ enum { MPOL_MAX, /* always last member of enum */ }; +struct mpol_args { + /* Basic mempolicy settings */ + __u16 mode; + __u16 mode_flags; + __s32 home_node; /* mbind2: policy home node */ + __aligned_u64 pol_nodes; + __u64 pol_maxnodes; + __s32 policy_node; /* get_mempolicy: policy node info */ +}; + /* Flags for set_mempolicy */ #define MPOL_F_STATIC_NODES (1 << 15) #define MPOL_F_RELATIVE_NODES (1 << 14) -- 2.39.1