Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7428576rdb; Wed, 3 Jan 2024 16:19:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IH66VjPIKqiCwZjgl1+j3ZOWav+UEqR+A/bRWTlhTRUysatMEzTfoBc7qeYM0dzsRAzabzL X-Received: by 2002:a05:600c:1f0a:b0:40d:8fe0:6c2f with SMTP id bd10-20020a05600c1f0a00b0040d8fe06c2fmr824286wmb.136.1704327572439; Wed, 03 Jan 2024 16:19:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704327572; cv=none; d=google.com; s=arc-20160816; b=iABHJGqfFhD+F7P8ObX69eaRJRHZyz7CcUMH44gtB1qsUd3k7f8i64MxXqv3g1w7kV ECsZfrshanvH6QZKyncVZGLqHHiL3wGGEMGaoA7NFTBmhJS2LwIG+2Xdrv3qe7QQl/UT h+CvPVsnPeNXzn3CAeRyIJ2/DnwU4Nxs1HDZNlBdT1G6bDdwAwUnnF6Ly064bE7I09Qr P6OcByMgQ+RIe/936/egYARcyPmuoko8liO/vzCAmYbH+oMeAamKCbq/XagVms4tVNYY CVbUIOah3vQnrKQSJD95MFdVFB9onnU/LjTlOdFubQFXuk49mNETTWD7caUbE+TYy+aj e+FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=0SEkDxkX73eYHKG0v/y3mmPzpF+tkShgrm5cJQMXxio=; fh=LJ7GMITv1P9YdVZLiCI5tl9yV1uy10GupwZ/sL0NLbY=; b=uIlNZIlfsM/BBrNqJpB4Pz0WktRxvyk82NGlBjZmbBKhPB71PfE4Nf2Y3wBSqRiuho v5qbcOSbgcIO+8syzOaTyFxsys3zcOi2d7IZCt22Zpkxjd37HCDvhs5PsrQZ8oh2RLrz mMH32xWvEO22ERd4W+XIjhHbB5eIpsaeevpCZl3snx9iuMAVHTsHbrgBnalODMc7gj6y pOAFy3UHovwguiLgfJgmvyEDVhbuR//GZKex6IIgzIqL1qn4CGvHgds+XwuHrFuUC1/l 9nS59f54yoZDN2hsRUTBw8/ZgVN0jf4egA/FYXjRyIfdk9RKd4ySA5CLVTpyXLyiBSE+ +DuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=WNlqAeGa; spf=pass (google.com: domain of linux-kernel+bounces-16138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16138-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a4-20020a170906684400b00a26e8e20c34si8605107ejs.501.2024.01.03.16.19.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 16:19:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=WNlqAeGa; spf=pass (google.com: domain of linux-kernel+bounces-16138-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16138-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 304051F25404 for ; Thu, 4 Jan 2024 00:19:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 497FA139B; Thu, 4 Jan 2024 00:19:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="WNlqAeGa" X-Original-To: linux-kernel@vger.kernel.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D81936B; Thu, 4 Jan 2024 00:19:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=0SEkDxkX73eYHKG0v/y3mmPzpF+tkShgrm5cJQMXxio=; b=WNlqAeGaAenVvfZnIUbipXu0s+ Arz55X0ciai3unUSjDibQpCxLHUM8UAJPsYzJIPgi6uiGjwc5Wr3B+R/VG2X+oFhqnaiNr/CPB+Ay N3OUGZHUTX1peTGhl5q52I8yHVMKk4L6OcAtZA22keDKgFh2H53NZBbM1zzImWi31ygZAlxlELDkA MLeSHrd6vluGKSFCiETbZEWsYHRMwS9CKFpSfuj9XEgjUGOh2NVF4m8Izs0xzUY/ASJmcwOb7/j6d mq0KYL5oyBTbD7ivTvJLbwms7SRahDapcA9azvxetGgRywHPiWsJguMr7avZNDrlwoPeX+W1qkYvC hntm+meQ==; Received: from [50.53.46.231] (helo=[192.168.254.15]) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rLBS1-00CTNI-2P; Thu, 04 Jan 2024 00:19:09 +0000 Message-ID: <429dd825-204a-4b11-87fd-ce9d39040d4d@infradead.org> Date: Wed, 3 Jan 2024 16:19:03 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 08/12] mm/mempolicy: add userland mempolicy arg structure Content-Language: en-US To: Gregory Price , 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, linux-arch@vger.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 References: <20240103224209.2541-1-gregory.price@memverge.com> <20240103224209.2541-9-gregory.price@memverge.com> From: Randy Dunlap In-Reply-To: <20240103224209.2541-9-gregory.price@memverge.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi, On 1/3/24 14:42, Gregory Price wrote: > This patch adds the new user-api argument structure intended for > set_mempolicy2 and mbind2. > > struct mpol_param { > __u16 mode; > __u16 mode_flags; > __s32 home_node; /* mbind2: policy home node */ > __u16 pol_maxnodes; > __u8 resv[6]; > __aligned_u64 *pol_nodes; > }; > > 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 user > to set the home node at the time mempolicy is created, rather than > requiring an additional syscalls. > > 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_maxnodes: Max number of nodes in the policy nodemask > > pol_nodes: Policy nodemask > > The reserved field accounts explicitly for a potential memory hole > in the structure. > > 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 | 17 +++++++++++++++++ > include/linux/syscalls.h | 1 + > include/uapi/linux/mempolicy.h | 9 +++++++++ > 3 files changed, 27 insertions(+) > > diff --git a/Documentation/admin-guide/mm/numa_memory_policy.rst b/Documentation/admin-guide/mm/numa_memory_policy.rst > index a70f20ce1ffb..cbfc5f65ed77 100644 > --- a/Documentation/admin-guide/mm/numa_memory_policy.rst > +++ b/Documentation/admin-guide/mm/numa_memory_policy.rst > @@ -480,6 +480,23 @@ 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_param { > + __u16 mode; > + __u16 mode_flags; > + __s32 home_node; /* mbind2: set home node */ > + __u64 pol_maxnodes; > + __aligned_u64 pol_nodes; /* nodemask pointer */ > + }; > Can you make the above documentation struct agree with the struct in the header below, please? (just a difference in the size of pol_maxnodes and the 'resv' bytes) > +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/uapi/linux/mempolicy.h b/include/uapi/linux/mempolicy.h > index 1f9bb10d1a47..109788c8be92 100644 > --- a/include/uapi/linux/mempolicy.h > +++ b/include/uapi/linux/mempolicy.h > @@ -27,6 +27,15 @@ enum { > MPOL_MAX, /* always last member of enum */ > }; > > +struct mpol_param { > + __u16 mode; > + __u16 mode_flags; > + __s32 home_node; /* mbind2: policy home node */ > + __u16 pol_maxnodes; > + __u8 resv[6]; > + __aligned_u64 pol_nodes; > +}; > + > /* Flags for set_mempolicy */ > #define MPOL_F_STATIC_NODES (1 << 15) > #define MPOL_F_RELATIVE_NODES (1 << 14) -- #Randy