Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1477365rdb; Wed, 6 Dec 2023 23:13:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGq2T6wy+jAWiwugonWzx8UI4pWbL/l4Lfhtfk8O/mpASbRCsJF8qGDUNtJtAZvDX90ZnBr X-Received: by 2002:a05:6a20:914a:b0:18f:f86f:bcd0 with SMTP id x10-20020a056a20914a00b0018ff86fbcd0mr817474pzc.39.1701933235079; Wed, 06 Dec 2023 23:13:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701933235; cv=none; d=google.com; s=arc-20160816; b=pv9GRDjyTkoKX4zwylUHYJODqPQvFki3tkNUU6QDfuyu40UbDGN69yoiJ8vnUTT0FW Z0FELeiRfd8emfQI0vIfiGeV/qhvaVYky/4n3p11oZ+b0N8PojXLyQqHgHV/RfHsggIP DQwnjvLVI3Xlf7BwsZ/cNknLTf25u0vY9gv3nVLZc9mLEx10DZYqAv5JyhBuW2wZHM0R /f6gscg2LPuT2fttbf2+gQ6IvohK7BpvcIWgtixqiZxtzerrwP275t4IJXs2YzRgLzbq eSIR8BlKHq+lrOHjK9+e/q0l/d3DnwawUdQtgJykF6ahEwVa64PUI9U0ZiWNBJjhxsrP oacg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:feedback-id:dkim-signature :dkim-signature; bh=Gnfimb5hncqefIVhB4bE5spPvjRgxNsO0UKP3I5CJ24=; fh=sBeqXe2HcUe1MfM26J/LO3vToUZRT0Zqg/FQjBLS1rU=; b=ySOnGtz15+W4vf2LfiBLAxsmTncn0e9iSt+Q49UOvuodS/owaUWpyN5uORIrWagcjw CEVaDvVWaZr5W3HFhBPdjob4N/F8UiUcG3bWndC1ejKsBe9FuOTt2ei9bsqb1na4HV+W rMZSguhAAbcM+sJWyc26fk6k/IDXGqVEYj4m/5VrDQ8RRE2z3Miu5cnAWShZ7e2fZOKG HTA06Ubzk9md1yC8eTNnKgW+XFdzhk2HulNLUrM4yWlcV5Se3jrWKg9Elcft9eOQnl/x Rqp4JtDfLuN4tjzmw0uKGGVesn6/Hcmbe+LoImT/IYMFm7QgbR3BHjbYbUqsLIYPqPhS IcQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=gnWq7FOm; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=i+Y4B8Pb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id u12-20020a63f64c000000b005c6763c2ff8si659372pgj.760.2023.12.06.23.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 23:13:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm1 header.b=gnWq7FOm; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=i+Y4B8Pb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id B22E480E071F; Wed, 6 Dec 2023 23:13:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377822AbjLGHNn (ORCPT + 99 others); Thu, 7 Dec 2023 02:13:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbjLGHNl (ORCPT ); Thu, 7 Dec 2023 02:13:41 -0500 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E91A193; Wed, 6 Dec 2023 23:13:47 -0800 (PST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5DB9E5C0106; Thu, 7 Dec 2023 02:13:46 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Thu, 07 Dec 2023 02:13:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm1; t=1701933226; x=1702019626; bh=Gn fimb5hncqefIVhB4bE5spPvjRgxNsO0UKP3I5CJ24=; b=gnWq7FOm+5cnwGQBNT HmxCJaQ6tNzZTBXwtwv4/U8MjVoAXSBaFsj8tCRvV/BdnA+WMCMl09H4NX7R26EH ztsKPXk18n4GmiTwUGKHgnnbQ19wv6Xky3yCMWxwc8DbP+wychgUnL0C2+jhXGEf O/9WttnO4lcFOnYNjO7cwgYUzaZaLTAb165HkfnfIizoJk/M+Oyo1HGBGGtoWmA6 VQZMREfGurPDXfwB9mG1K+m2Xv/3e3pf9//q8A+5o5FPXyiE+QwXZpuvWEK1wcyd UNI8mtli1S/uip2jJ0Mv/uyxLj7LDpx4pz/sgwoM6gSMR3fCzpn5Mr90naURD794 8AeQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1701933226; x=1702019626; bh=Gnfimb5hncqef IVhB4bE5spPvjRgxNsO0UKP3I5CJ24=; b=i+Y4B8PbYyANvyOKhO2ZnAkV6NfvF D7FoMvWU4H3mHECLyfTlqlCbPQsRoeqbrnWKcQ4yoQi6Z/JglUWjGa06eOeYcP6A 5nFZ7KITak3ZnK+JnvvwRtbq6tpX3JDgUmoLlDT2e/WPl7vJY15tW9pIzD/wWEk/ Da401Dm81NtH/LaROxplvxi9AsVJwSAv09extM7e7OwEr0vHFoBuwkBN4ZQmFCxP N23FYqsOY0JH4PuesXQxD17qLS7xynAssFV5EoGKAczh8ngtORvqgZ5Vy3bXzGXc CebPyc8dQk9g5nt4HG4lAYhCVlR3sVbQ6ffKL4EdiZlhUhUFgMT2bR6HA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudekuddguddthecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvvefutgesthdtredtreertdenucfhrhhomhepfdet rhhnugcuuegvrhhgmhgrnhhnfdcuoegrrhhnugesrghrnhgusgdruggvqeenucggtffrrg htthgvrhhnpeffheeugeetiefhgeethfejgfdtuefggeejleehjeeutefhfeeggefhkedt keetffenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe grrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id A144DB60089; Thu, 7 Dec 2023 02:13:44 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1178-geeaf0069a7-fm-20231114.001-geeaf0069 MIME-Version: 1.0 Message-Id: <67fab0f1-e326-4ad8-9def-4d2bd5489b33@app.fastmail.com> In-Reply-To: <20231207002759.51418-8-gregory.price@memverge.com> References: <20231207002759.51418-1-gregory.price@memverge.com> <20231207002759.51418-8-gregory.price@memverge.com> Date: Thu, 07 Dec 2023 08:13:22 +0100 From: "Arnd Bergmann" To: "Gregory Price" , linux-mm@kvack.org, jgroves@micron.com, ravis.opensrc@micron.com, sthanneeru@micron.com, emirakhur@micron.com, Hasan.Maruf@amd.com Cc: linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, Linux-Arch , linux-kernel@vger.kernel.org, "Andrew Morton" , "Thomas Gleixner" , "Andy Lutomirski" , "Ingo Molnar" , "Borislav Petkov" , "Dave Hansen" , x86@kernel.org, "H. Peter Anvin" , "Michal Hocko" , "Tejun Heo" , ying.huang@intel.com, "Gregory Price" , "Jonathan Corbet" , rakie.kim@sk.com, hyeongtak.ji@sk.com, honggyu.kim@sk.com, vtavarespetr@micron.com, "Peter Zijlstra" , "Frank van der Linden" Subject: Re: [RFC PATCH 07/11] mm/mempolicy: add userland mempolicy arg structure Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 06 Dec 2023 23:13:53 -0800 (PST) On Thu, Dec 7, 2023, at 01:27, Gregory Price wrote: > This patch adds the new user-api argument structure intended for > set_mempolicy2 and mbind2. > > struct mpol_args { > /* Basic mempolicy settings */ > unsigned short mode; > unsigned short mode_flags; > unsigned long *pol_nodes; > unsigned long pol_maxnodes; > > /* get_mempolicy2: policy information (e.g. next interleave node) */ > int policy_node; > > /* get_mempolicy2: memory range policy */ > unsigned long addr; > int addr_node; > > /* all operations: policy home node */ > unsigned long home_node; > > /* mbind2: address ranges to apply the policy */ > const struct iovec __user *vec; > size_t vlen; > }; This is not a great structure layout for a system call ABI, mostly because it requires adding a compat syscall handler to be usable from 32-bit tasks. It would be nice if this could be rewritten in a way that uses only fixed-length members (__u16, __u32, __aligned_u64), though that does require the use of u64_to_user_ptr() to replace the pointers and the reverse in userspace. Aside from this, you should avoid holes in the data structure. On 64-bit architectures, the layout above has holes after policy_node and after addr_node. Arnd