Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1608559rdb; Mon, 2 Oct 2023 15:21:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IESBqtCfzJQLgLZI+UdJfTt9yhWDdhr9O107C835CdbcxHuJup8RjoYQYE+5LFLk4Tn63O3 X-Received: by 2002:a81:7706:0:b0:581:2887:22be with SMTP id s6-20020a817706000000b00581288722bemr13952111ywc.37.1696285283338; Mon, 02 Oct 2023 15:21:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696285283; cv=pass; d=google.com; s=arc-20160816; b=X4NscuxqgEt5I3S+YDq0IsiidIY35cu1ly9x9/7iTBwsshKuuQ8mopQDWWKX7uAJhf wKG4Y8iva/iyz03n/fWTvH2b/EYul3UIFdCIzMiInBXkfQR7Qx/pUdVlJtEhbjanSiRI uVo0irv8jErAON06u+cFiTqZGwlOlnRjwc848hla9gVcbB3arOtmNF5tWPVKKxmZYhK0 osqsUoGlyjLUYmiwxDVhJ7A5HvPQ4xUewLBLAdMQlhunfPul1HGsRBeq6YkkNOQyDEoc +FdjfJdf7b/Nwi8JUEaFZKTnwb5Yxc2N8Kyuu3MzqV3tE/TwjPwREsEWKpPbr92lHvE4 dITQ== 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=LY0CJR7qert7RGJgCFAZaGLTA4B265M68sbeAwasCBU=; fh=PdKkFy1IXO8i2n/jggLosxr3G4iOywyoO5S/wyv0/Co=; b=q/Zx9blQRMx4k3cJNI2XPM95bfiqEhr/+NUT+/2oa0IamBVih9bIkOK3+lAnUqPJm9 I0ld2F4M7yn7URXHj6vt5Txo8xncB00a31gjWnrx64YZsBYWE2MaT2YWyGCoXn8lcqcO 8wt5pcsKzyd/PgwvM9w2NNMmd+3ksTs1t4Bxg4G54zj/8zis8esi1GAgguCoMZOVhTK5 naWnaXWwYuBxm00Q0E2guIEim7zOBtpJnbsijIs3BRgKwun5bjpkhJ6sDfMwt1Asm05A cOiXm8/OmIIuNvyWNwH01b3R74aitJXIP9QEU0q/vf344uKAvjLCKzFA4W3QNow6R4f6 IEZw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@memverge.com header.s=selector2 header.b=NDAeCkxe; 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 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id s1-20020a17090a2f0100b002766bd6d3f3si8284445pjd.10.2023.10.02.15.21.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 15:21:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@memverge.com header.s=selector2 header.b=NDAeCkxe; 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 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 0AD8E8076D0E; Mon, 2 Oct 2023 08:31:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237923AbjJBPbF (ORCPT + 99 others); Mon, 2 Oct 2023 11:31:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238112AbjJBPbD (ORCPT ); Mon, 2 Oct 2023 11:31:03 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2078.outbound.protection.outlook.com [40.107.223.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80BBBDC; Mon, 2 Oct 2023 08:30:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D2rszhlbya7MJigbir+2EuyC4f12+6KEQy+ysHw9VEs4og3fKy6/gLknPt7rzWhTXuodKpS1V8/lkhEHIibdS+JJbqQyNfKOYRlCCBNgDO2/Kxk6u8QG0JswG0nGk68VCF6M4V+4A+09h6BpLm2x8WfpZ9J/yndm8hEeiYxHlj4iGrG5Cnn655L6tSnQ/fGWYO2jB+c2QsE737w3Z9twQVQV0Gn6YOBPc/ScI4Qa2m4QpjFWIOD2IZO0UU4CelwKGJt6Sn4qFGD2S8b0wRcpi8+Anda87jrvRFeV/J5CrAfc+J6zk1ZLmfuHukPDYy9rH8lbQHV8Ozl6klKGsraSng== 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=LY0CJR7qert7RGJgCFAZaGLTA4B265M68sbeAwasCBU=; b=HTCF9WPP0vrXee3dbCIFokvKAMA0OEuR1fmkkMi976qfXpCdT+FT+YpwoRK8Qcux1qoXfxllSbT8v60Y0X7qxfP3paq6s6ZNdnUFdT5syDhYdfGccFb/yVEbdF7b/uZ6b7sA8IqLgf7Cw54fGnbXPxk7P+gejqpKqQcMuFnTSbG0c6MuNU2BD9yrwnEnN7UsC9Kq8OuqSPKy9mf4UyYo6ZbldwQUgxMkLPfTcu7N0ik+1zfB2EHlggsC121Zj2I5Jmgf0koZeDex4gFCCScDAV82+Pygc/DkKVIzL6xQ3+JP5b9sBU32HC/yBW0EzCQ3u0PqpPO4EawfTFQ2J0v7nQ== 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=LY0CJR7qert7RGJgCFAZaGLTA4B265M68sbeAwasCBU=; b=NDAeCkxepWzwPoWIE3V/8ee0dQ7ueUb+Hjh/969tU1Uy3zhZOxfK+7GxBBHEqTwdXou6iQk9bQyFEUXVTbsHnDVfIciSK7YDYH4EXT/ky/1in6PoE4nZb+21Q4uwUEmIrT7Uw7spO1l7PK28McPBPP/R2uYpqlM0mEwplxApwSw= 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 DM6PR17MB3755.namprd17.prod.outlook.com (2603:10b6:5:22c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Mon, 2 Oct 2023 15:30:51 +0000 Received: from SJ0PR17MB5512.namprd17.prod.outlook.com ([fe80::5565:d559:61b0:e2df]) by SJ0PR17MB5512.namprd17.prod.outlook.com ([fe80::5565:d559:61b0:e2df%6]) with mapi id 15.20.6813.027; Mon, 2 Oct 2023 15:30:51 +0000 Date: Mon, 2 Oct 2023 11:30:42 -0400 From: Gregory Price To: Jonathan Cameron Cc: Gregory Price , linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, linux-cxl@vger.kernel.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, arnd@arndb.de, akpm@linux-foundation.org, x86@kernel.org Subject: Re: [RFC PATCH 2/3] mm/mempolicy: Implement set_mempolicy2 and get_mempolicy2 syscalls Message-ID: References: <20230914235457.482710-1-gregory.price@memverge.com> <20230914235457.482710-3-gregory.price@memverge.com> <20231002143008.000038ac@Huawei.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231002143008.000038ac@Huawei.com> X-ClientProxiedBy: SJ0PR03CA0265.namprd03.prod.outlook.com (2603:10b6:a03:3a0::30) To SJ0PR17MB5512.namprd17.prod.outlook.com (2603:10b6:a03:394::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR17MB5512:EE_|DM6PR17MB3755:EE_ X-MS-Office365-Filtering-Correlation-Id: cc26fb84-4cf9-48e3-786a-08dbc35c8f26 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oaDIe0CPxLJntsLjiUrcvg8JJEgzWG+ZJairwVW/sj0idPrL4CMxj7EHQtt8gh2sWmJ4dzBHMnreS8AodZ+hjbMLRK7B+DFmBLOUoU/5u8eacgPnmFrqxi+Q3+7feBjF+0jcHhditLAVJXlq6Afevh8nQdb1pGqD1YIxHPrP8rJn67kzgqFqa0KfPBZqJf/eL0q79yY3KrIpnEN9a9mUU9pHCJ08VHe5v/oj24lMmHPBb+I/Tm+3Gi/tvBXVG10UJRGxoxdEbfkzFWFTe7I7+sAdKGMEoRA+RVUYx0gPMsF+94l1zk5InaOWOPy09MZtZDM8mDwdQZRpQ19y0aPRzO3OTHIzaIA+CpJaKlkbd8X0oVVxC4yjMSoMufoFl8GI4HPgY7/gNvXr9DzGw2Qy5utT+mOq/2Y33FpXniJNLDzojRkLzV+s+OM2DoOMF5Oa68G8OVaWMPeW2F/YrQTfiZ/3NxDItepJP0wq8qrMWvmI5Hyz3E4XuElanrSx1/wvli8UPffiuuSPVX+kH/chk5whhxmyEJ8OOtvZ7lVKvEEwY68yRWUtQWmKY+/ztByi 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)(376002)(346002)(396003)(39840400004)(366004)(136003)(230922051799003)(1800799009)(451199024)(64100799003)(186009)(66556008)(66476007)(66946007)(316002)(6916009)(2906002)(478600001)(2616005)(8936002)(8676002)(4326008)(26005)(44832011)(5660300002)(6506007)(6512007)(6666004)(7416002)(6486002)(41300700001)(36756003)(38100700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?w9k70vMeDI6pRh0gtk8C4d9eW5IFcwXJYW65r+XfUpBpPxoU7z9YIXVa3kiL?= =?us-ascii?Q?vPYnVjHS/4aD1SdR88Ifd2T3zmdhJ6cIB+Snzv1Eig5nQoDV6kNrqrHpZMNf?= =?us-ascii?Q?gaAfnu2FRfd4N80sNPgoQ+SVr2zl0VEcyAg1LSUjvMiRO+sDAKGaJ2+4Vx9Y?= =?us-ascii?Q?r0KHWZIDYJT8xtOcoFMGNvjK+0EKlLbOtb9PuEDhB2P8ix5LsElph1o+yiVX?= =?us-ascii?Q?7fIVpbMotf1dPTbcdSzER1Xijj3rC9ZbVWRlepQAfr9EOCfNXj6mX9Qc4RVd?= =?us-ascii?Q?lOWVN7qyYyr1wVmXqbdg4QEv9jYCU16HtH81Flc98lvoU2Wjf6zKXLNSY/oA?= =?us-ascii?Q?zcX/5bdRuG5XE9JFcLPwvLozNnFe8FuonwCE0CylHBKtd2vXW/upJxJyDnwU?= =?us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acyz8sLQ+5V0zR4WmoXi4NIyyXfXxu?= =?us-ascii?Q?AmGte7hNj1g37o2LLYQljXhsj/B3GIKkvWy2XNcF8piWe1ESb4yds5YUH5Ng?= =?us-ascii?Q?vEDaIPJRuU0kx5I0JTytHBhD1EL4Yd9fHCGiyxecscVKiPMKEIsqJ5F62dGQ?= =?us-ascii?Q?MzDEmdIW1+lVZUyOM8Oy3oxNFxObS8ylEdSR1zVgSElni08ME6IDjFi/uJMy?= =?us-ascii?Q?8mrhR2X0p8RyEEYrmr+uuNA2h6d0HmLbRJr9xko3D0zlA8OaBrSLqCzdUcmV?= =?us-ascii?Q?LVYO3hc3ZoLQJdmHYQcK9U+MQFYX+YDy0NBASrUOFtzGUmvUgBupFTMAV1Fv?= =?us-ascii?Q?NQ=3D=3D?= X-OriginatorOrg: memverge.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc26fb84-4cf9-48e3-786a-08dbc35c8f26 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR17MB5512.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 15:30:51.1241 (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: y3/A5cqQHETY8ZOIKkVI2+yXikaANhQqdMpH2kOrqIeWGidyOtzYMjIDMP9hPBQazy6KQyWA+Ihcg0kVxj4SxWv1c1Jkg4Ts53xDblyDD5s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR17MB3755 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Mon, 02 Oct 2023 08:31:20 -0700 (PDT) On Mon, Oct 02, 2023 at 02:30:08PM +0100, Jonathan Cameron wrote: > On Thu, 14 Sep 2023 19:54:56 -0400 > Gregory Price wrote: > > > diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h > > index abe087c53b4b..397dcf804941 100644 > > --- a/include/uapi/asm-generic/unistd.h > > +++ b/include/uapi/asm-generic/unistd.h > > ... > > #undef __NR_syscalls > > -#define __NR_syscalls 453 > > +#define __NR_syscalls 456 > +3 for 2 additions? > When i'd originally written this, there was a partially merged syscall colliding with 453, and this hadn't been incremented yet. Did a quick grep and it seems like that might have been reverted, so yeah this would drop down to 453/454 & __NR=455. > > + /* Legacy modes are routed through the legacy interface */ > > + if (kargs->mode <= MPOL_LEGACY) > > + return false; > > + > > + if (kargs->mode >= MPOL_MAX) > > + return false; > > + > > + return true; > > This is a range check, so I think equally clear (and shorter) as.. > /* Legacy modes are routed through the legacy interface */ > return kargs->mode > MPOL_LEGACY && kargs->mode < MPOL_MAX; > I'll combine the range, but i left the two true/false conditions separate because it's intended that follow on patches will add logic before true is returned. > > + kargs->get.allowed.err = err ? err : 0; > > + kargs->err |= err ? err : 1; > if (err) { > kargs->get.allowed.err = err; > kargs->err |= err; > } else { > kargs->get.allowed.err = 0; > kargs->err = 1; > Not particularly obvious why 1 and if you get an error later it's going to be messy > as will 1 |= err_code My original intent was to just allow each section to error separately, but honestly this seems overly complicated and somewhat against the design of almost every other syscall, so i'm going to rip all these error code spaces out and instead just have everything return on error. Thanks! Gregory