Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5058478rdb; Tue, 12 Dec 2023 18:46:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoiy4DguGGsZ/vhAX+pfz0QdzbiqvPm+EG1hScTIc0Q1PV6G0yANNKPygQKUfrrCZVuZJV X-Received: by 2002:a05:6830:1e4a:b0:6d8:74e2:a3e2 with SMTP id e10-20020a0568301e4a00b006d874e2a3e2mr6379990otj.62.1702435611470; Tue, 12 Dec 2023 18:46:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702435611; cv=none; d=google.com; s=arc-20160816; b=w+vxatzbKRiQq7AUGeaiTat5USMOL0k2EL/F4UHJPbioA2gSBNUyJvcMzUfuLk3vM7 EDWph5Gzadl1UgdhOOT5Mf1kAurw1W5zeEIz7OVQnAf8gEQtEPfCDifYl4VGeXN16vJJ use+/5n2d9i36rOS/4wA5L4Dz/gep3D/U5sCWy/kDJOpyKPwji6QtvK/n6vlLfbK7Qmz YWNW939P8CjIvcTYF04VPERDC2OTZJ5ehBcQH8u7Py88BulEvIlUzxbm8gwV2Ab1u8y4 sHmCZb57MYCjjcBXNTAR73iBr2ka+QZjanceN9vjIXsouKbJYYR0b2j/MpBnsoVCHoUH k3uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:dkim-signature; bh=TAHveQN+UOYGQM+UNhNCN/zVlJ+0jIhH3fuXYMIo4D4=; fh=E37LqaUMrmSwt3a9mA472eCcwhht6kBtjPaCAKxUGgs=; b=pRzmsDlpgIPICT0DaUIgf11Varvd+9Z8+BmnbKKclmbi7QdtZlluEtOR7wvGV52LLC pUCdBObQMG2lY3rfLyO7WqHJs3Vim4uwj4ctXtA96tZsb2zZI7nvA5BxInW7cnCu7Try N8TLPUWfAptRGbbOrDAvuoPLq68m4DP/LauOxiDiTjqRfVsTNVBP/zTDeIGwvH43KcP2 E8l+Vq1uee+pkYpXN+qMAKpkfooKYW5og9m6ihpC+txCQ2EFGcPtkd48Tu9oHoRXf6ee 3hV828MR5JWYm/+WHw4csxcXUtShHCWY2FyQ8JJabe7fFP03RMfv3CJ2STaEZlDwxYPR GrRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=E9K1L8Nk; 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=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ca10-20020a056a02068a00b005be0050a443si8835339pgb.430.2023.12.12.18.46.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 18:46:51 -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=@intel.com header.s=Intel header.b=E9K1L8Nk; 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=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6F55280B8E56; Tue, 12 Dec 2023 18:46:50 -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 S1378288AbjLMCql (ORCPT + 99 others); Tue, 12 Dec 2023 21:46:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232295AbjLMCqj (ORCPT ); Tue, 12 Dec 2023 21:46:39 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD5B0A1; Tue, 12 Dec 2023 18:46:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702435606; x=1733971606; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=HeA8jqVHlKL8RuAwlVwqlEfSLUf01LuyOK0z4h52XBU=; b=E9K1L8NkXiwvE8fDUPMWUEOiMS9H8D41NxJxxGD7pTJwcIqp9QlaqDsq h0vDJhhzXywSBBP5IwyqZrCPG3szk7RQ/B+ZdJEbd/6DGfYw/+b6Ua5c4 JmN2q3cO72YukyM13Kq60uMkctSEzYqBlEm1anIxY6JbmNLjXgVZGDwje sPDW3Q/xhfhTa8wlmaMBErgIkgVicdDupxArRzxvj7KxJ2hk0UpZR4nrT bzXXWyVOzTdNLIdRZLZxJPZQMdPb23GxAiIiWQEtKpwPGPSuCSxWAT5Z3 GotW5FtEWlSxoeQwdStJKVDIFnD1ZY3AmcbR1Y7CSEll62/6WkBifmf7e g==; X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="8281547" X-IronPort-AV: E=Sophos;i="6.04,271,1695711600"; d="scan'208";a="8281547" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 18:46:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10922"; a="808005595" X-IronPort-AV: E=Sophos;i="6.04,271,1695711600"; d="scan'208";a="808005595" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2023 18:46:35 -0800 From: "Huang, Ying" To: Gregory Price Cc: Gregory Price , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Johannes Weiner , "Hasan Al Maruf" , Hao Wang , Dan Williams , Michal Hocko , Zhongkun He , Frank van der Linden , "John Groves" , Jonathan Cameron Subject: Re: [PATCH v2 00/11] mempolicy2, mbind2, and weighted interleave In-Reply-To: (Gregory Price's message of "Tue, 12 Dec 2023 10:59:06 -0500") References: <20231209065931.3458-1-gregory.price@memverge.com> <87r0jtxp23.fsf@yhuang6-desk2.ccr.corp.intel.com> <87plzbx5hz.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Wed, 13 Dec 2023 10:44:35 +0800 Message-ID: <87zfyestws.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,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]); Tue, 12 Dec 2023 18:46:50 -0800 (PST) Gregory Price writes: > On Tue, Dec 12, 2023 at 03:08:24PM +0800, Huang, Ying wrote: >> Gregory Price writes: >> >> >> For example, can we use something as below? >> >> >> >> long set_mempolicy2(int mode, const unsigned long *nodemask, unsigned int *il_weights, >> >> unsigned long maxnode, unsigned long home_node, >> >> unsigned long flags); >> >> >> >> long mbind2(unsigned long start, unsigned long len, >> >> int mode, const unsigned long *nodemask, unsigned int *il_weights, >> >> unsigned long maxnode, unsigned long home_node, >> >> unsigned long flags); >> >> >> > >> > Your definition of mbind2 is impossible. >> > >> > Neither of these interfaces solve the extensibility issue. If a new >> > policy which requires a new format of data arrives, we can look forward >> > to set_mempolicy3 and mbind3. >> >> IIUC, we will not over-engineering too much. It's hard to predict the >> requirements in the future. >> > > Sure, but having the mempolicy struct at least gives us more flexibility > than the original interface. > >> >> A struct may be defined to hold mempolicy iteself. >> >> >> >> struct mpol { >> >> int mode; >> >> unsigned int home_node; >> >> const unsigned long *nodemask; >> >> unsigned int *il_weights; >> >> unsigned int maxnode; >> >> }; >> >> >> > >> > addr could be pulled out for get_mempolicy2, so i will do that >> > >> > 'addr_node' and 'policy_node' are warts that came from the original >> > get_mempolicy. Removing them increases the complexity of handling >> > arguments in the common get_mempolicy code. >> > >> > I could probably just drop support for retrieving the addr_node from >> > get_mempolicy2, since it's already possible with get_mempolicy. So I >> > will do that. >> >> If it's necessary, we can add another struct for get_mempolicy2(). But >> I don't think that it's necessary to add get_mempolicy2() specific >> parameters for set_mempolicy2() or mbind2(). > > After edits, the only parameter that doesn't have parity between > interfaces is `addr_node` and `policy_node`. This was an unfortunate > wart on the original get_mempolicy() that multiplexed the output of > (*mode) based on whether MPOL_F_NODE was set. > > Example: > if (MPOL_F_ADDR | MPOL_F_NODE), then get_mempolicy() would return > details about a VMA mempolicy + the node of that address in (*mode). > > Right now in get_mempolicy2() I fetch this unconditionally instead of > requiring MPOL_F_NODE. I did not want to multiplexing (*mode) output. > > I see two options: > 1) Get rid of MPOL_F_NODE functionality in get_mempolicy2() > If a user wants that information, they can still use get_mempolicy() > > 2) Keep MPOL_F_NODE and mpol_args->addr_node/policy_node, but don't allow > any future extensions that create this kind of situation. 3) Add another parameter to get_mempolicy2(), such as "unsigned long *value" to retrieve addr_node or policy_node. We can extend it to be a "struct *" in the future if necessary. > I'm fine with either. I originally aimed for get_mempolicy2() to be > all of get_mempolicy() features + new data, but that obviously isn't > required. -- Best Regards, Huang, Ying