Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1710060rdb; Thu, 7 Dec 2023 06:58:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IHS6lO2yeRa+VwnZT+PrNnkcvB07Zr8ZkzM7VfO9bp9UhmzK6q4Xb4tpJcWf2muYCWF/wcE X-Received: by 2002:a05:6a00:2302:b0:6c3:1b90:8552 with SMTP id h2-20020a056a00230200b006c31b908552mr2307349pfh.17.1701961114184; Thu, 07 Dec 2023 06:58:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701961114; cv=pass; d=google.com; s=arc-20160816; b=vqKAi+heXtYWrkocErM897PgF0h9tffKKT27Q/Ru5vBLR6GWNDp0Vljuxe1fKQonG2 /tXhWBn06TXOzaVwl90Bd4SlAFijDIaS/b/ognTIeGVlO5N+UEBRNEVFKKwaCeO2vxks UVnYtPNGb2YY3/baMk7puxTU36KMwlSKVjNu/jrkMWAjH3HYYIuFkPu5mXjs/nJhyeMR nAqH7Vx1QP/rgNKC5XibcWjlze4/hD8MoIthfTV+AdeVntBZUFADhexZVzdF5rw1WBx/ wfXKgHJVVCb+5hU0TwlaAY4Z0J71m0UOoeZdFJxA2r2F43zs7SEB2XT9OII3xwPlsShD hsgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=i67kcyKcdobkbYaTd9MF1EeAf3SUZGw/LNZlRB+L08A=; fh=WaDhQp4k+rBDkcUi14KfYnPxuVeI/pmxiJnzOFhlmY4=; b=fh7bp7FqelaJl2LMfI347f6YbfY1trCq7hbcajuDra0FcqZNE+U+sCHgUZ7hh+ZfSz sj9CpgJK7VVkv+ByzD8KPCmi12Yz0mm0w1FfwB4hiFzcb1NmjMsTtSVhfG6CRuC4bCi4 HVjo5phbQ4wkxUn3mec72mjuINC/jdqkBvTKsXk70edk2gL0x20kHfGRR2v/pll91jpb nxFyfEM5V9k1/W+/TYhslMYQkO9PaYO2JStdDMkgtgzlFRTLlou7zOnagPx+ti6KUmCV hk6/di0FW9sCP7DpRIFzFrV7gdHxIJAO7pbTvNfZQNWRjqpc0TLf022998k1Jdhh66WS LnWA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@memverge.com header.s=selector2 header.b=LAtosgVP; arc=pass (i=1 spf=pass spfdomain=memverge.com dkim=pass dkdomain=memverge.com dmarc=pass fromdomain=memverge.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=memverge.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 19-20020a631553000000b005c626072edfsi1273741pgv.773.2023.12.07.06.58.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 06:58:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@memverge.com header.s=selector2 header.b=LAtosgVP; arc=pass (i=1 spf=pass spfdomain=memverge.com dkim=pass dkdomain=memverge.com dmarc=pass fromdomain=memverge.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=memverge.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 56DBE804C571; Thu, 7 Dec 2023 06:58:31 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232867AbjLGO6Q (ORCPT + 99 others); Thu, 7 Dec 2023 09:58:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232768AbjLGO6P (ORCPT ); Thu, 7 Dec 2023 09:58:15 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2070.outbound.protection.outlook.com [40.107.220.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCC09128; Thu, 7 Dec 2023 06:58:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Re3eP664f/0FTxPF/AYhsNpoOw5E+NvyPIL0vTGRSJTdv1vsyT5E3+xf/A9tb80LHRVK5HvoMzBinkK4nPMT6dWbDYTXl1DeMNoO3eV5ZFr6q4wxdiBNw/arBDHbdrEzGplRL2AK0L9sw87JTFMUVdDgbraX77KgZMm/sO54Yu1SpHWrUryMtt2AxFKXajTUomnlg3VwxKCW0nwSAxMf3EwRVY8wwuP3tf4po5ob9haenlitsDxqOMTXteArGBUCEWU4enX2Zhxkk/RAmxztKC7ASXjMN2b4W/bi7ZuKTeO7AnaVT4FaBxL3amfJ3otckmfBXSz4ywzAR420Ga53CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=i67kcyKcdobkbYaTd9MF1EeAf3SUZGw/LNZlRB+L08A=; b=BstC7+1IDbAovtDi3YOw7hFn7vGd0sbGrXHOqvqyjtOYSDEBFTaGI2Q9UqVRmkiseKmnMy63MA/MyQATOZA7wtHikII++77EVw3EwBl4ECF6PLtasyPzU8vLF079MpX2Mkl9tXQvCXj8fYsAgMkLCnDyM/UpCB75TGW+A2Y2czwR4kG9y2tB2iE/OCMtGiRg4bRDlU7Z5JWegjXy5VfqUxBgTCN8P9e3/GMTepUwR6AHBOe2Nc/3UoCkgooXkzkAYckEF/H2w18/zL0BGKDv+KVjyA50hPZ+NPILGFAMv+0MQRfby4aFxA7WpQoBaJ/WvXXS78QojUYSWepr/+FCgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=memverge.com; dmarc=pass action=none header.from=memverge.com; dkim=pass header.d=memverge.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=memverge.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i67kcyKcdobkbYaTd9MF1EeAf3SUZGw/LNZlRB+L08A=; b=LAtosgVPz0aZeRsIHEm2qLoWEKdSrNjd9+16rXsyS+WFyoHrmy3jiIVIm9lnpwIZKBZE+esbLpI2zrluAwDUgAz41DFgOR7miZo9+pv1zGlvxtw/B0b9pEyzljxgN0Hmbcr//xT0gjvgmMyQY67jqzxwG9UlYR3nrxk7l8s10V4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=memverge.com; Received: from SJ0PR17MB5512.namprd17.prod.outlook.com (2603:10b6:a03:394::19) by SA0PR17MB4175.namprd17.prod.outlook.com (2603:10b6:806:82::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.27; Thu, 7 Dec 2023 14:58:19 +0000 Received: from SJ0PR17MB5512.namprd17.prod.outlook.com ([fe80::381c:7f11:1028:15f4]) by SJ0PR17MB5512.namprd17.prod.outlook.com ([fe80::381c:7f11:1028:15f4%5]) with mapi id 15.20.7068.027; Thu, 7 Dec 2023 14:58:19 +0000 Date: Thu, 7 Dec 2023 09:58:13 -0500 From: Gregory Price To: Arnd Bergmann Cc: Gregory Price , linux-mm@kvack.org, jgroves@micron.com, ravis.opensrc@micron.com, sthanneeru@micron.com, emirakhur@micron.com, Hasan.Maruf@amd.com, 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, 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 Message-ID: References: <20231207002759.51418-1-gregory.price@memverge.com> <20231207002759.51418-8-gregory.price@memverge.com> <67fab0f1-e326-4ad8-9def-4d2bd5489b33@app.fastmail.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <67fab0f1-e326-4ad8-9def-4d2bd5489b33@app.fastmail.com> X-ClientProxiedBy: SJ0PR05CA0023.namprd05.prod.outlook.com (2603:10b6:a03:33b::28) To SJ0PR17MB5512.namprd17.prod.outlook.com (2603:10b6:a03:394::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR17MB5512:EE_|SA0PR17MB4175:EE_ X-MS-Office365-Filtering-Correlation-Id: aeba84c5-f709-40da-d709-08dbf734f2e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sNuqdicEcHMxEOzw+LNH3f0rQGyP0tFFDNy+qS1o15aS5i/U+EAf9sMqY1gy6OPdytyvZMElBvouqQhH/6EZRKvyZy9zZg6BEItff95zV5H6y8OTxX6M9a2AMBPOvnJKPiV7LcCgvAfaqZW7JLZ2T/j/1nKYYrVQSERdzjgPFjYeyCosTMtQx/khUz9S5QPE9xlUdit1XUlECoW65RyEZRZBm4UVDoXxQxpucOf0P7E/cyf/k+CSPuEZXxW4N5eN4W8Xx/5luE35cSgTN0mWtbItQDc3bM/cw5pZvylfFn71+v91L8pWA6CGsYjCBTghgVH+WslxhshEKCRHKZO+T8PTqJtx84Qm6cP8z5M5HSePphFUE+C7n0RQDzVzZ4TFECWx6IljrucHSwGcZUNCv2wpWF/2U1X9hAhwYLPbIDKNVbrSewmcpfL0InGMWCRu1pXxf2VVp3KxHTyMZjWHdUxnR9H/chPp7awZC5IJF5I84XjKpmyNej/PzM+jEhKNonxy+dzYMW9F7Z4yP2XtEgadyGICtZiWHhLdlBqElv6zZIEcpBfLkWPSppAI4S7d X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR17MB5512.namprd17.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(396003)(136003)(366004)(39850400004)(376002)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(7406005)(7416002)(66946007)(66476007)(54906003)(66556008)(6916009)(316002)(44832011)(8936002)(4326008)(8676002)(5660300002)(478600001)(6486002)(2906002)(6506007)(6512007)(6666004)(2616005)(36756003)(26005)(41300700001)(38100700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?4VHDfYgT7sDTno20H/8W9PXyI59Uq9XEsMgjnJu9ExreIAbDsP54sv+Bda1p?= =?us-ascii?Q?5To8UJuWc9QcMol00GSTJAjIGgv/MI0v6LDAlxtuUmB8t4HNEUXGzXFZE4fH?= =?us-ascii?Q?zRlPEwmt9HPLt/qygTokQPZ+Hx44jhbzNLRAum0RtYKibcmrplbpnOPFnYS4?= =?us-ascii?Q?/Nc5GCgFFD2m+5Z0LSt+0fPqnUsiKT1Ey/ISlLYOMHh7b/8C3M4HIBcNlGMR?= =?us-ascii?Q?n4VK35lmBkf21ReaL6sIcIYN5UdodhNarOdBqePa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DXkRUqplCPP0mTZs2rClXo3fjUMzXkjf5AG99nbtgcxgSsf8?= =?us-ascii?Q?e7Q8UO3W9CtdxDqscrCo5ybflfyQNhHYOC3LadI3R18tLF4qPlkw0upUJoYK?= =?us-ascii?Q?SRbvPzznqWcjS+SynjvfvZod6OFpkjcXBnAZQBlHsse2CKfOKrpzkCrNtsuN?= =?us-ascii?Q?zWjMED2GOoHoWKe4cVGO7sGI7FGPlAb2SOW+Cpqv/nQFNYCDYW4/UtG8oxjb?= =?us-ascii?Q?AE0FUGI6gipIqs/kPn4c3S3/jbF8VBpeOGoaIrMtp1czKs/pazTIlDwWFHhw?= =?us-ascii?Q?1ON1B7bJmQc3WYFCLkSOZa2lezppvhGPM0ibwaP+4KFYNBbdtKJcfUFdxru5?= =?us-ascii?Q?1tjVnbOkxohNJVvyuOvxpB6Frq1FPip20FX4rxu/VzjHFM305+mwt3062tXQ?= =?us-ascii?Q?o4Z7P+FEKK4QMIwnUn5qaOJ8hIHjRmmT8j9ale2IipPND1ylkE6SQdx7ODTU?= =?us-ascii?Q?pw=3D=3D?= X-OriginatorOrg: memverge.com X-MS-Exchange-CrossTenant-Network-Message-Id: aeba84c5-f709-40da-d709-08dbf734f2e4 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR17MB5512.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2023 14:58:19.0174 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5c90cb59-37e7-4c81-9c07-00473d5fb682 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 0wX5lioStHt9yAxYCidYr+uftOYMQIcS9jo5Q0tMMNW6HylLn6KBJ1FKl+TgxcaOKlCLVKUZv4kTta3Gu68iiO3tweVOFxrbwvxEm6bDCQ0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR17MB4175 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 07 Dec 2023 06:58:31 -0800 (PST) On Thu, Dec 07, 2023 at 08:13:22AM +0100, Arnd Bergmann wrote: > 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 doh, clearly i didn't stop to think about alignment. Good eye. I'll redo this with __u/s members and fix the holes. Didn't stop to think about compat pointers. I don't think the u64_to_user_ptr pattern is offensive, so i'll make that change. At least I don't see what the other options are beyond compat. Thanks ~Gregory