Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3191590rdh; Mon, 27 Nov 2023 08:16:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEmCO5Hfiy6QGG+kh57t2JClXcecobE16qJcl4jCwJyBcydwUptx/NODBIwL1A5owcdVM7l X-Received: by 2002:a05:6830:11:b0:6cd:a9d:bc57 with SMTP id c17-20020a056830001100b006cd0a9dbc57mr13404036otp.32.1701101774836; Mon, 27 Nov 2023 08:16:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701101774; cv=pass; d=google.com; s=arc-20160816; b=azLZEznp8UPbfJg8Sib2He6JHbUYy74WzAAg+AIye2BhCmtSD8EgursvS7GBBGbXnd bXCHoZf1tJDXtmSCUXsyomeyMVqHscV0Gix+Be8SxEdGSlZrGG4unYHS4yWI6tJy1d1u 9ZN03PzFPGr4IsRHDA6i/cxoJqaBC1sQTNYh75amJZnq/EPd6LIpx24bGgNTOUKvO7pj FyXjrIzx5KQRBgr3Fm8sUhBfggnDhaO4jPLFACee6ech9NFCpiToESEzsT1ntKcmZaEd asMOwkNWz5gEIwIs03GLPzQ/AvBmRnDHmU3TRDPHR5Z2hOKoGUtC/SLoPKhuQIU5lumX 6Y1A== 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=D1Aw9pyMUxxgXTGggCIAPDiOg8gt/pGqW9ZRsYPBCHs=; fh=448dP942/3OGbtos9B2G1vkYrvYHgwtSdjP+VYKWjqM=; b=jL2LissOT0u+vTFN7GTvPfMrPCvGm/bv2LggWqrPQ4mFxhHyvpZAPM+yrprGmdCkxH yVSR6NwpZDpIBbDLLhV+xsmPsfY+tKe7g46LIc6U4s398PtH8SZKwQjSydTZeKHQAlQX XgsRPSKIGW9F2Dvtt+U8CUxSzRLaU0MRPAMr3lncMKo1sBfZOpN4uSYH1dJ2onTYFm5G Mzoi6RTxl35BT2mCal9N8I8woqFUOLEqjmBZRNEgvRGOMEs8vuJc3N5longz+Y4LJ3Xr RoLsjxf3lSA8+0ilkNZ8TXvkWRREK4CI6fPILmnW7XufsAA2HmLGVVKOywMpmU8zx99f IEEQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@memverge.com header.s=selector2 header.b=BBykjkBh; 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:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id df15-20020a056830478f00b006c8faf051c0si3726499otb.341.2023.11.27.08.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 08:16:14 -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=@memverge.com header.s=selector2 header.b=BBykjkBh; 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:3 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 lipwig.vger.email (Postfix) with ESMTP id EB34B807C568; Mon, 27 Nov 2023 08:15:24 -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 S234485AbjK0QPI (ORCPT + 99 others); Mon, 27 Nov 2023 11:15:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234467AbjK0QPE (ORCPT ); Mon, 27 Nov 2023 11:15:04 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2065.outbound.protection.outlook.com [40.107.223.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 438211B4; Mon, 27 Nov 2023 08:15:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R7quJ0/JhwPoe+pjjBa+dIpSHhAZfAqMR40VItdl9NPp4i/GdC4a4fG/r6qeWApLWnbnfOmHKtW63CZJvLkrfeQjdbm9AYiWNqndySDjXMZBb9cLzBc4Fe6YGsuRNNi5BgYhsf36GaqPYKs68+2sVJwxQFLNk7Evbw5MmrQPW1aYOG9uLa7ZlcIAfhGGE+Un2StoA1mNPSCGTMrDoi4/ZBaPJW1o6O9e7+Q5WXaJur4EgsY+jzDy+r72hbjgG7wGDGPpkqlfPkLtYR2QpdSvLU7uQA2W0RL3NIq7I3AutshSZeYU0R/tBwlbBlA6Xr3GDzpu1pume3mNI74TGsZjqQ== 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=D1Aw9pyMUxxgXTGggCIAPDiOg8gt/pGqW9ZRsYPBCHs=; b=kcmm0DCs4Zex+vMBVnh9RM5nRRmao4GICkhzVtYwCCYuCdsZ9u8e2l8S6mkFpCbaQN9zpQLceZDGCcZwen9KmqkM/JUfKZIHDxFKKRDQoKz5jEyWXvI/qSp7uUTsnfv7DQVDbodrf5BGou7kWbUzvH7ZsCrz2FnLJpJ6/j1rAuZHbDk0jXpDnM5uOkW9ntj0sRt0hanPueuvmrDZMfuQqZImj638qlzASUQ7M+KCGfihtJqZmpYjC3XwzcDRjc2z2b/xA7L/RkimtvUPRSs2NHmwD8CvWgrkB0vhEPX6XgTOpaQcxHzD48+lqgqE34QgtcCLyXjwupgIfjrtQjlBmw== 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=D1Aw9pyMUxxgXTGggCIAPDiOg8gt/pGqW9ZRsYPBCHs=; b=BBykjkBhmXAEcUZsNoYM+diuwyg0QPKWathNjmg1p8vsYOKpJPVfYpS3sZvu+Xed2eWpbR/W/YFuMh7r7mOsUWb2rp8l9HppRurUFjdimya5LPswf2FeKtnPtj+zLdmNmmiXL/hZBc8mn/ipnNP47frLqZNQ7KR5zhRradSJ6dw= 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 SJ0PR17MB4837.namprd17.prod.outlook.com (2603:10b6:a03:37a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.19; Mon, 27 Nov 2023 16:15:00 +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.7046.015; Mon, 27 Nov 2023 16:15:00 +0000 Date: Mon, 27 Nov 2023 11:14:44 -0500 From: Gregory Price To: Michal Hocko Cc: Andrew Morton , Gregory Price , linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, tglx@linutronix.de, luto@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, tj@kernel.org, ying.huang@intel.com Subject: Re: [RFC PATCH 00/11] mm/mempolicy: Make task->mempolicy externally modifiable via syscall and procfs Message-ID: References: <20231122211200.31620-1-gregory.price@memverge.com> <20231122133348.d27c09a90bce755dc1c0f251@linux-foundation.org> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: SJ0PR05CA0085.namprd05.prod.outlook.com (2603:10b6:a03:332::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_|SJ0PR17MB4837:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f5061f7-f429-4a1f-5661-08dbef640102 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: co4+9BfenST1vonnfpsWoyrrP3v8a7qTUHqj+gPRE8HpnpUMDV1Ceuh/u47M+Pq3/fYjZiHfOXDiBi1mWy1ktrsyoUrydEyZl+Un36+CYYhC0Lla/nWvnWvMZras3cWtYdq+FTNGvzpcdZRehTEQ44Y5yAFP15EB+AT9mxhJKdP4EjAHM0ZPx72jVIi41l363xj9m/kg6kXNIUdzgj4E35CXJesybRa6Q4Y0GWE/9OhFXzrLYSdF4PFRd6SDuJQculZIeWYzpXuqJ3qnB8k5sTZzcYKWKZ99o8DpYT+31pJTr+YMrP7PnW+3Ntj+6QC+hCBpKiUQQeen2Tb1QZM1PcBfYAswHdGl2ejNgEOiJBKkVAJdIZWrlkIG0MZsJb1WunXx9DCYz2t0JrsdkC8rQTN9zuRKipQQnnVAIDMA4HR4zTkvdkySbIN5Pr6m81qvcSdOkKbzP6Vvn1umnocX6nZLm1oOBZo4lzK0f1GDkc49RkaavyQQTDnRWdY99iSqYf2qs4OrX3jQQN+UybvDyZOA+U9kzKwVRuhl3XQufXh2BmmZq6/UZO33aQxjoqhGegwAu/2GZbIuTInUunH/SsDCHp+So7+SzE6QtJ1RQc0= 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)(136003)(366004)(346002)(39840400004)(396003)(230922051799003)(186009)(451199024)(64100799003)(1800799012)(26005)(6486002)(2616005)(6506007)(6666004)(478600001)(6512007)(38100700002)(36756003)(86362001)(5660300002)(44832011)(2906002)(7416002)(66946007)(83380400001)(41300700001)(66476007)(54906003)(66556008)(4326008)(8936002)(316002)(6916009)(8676002)(67856001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?9gI5u5UaE+LGl1pKWYmuVOx0Ppzy9Kf0xMqJk/wODCjJ25bngK7y4aEx5uWT?= =?us-ascii?Q?bsQshGTLqnNVg2UX9Zq95qHvP5aV2aK2YaYsEiRG+5tlEKmeACkf/38wvUt3?= =?us-ascii?Q?lTOUl9j1X/TzgO+Rh1s5/NrXyaeLDL+z3JZJiuVl8rpVKaBUl+4vWX03b2Zb?= =?us-ascii?Q?btiJDb3V5zWPMsZkjDii7OOSQoSUUMSseaWj4YUuaGTOQer3REQvUrZ+Syaq?= =?us-ascii?Q?gQ+36nCKaWLHnnf+WaQvKqswyxxzJUr3w8jmHD5GnULVYGn49NHttYyYxCcD?= =?us-ascii?Q?+COLAaV5OaNh14coREDz1MQrhdHcpkw1+FKGM69I7HAy6C29ZnlStO0FvwV5?= =?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mL12t0+S/yflNw2wbe4ayR?= =?us-ascii?Q?LxGfq2LJF1KjDhM0hgKhEdOI3BaIA7RamK88qlzdTw70dCOAHd80h+aIB1wQ?= =?us-ascii?Q?qfSqvCG+YzgU7r2rZCnlpTV3Qtd/VIkQxnSKg8yzw5TUdmSeZVA4t7bjm0Qw?= =?us-ascii?Q?nFUzQtcGNR3lut7WDrS2IRp+5LUWxYcrvX2aUavoj4+PO/Z9bLOqBL4VmOAh?= =?us-ascii?Q?4PRGRk/GspeGwvURAPiYrcrW3otGRso7u/5di3ukpM1LPI8+a1oF3/FjabfX?= =?us-ascii?Q?BHHYdcE8VE0sVXTHu37OkKao4Wi8zF7h4pGNKi4KPD9bIP70jlvZHpNfGz/a?= =?us-ascii?Q?mhjcZAEDG7pUQ4yRk9pCFB3Yx3UyQ4S3oA2MINGPz0vmkT6raTwpxjpbgKO5?= =?us-ascii?Q?3A=3D=3D?= X-OriginatorOrg: memverge.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f5061f7-f429-4a1f-5661-08dbef640102 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR17MB5512.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2023 16:15:00.2107 (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: ChMJJSg0PJsS3DAKA22nMf8nmlg7MiEnWkm4s5pZ7tDEN4wE9yLeB3LUT4u+p9jdv1jtDa3ISpxHUZae18WKSK3By/xgIdtYeIClLTGaaYI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR17MB4837 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 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]); Mon, 27 Nov 2023 08:15:25 -0800 (PST) On Mon, Nov 27, 2023 at 04:29:56PM +0100, Michal Hocko wrote: > Sorry, didn't have much time to do a proper review. Couple of points > here at least. > > > > > So... yeah... the is one area I think the community very much needs to > > comment: set/get_mempolicy2, many new mempolicy syscalls, procfs? All > > of the above? > > I think we should actively avoid using proc interface. The most > reasonable way would be to add get_mempolicy2 interface that would allow > extensions and then create a pidfd counterpart to allow acting on a > remote task. The latter would require some changes to make mempolicy > code less current oriented. Sounds good, I'll pull my get/set_mempolicy2 RFC on top of this. Just context: patches 1-6 refactor mempolicy to allow remote task twiddling (fixing the current-oriented issues), and patch 7 adds the pidfd interfaces you describe above. Couple Questions 1) Should we consider simply adding a pidfd arg to set/get_mempolicy2, where if (pidfd == 0), then it operates on current, otherwise it operates on the target task? That would mitigate the need for what amounts to the exact same interface. 2) Should we combine all the existing operations into set_mempolicy2 and add an operation arg. set_mempolicy2(pidfd, arg_struct, len) struct { int pidfd; /* optional */ int operation; /* describe which op_args to use */ union { struct { } set_mempolicy; struct { } set_vma_home_node; struct { } mbind; ... } op_args; } args; capturing: sys_set_mempolicy sys_set_mempolicy_home_node sys_mbind or should we just make a separate interface for mbind/home_node to limit complexity of the single syscall? Personally I like the dispatch for the extensibility nature of the arg struct, but I can understand wanting to limit complexity of a syscall interface for a variety of reasons. ~Gregory