Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp95401rdb; Tue, 19 Dec 2023 10:16:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQb5mKH6fy9J1kz5K5Ekek+H+/R7HYViQDMi9dUoIvc4UxvjwTMtrLYMYUp00E5uE9r+PI X-Received: by 2002:a17:906:af97:b0:a23:720c:3a3d with SMTP id mj23-20020a170906af9700b00a23720c3a3dmr894655ejb.46.1703009764983; Tue, 19 Dec 2023 10:16:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1703009764; cv=pass; d=google.com; s=arc-20160816; b=h9ymTv07vIjLJ5lekCOxaZWGPji2okoH8iDMH7ZqAhc5Y1FBO1znKZevzDcwD792Qk QsLJW7NEP2oImZLZgdxBDpmblOSHlszhqFVjtT2eo3FJC4MDNR7otYR4FdIWwr5Kocob p4w6XPISiNXuB6gsCgzjCbqrJySXVD0cN2tGaYcWfMHSIXN5pYmIZDXeTlht/58XN+n4 eS+etgM+s3MVUa8moQhmkf+K/1R7QK3Z3FwqIMvkGsW0FI/Y0PZ2O13VJtnqelO1I8e6 9iXdJrFIETrJtv02IQaB6ss7zWlZE4py65aTKdn70rVIB3fygn8ETQ+LSC0VQoN4dj+K 1rhQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:content-disposition:references:message-id:subject:cc:to :from:date:dkim-signature; bh=gc1dvVvEDDUGNeebCxCoW8yWbeAe/uVJwIXr7FzFCTg=; fh=0znk5HcsfZY8dAtwD5eluuluKzNOdylisJCDJplAg50=; b=MkOfeja/lPDzLs4JwtbJgwsHu7YMYg0RV/rOgN5iYMU4vcjMBF+ZMXUu80fUy7CWOE MXUSv8miQBVze/ovDqQxHKuXSP/MXQzkU22USjcfojNjpFUIXP/J+gzCifnnFQSSmR1c sMXhtNFivX092+yORx/xOBYrq/U/+bFVH6Lk7dZFlKpLFY9iM9k7waoeB4NMOYix6hRi 446y7evw0ITjhpSPvs0JrolF1GQLmdZrQiNO0zcJUpU5J+Qc4Oa3ReY0HEQKJiKL+2wi ILBOS5qTJg9o1WgSp8HiucOACYllikupgXzjm+ubQfPWABfPanPLDYnafEH4TUTt+N2B Jhbw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@memverge.com header.s=selector2 header.b=UZ3iX+rG; 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+bounces-5772-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5772-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=memverge.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id e12-20020a1709067e0c00b00a235d85de90si1741480ejr.238.2023.12.19.10.16.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 10:16:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5772-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=@memverge.com header.s=selector2 header.b=UZ3iX+rG; 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+bounces-5772-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5772-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=memverge.com 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 DC1E41F24DD1 for ; Tue, 19 Dec 2023 18:09:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05E9737D28; Tue, 19 Dec 2023 18:09:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=memverge.com header.i=@memverge.com header.b="UZ3iX+rG" X-Original-To: linux-kernel@vger.kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2053.outbound.protection.outlook.com [40.107.223.53]) (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 82A4A37D00; Tue, 19 Dec 2023 18:09:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=memverge.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=memverge.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KTs0k7awVyhWmfs3CcW8T6JXVSjbg4RfoQPUlZ+goNdOir3by6x0wUAydoMJbpOqyYoMc2fLVkCW/uugmthZ5r3jqMtjguyKoRyhSmya66MfgEzx8B8ZWFhlr9lBFXxLmPpUOUPIvLPkdE332BU/8jCu4mJIXL8FpMMaAOdHtcvPmEU2ukEFcPhrU5PCuV1libnzUde0DehO5kKoCVDC2TthgqqhEWQJH8xNMWP2H3+3jI/qbndvSygPi29871tk66/8mbjJ9/vapU4zA9cl0dmfTEI21jk8jckN+u8mA+cPclYtseKNp8ZKROZdI0DJZ1d5qnU0/YcmGNgj5p5WAg== 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=gc1dvVvEDDUGNeebCxCoW8yWbeAe/uVJwIXr7FzFCTg=; b=A7cMRSrbtvG/i6EjmYMBWZEdhhR9nN0zm0pexa0V42JuzAAM2SJ+ixhFNQb9GqNBYAiXUQj0k0iuh9s4TJMqgFCCXs7YUi+BCJHRT6x15YQXtpo7XhGMwUPS6ZEY0F7XSGqR70k1HFAwmMyg6ARlUSInIQIHvO0vlAKJx/TyPCiOq7Zp6zBwRvPSkvrxJTYJq9AJDQQUIcyvGeKu8h4egzKDd1tbC6y851o5TkhVjKyMDkEd+aBwkW4z0sV4PWi5ktnbKBxcz8PFJr30u9yUOPJFQWfXPhOYXvywwphax+quLIhO8ZUamY9cLkP6QCWTSXXFoSnO5TH7ikwLlYpHRw== 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=gc1dvVvEDDUGNeebCxCoW8yWbeAe/uVJwIXr7FzFCTg=; b=UZ3iX+rGL8gp8FCU8uE8pbDN5jlc623EX+Pm1mGbkCXBIkojoTHIGIraykZtljidUKgjDMZfWHWnG7Bd3apOqdv6oOQpR/bJp3K30o0cVGOfVckQGJ85BZ9RH5DMRVl5r9W16I9jUmgDTTxe0iNBYvauZaoMZl6V+JN7W7SHYfs= 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 BLAPR17MB4097.namprd17.prod.outlook.com (2603:10b6:208:27a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.38; Tue, 19 Dec 2023 18:09:09 +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.7091.034; Tue, 19 Dec 2023 18:09:08 +0000 Date: Tue, 19 Dec 2023 13:09:02 -0500 From: Gregory Price To: "Huang, Ying" Cc: Gregory Price , linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, x86@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, 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, Johannes Weiner , Hasan Al Maruf , Hao Wang , Dan Williams , Michal Hocko , Zhongkun He , Frank van der Linden , John Groves , Jonathan Cameron Subject: Re: [PATCH v4 00/11] mempolicy2, mbind2, and weighted interleave Message-ID: References: <20231218194631.21667-1-gregory.price@memverge.com> <87wmtanba2.fsf@yhuang6-desk2.ccr.corp.intel.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87wmtanba2.fsf@yhuang6-desk2.ccr.corp.intel.com> X-ClientProxiedBy: BYAPR01CA0007.prod.exchangelabs.com (2603:10b6:a02:80::20) To SJ0PR17MB5512.namprd17.prod.outlook.com (2603:10b6:a03:394::19) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR17MB5512:EE_|BLAPR17MB4097:EE_ X-MS-Office365-Filtering-Correlation-Id: 047b7cb4-bb97-4138-04cf-08dc00bd982d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rM2FKnD3I1/SZpnJOb9AmuhPHh7r+UEEZH+W2xomjgBF3RHp5+6ngF3sxnXmpYdzD7V8GlAVtcWJUxg0F/mkuyaSVp2excByM9yFxIZk7vtbITlB97uP1wxpBEfryyk/QUie4E0dJ370BDxrvs4fPHWYaASuBz31UIqd3Q94q4zRICj9AZmY6SsuiT0rBDZNH3nPkMGcsEjQnygGdo6qUSsYaFo8TP2cgiRstovnRJbhVhpFFsvDm+Mjd+3uuOrAq29K8uxHorbw1YqwFs9WkjjKv8zFTeqJUkTWtei3UCG4UJUlLnV/3fCtCm0ZKHaz41RAXdI9BTZaYyQpZdRQbUKoxQIIkxLeO0wXh2Rx3QHEEOGrlNMngcBnNENuKdei9vnpvzx2Yn75X29wxcFjcvJsfSclEuE99Ra5Ja629wDzTOyEOu9t0O+9JvQtULbSMHtQuc69QPFmK99KQXPzmzP/QiJ+O54hShmyTp5gZk7ogOP7ITMtyQlhYSBgQAlIz9wP54D1Pb79a0RYhnRysy9L+JZx/pIa/rDb11XyAdwYRxzdM8sY6O1fp5AcB0jUNBOEm4zRRRG2P3qumgGMTKAAMx+yTLvJPiKKLd1IICdVVSMfEWnFEXvttzIkOBp7 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)(376002)(39840400004)(136003)(366004)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(478600001)(4326008)(26005)(38100700002)(7416002)(44832011)(7406005)(41300700001)(8936002)(2616005)(5660300002)(6512007)(6486002)(2906002)(66556008)(66946007)(6666004)(6506007)(8676002)(54906003)(316002)(66476007)(6916009)(36756003)(86362001)(16393002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8vVI8WMMe2BfP7jCoOY2RC05UlpJpM0uHTfWxnccPNlRpLBKTlZT9Zi5HKPR?= =?us-ascii?Q?/j+K3W7n3yH2m2ThCEV3I9SouqDDO+LWyy81g64kU2MAIalBCmpE9zTUjIJW?= =?us-ascii?Q?/P0ePH+YSwLNgK6ONTZKsmhMNaQtbkjC1ysRuE7fa7VWY8aZMkyirVzitrB6?= =?us-ascii?Q?laXS+MlR8rzCN5/hFmXTogM+plUczMA/F1tcg5Q6hPCfiBLVq15VqqHjxccU?= =?us-ascii?Q?ybw1K3lqTkVRrYQr7jyNF74VRKtONWook/hh1cAn/lpQgR8bLZgGph63350N?= =?us-ascii?Q?89WtmsG9cqkO2Xq0Kk5fHJGVnq409Kj4TX5RxKI3Uv/9ZOVkOjOuyyfsgUPQ?= =?us-ascii?Q?VMJKrQUa3ip/gd7/7RBqDyecpxZ2y9l7MDS9W2stDZ2483MXE7I8Z5gdkIgw?= =?us-ascii?Q?7bnBTv69rLMf0y10oY2H3XKB7bNPIWG54aRo0UzIlEnqgBKsj3yv699Sz1vI?= =?us-ascii?Q?kQ4Y+0uUlhXO/0/zle+1IliJNBaxYBUN5uX6udhbU+pkuUfckX+rZKDENMAx?= =?us-ascii?Q?x+G5Db/ipIp+32sAeBDOAOwx3Lx0QbJkkhkDRMYFzLm1NdnICpfkT0g78/Nz?= =?us-ascii?Q?HnjqSxxX8FQuIuiLs7eCBYjUN4Bji0yqKUGErpruEe/MJCSug/xxI7M6hbF/?= =?us-ascii?Q?umiq4Qe8HOHNQapHwCfUcTl/nes9Iyo7tbqoLPEGnQyn71WcW3IiQjBZcTyh?= =?us-ascii?Q?X/nxyhfz/o9ns+RfyqYZysW14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2n?= =?us-ascii?Q?kg=3D=3D?= X-OriginatorOrg: memverge.com X-MS-Exchange-CrossTenant-Network-Message-Id: 047b7cb4-bb97-4138-04cf-08dc00bd982d X-MS-Exchange-CrossTenant-AuthSource: SJ0PR17MB5512.namprd17.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Dec 2023 18:09:08.3407 (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: k1OtG37z6u48cOprkEcDcGVk4g/HcCPGzNw+prGsE/8ZjiQcmAixYIe4EPGQ7HwwA9dusC/DwCF7V+PI3FJtVwJde0EhCNTT/7VfoYPls5s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLAPR17MB4097 On Tue, Dec 19, 2023 at 11:04:05AM +0800, Huang, Ying wrote: > Gregory Price writes: > > > This patch set extends the mempolicy interface to enable new > > mempolicies which may require extended data to operate. > > > > MPOL_WEIGHTED_INTERLEAVE is included as an example extension. > > Per my understanding, it's better to describe why we need this patchset > at the beginning. Per my understanding, weighted interleave is used to > expand DRAM bandwidth for workloads with real high memory bandwidth > requirements. Without it, DRAM bandwidth will be saturated, which leads > to poor performance. > Will add more details, thanks. > > struct mempolicy_args { > > unsigned short mode; /* policy mode */ > > unsigned short mode_flags; /* policy mode flags */ > > int home_node; /* mbind: use MPOL_MF_HOME_NODE */ > > nodemask_t *policy_nodes; /* get/set/mbind */ > > unsigned char *il_weights; /* for mode MPOL_WEIGHTED_INTERLEAVE */ > > int policy_node; /* get: policy node information */ > > }; > > Because we use more and more parameters to describe the mempolicy, I > think it's a good idea to replace some parameters with struct. But I > don't think it's a good idea to put unrelated stuff into the struct. > For example, > > struct mempolicy_param { > unsigned short mode; /* policy mode */ > unsigned short mode_flags; /* policy mode flags */ > int home_node; /* mbind: use MPOL_MF_HOME_NODE */ > nodemask_t *policy_nodes; > unsigned char *il_weights; /* for mode MPOL_WEIGHTED_INTERLEAVE */ > }; > > describe the parameters to create the mempolicy. It can be used by > set/get_mempolicy() and mbind(). So, I think that it's a good > abstraction. But "policy_node" has nothing to do with set_mempolicy() > and mbind(). So I think that we shouldn't add it into the struct. It's > totally OK to use different parameters for different functions. For > example, > > long do_set_mempolicy(struct mempolicy_param *mparam); > long do_mbind(unsigned long start, unsigned long len, > struct mempolicy_param *mparam, unsigned long flags); > long do_get_task_mempolicy(struct mempolicy_param *mparam, int > *policy_node); > > This isn't the full list. My point is to use separate parameter for > something specific for some function. > this is the internal structure, but i get the point, we can drop it from the structure and extend the arg list internally. I'd originally thought to just remove the policy_node stuff all together from get_mempolicy2(). Do you prefer to have a separate struct for set/get interfaces so that the get interface struct can be extended? All the MPOL_F_NODE "alternate data fetch" mechanisms from get_mempolicy() feel like more of a wart than a feature. And presently the only data returned in policy_node is the next allocation node for interleave. That's not even particularly useful, so I'm of a mind to remove it. Assuming we remove policy_node altogether... do we still break up the set/get interface into separate structures to avoid this in the future? > > struct mpol_args { > > /* Basic mempolicy settings */ > > __u16 mode; > > __u16 mode_flags; > > __s32 home_node; > > __aligned_u64 pol_nodes; > > __aligned_u64 *il_weights; /* of size pol_maxnodes */ > > __u64 pol_maxnodes; > > __s32 policy_node; > > }; > > Same as my idea above. I think we shouldn't add policy_node for > set_mempolicy2()/mbind2(). That will make users confusing. We can use > a different struct for get_mempolicy2(). > See above. ~Gregory