Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5629353rdb; Wed, 13 Dec 2023 14:42:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFlbqSyTbIbrhUSJiiD7KqHZY1ydHdBIx9nIvjBq5Ha/xVTIHeefTM3p4zKn4DxXwogr87H X-Received: by 2002:a17:902:f690:b0:1d0:a663:20fe with SMTP id l16-20020a170902f69000b001d0a66320femr4692431plg.80.1702507373511; Wed, 13 Dec 2023 14:42:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702507373; cv=none; d=google.com; s=arc-20160816; b=rDtZ4VT8vq+IGnJkAU7prUftu476w87SmKQ2PBGJTV0IBaXiBQJohHF0vtJUeDUpBa CArrxKgeRYbz/Yy6y4eNz/awznMWASOFTa8Eq5F4ZSwGucrfj6AZPyLoF21xwZchvAnY wbmYDab0lDHBzf9Jqo6Jtmc5pa/vrIaMc6+BwtvmiToBP25LkPVPpFdsoKseR24VAimL yFDkNMAq4UpDRc805jC+SJGMI7PomThDLEeyOlQalFe+dqJ/3KuKBkt+0SWs+gTvYrP+ CMrN5fvBPdW2ldkpWJB6fQnoR13e4Ml/0Y8d4U4yrocvPWnnEqTqBAk650eZSy24vepr jaEA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iHAGnEescBI+H6+nuN2AFaKvkx/2sXtk6C+MWO0ta0k=; fh=yH27m1ebMiOwcfUuEuTf+CjAMnM4Uq0b942LTz1/vok=; b=Cxx9pfEq7JbZvZo/bz9BEaOvTfoj91GOKYw9rMRGud7ktqLp/QH670P+JgNN7KFvL7 Sq2HO02NpmNndZV6XmKm5cf9kgEPiJnJYUN3E72wSgnw0TpSpq15tYEAZXdt7PaMNnE/ Jmq+ehqXe6kAbZqxRGmf+u/hDMrURI/6S2VVBK7RuiZ1K94f3qy5AbKXmpvY/C2UNc1m 5Q2+X7/LslYTkCUdpOmMEIunkUF53lFlNlc8tK2Ab1YmQBYn6ebMstSYAKeFF9eMMXu+ bnc2678zaPS8K5VvRxPxaTc0wIOo7SKim0K8t6qq6nl8C0QfpVI4cDAVVW6C1b8MGHwS c5Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VK60BwgV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id e2-20020a17090301c200b001d347f9532asi1441553plh.187.2023.12.13.14.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 14:42:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VK60BwgV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 0F499802F68D; Wed, 13 Dec 2023 14:42:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442857AbjLMWlt (ORCPT + 99 others); Wed, 13 Dec 2023 17:41:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442842AbjLMWlj (ORCPT ); Wed, 13 Dec 2023 17:41:39 -0500 Received: from mail-yw1-x1143.google.com (mail-yw1-x1143.google.com [IPv6:2607:f8b0:4864:20::1143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78DE3116; Wed, 13 Dec 2023 14:41:35 -0800 (PST) Received: by mail-yw1-x1143.google.com with SMTP id 00721157ae682-5df49931b4eso52462627b3.0; Wed, 13 Dec 2023 14:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702507294; x=1703112094; darn=vger.kernel.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=VK60BwgVqQiBxKvd1P+gGHeDjoE9o4L7xq89cbuK70w6DQCySpRwb+KQjUE7uUL0nS FpqSQDlmrZV3s6v+kZ+hh01Lr5Cn7Xf3X4PrEc909HMBBtwtadXWIP0k9DdqBgOZdqp7 QM7y+EYgSjtsyypZXf5RGZK87UCPqR105wGpnZywi1XeYRwGl/lB6p3BivhlDKaWCkeo 0bRBEdKwT3L6lKJ/hazAPyWX2yzepbscKgIvbMbsT1EaSso/g/Rdn0gO2K4bCt/WWJFZ c9NOPUoa2EWGnlJVtZJXTTFVtTGF6H9y9Rk+C7dEC8RPsIm4XVNckXsUz6ox2Cjq2Gvm a8Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702507294; x=1703112094; 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=eoBeiphcAraLm3n90l3hL6RVF7ogkM1cBp+4FxPNcQut1cYICtkmkfnlWhQHLnVhaF 5gGR2uyq6/U3rrclhxdXPcZ6Ryo5Gg1PMjOJUs3etQQOUE2dTCuilTHFueHptaUBwh+h Heq1CmODnjHVfG/XaQEGIk9MMA7P1rebAidu5lDoMZfz1eRUv1fqyqQjVifIwFhgTCxG Pu0D7O3uWgzZUGxm06l0E4C0NTsWFge/elmq3Kx+O+jmnTifYkGLKo2qCtUxT1po1hSn 2wySB2pH1dy+CXbZyYORQoX19WR/IfjDqWNOYfNllq/pfDDNC36xVz5AzvfvmfmF313j A4nQ== X-Gm-Message-State: AOJu0Yz1rPGyN+9oRusb3Tua4rxXg6TtevvIce3Tmu7jqRa+6Vhcz4eI WaIrND7ZPTLWOjX+y+QYOA== X-Received: by 2002:a81:5b85:0:b0:5cd:c65c:8173 with SMTP id p127-20020a815b85000000b005cdc65c8173mr8014732ywb.10.1702507294578; Wed, 13 Dec 2023 14:41:34 -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 v4-20020a818504000000b005d9729068f5sm5050583ywf.42.2023.12.13.14.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 14:41:34 -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 v3 07/11] mm/mempolicy: add userland mempolicy arg structure Date: Wed, 13 Dec 2023 17:41:14 -0500 Message-Id: <20231213224118.1949-8-gregory.price@memverge.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20231213224118.1949-1-gregory.price@memverge.com> References: <20231213224118.1949-1-gregory.price@memverge.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Dec 2023 14:42:51 -0800 (PST) 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