From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8258C46CD2 for ; Wed, 3 Jan 2024 02:48:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 55EF76B0250; Tue, 2 Jan 2024 21:48:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 50F566B02B0; Tue, 2 Jan 2024 21:48:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B0586B02B2; Tue, 2 Jan 2024 21:48:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 29B686B0250 for ; Tue, 2 Jan 2024 21:48:03 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 04506406B0 for ; Wed, 3 Jan 2024 02:48:02 +0000 (UTC) X-FDA: 81636465246.21.80C0572 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by imf30.hostedemail.com (Postfix) with ESMTP id 84EC08000F for ; Wed, 3 Jan 2024 02:48:00 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=nM2DIokX; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf30.hostedemail.com: domain of ying.huang@intel.com designates 192.198.163.10 as permitted sender) smtp.mailfrom=ying.huang@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704250081; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LjBEF+aE+v20MM0cC1qADCJb7ikUzZ9I1PqwBNNJ4tE=; b=z1XcNc/hfZRZXRJeYjJOnPKqE99EOR4CSVnZPmlTH3GW/BSdDGtUUHD5VEyzZeLx6gy5Ng xEqcefjPJVH+bgpNUW9juM/Px+WoLIm6MelwzrMlSO2VYJeRmowbjHBU9n70MbQOlcSY1V ikYadErIV0lZCpUnJsN1H9GM1CxdkW0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=nM2DIokX; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf30.hostedemail.com: domain of ying.huang@intel.com designates 192.198.163.10 as permitted sender) smtp.mailfrom=ying.huang@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704250081; a=rsa-sha256; cv=none; b=uymr/4zOZdVvMK5eGPza2SY0k36zKZ9FHHS8D8f6VHf/n7LSGgBFVoT1ukjbN38bGjqD9/ 4s/Jah2ZUXv/Xsa3CruwBTc42cOg3L35KyW8fGxkPAECGCdJgvvOSFtoz8oY6m81aYIRZV O3YMaESjrfwgg89yrWbgzOCutLs+I0w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704250081; x=1735786081; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=C5JwH9fEKPVEcWQ0YdUxfI3bk6UZvB0UjPBFwXAKdi0=; b=nM2DIokXkPUb+RLD9LPQHjl2tRHV6JMIPr7vaZFRVkauPr3+TgXPIhkf aADHUfInZvPPeB1O9O0Knje8/kYU3urfzrjeloIcNeQVSLjnV89gMNKDC b7HYdgd8AvbdzRbF4m581svZLrit4GPQbgd7cDRCxtYb76G8tYizsb8SQ fEdmI+gMzeCO6eweKJmpc3YYIjjKJZd8Nhk+gcvDeOKluOSryyEmrQooo 9+0O2VHSr9l8WbubwnXcHLcY4FWwumKplQn5/9Bu05I4fnm1CnoWsVRAa 0FwDc5O3ikuLRyEw8Jnu0AsDzrp5lgD7I8VFkOdrupbIe8cUMILBpGeLY A==; X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="4301212" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="4301212" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jan 2024 18:47:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10941"; a="814123225" X-IronPort-AV: E=Sophos;i="6.04,326,1695711600"; d="scan'208";a="814123225" 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; 02 Jan 2024 18:47:51 -0800 From: "Huang, Ying" To: Gregory Price Cc: Gregory Price , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v5 01/11] mm/mempolicy: implement the sysfs-based weighted_interleave interface In-Reply-To: (Gregory Price's message of "Tue, 2 Jan 2024 14:45:23 -0500") References: <20231223181101.1954-1-gregory.price@memverge.com> <20231223181101.1954-2-gregory.price@memverge.com> <877cl0f8oo.fsf@yhuang6-desk2.ccr.corp.intel.com> <87h6jwdvxn.fsf@yhuang6-desk2.ccr.corp.intel.com> Date: Wed, 03 Jan 2024 10:45:53 +0800 Message-ID: <87wmsrcexq.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-Rspam-User: X-Stat-Signature: 9dsodqxt7qqp5fwocyoypkkdeqfnm7yo X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 84EC08000F X-HE-Tag: 1704250080-1426 X-HE-Meta: U2FsdGVkX19e17fKpbmsIBi3FJNby5Bv/BcW+gSI1EN1gyY+doItb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cH0wMY4oKlqaYEv3DxK9iguoxcnIuX+Wvajzq7QEuqUNXMSkrIMaFiQLYPXO/NTpLIcaeCjz7fEQNC4tqDGbhov7Kh5G3Xj5AiEQU15w7hgbUPqhiqBSg8yIOiXy8a65sW8nzotmFCwHF/Y7gMaEy00MP/77iN75Eftu0uG4YlSTYLZxySjk0Mw= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Gregory Price writes: > On Tue, Jan 02, 2024 at 03:41:08PM +0800, Huang, Ying wrote: >> Gregory Price writes: >> >> That is, if we use "1" as default weight, we need to change weights of >> nodes frequently because we haven't a "base" weight. The best candidate >> base weight is the weight of DRAM node. For example, if we set the >> default weight of DRAM node to be "16" and use that as the base weight, >> we don't need to change it in most cases. The weight of other nodes can >> be set according to the ratio of its memory bandwidth to that of DRAM. >> >> This makes it easy to set the default weight via HMAT/CDAT too. >> >> What do you think about that? >> > > You're getting a bit ahead of the patch set. There is "what is a > reasonable default weight" and "what is the minumum functionality". I totally agree that we need the minimal functionality firstly. > The minimum functionality is everything receiving a default weight of 1, > such that weighted interleave's behavior defaults to round-robin > interleave. This gets the system off the ground. I don't think that we need to implement all functionalities now. But, we may need to consider more especially if it may impact the user space interface. The default base weight is something like that. If we change the default base weight from "1" to "16" later, users may be surprised. So, I think it's better to discuss it now. > We can then expose an internal interface to drivers for them to set the > default weight to some reasonable number during system and device > initialization. The question at that point is what system is responsible > for setting the default weights... node? cxl? anything? What happens on > hotplug? etc. That seems outside the scope of this patch set. > > > If you want me to add the default_iw_table with special value 0 denoting > "use default" at each layer, I can do that. > > The basic change is this snippet: > ``` > if (pol->flags & MPOL_F_GWEIGHT) > pol_weights = iw_table; > else > pol_weights = pol->wil.weights; > > for_each_node_mask(nid, nodemask) { > weight = pol_weights[nid]; > weight_total += weight; > weights[nid] = weight; > } > ``` > > changes to: > ``` > for_each_node_mask(nid, nodemask) { > weight = pol->wil.weights[node] > if (!weight) > weight = iw_table[node] > if (!weight) > weight = default_iw_table[node] > weight_total += weight; > weights[nid] = weight > } > ``` > > It's a bit ugly, We can use a wrapper function to hide the logic. > but it allows a 0 value to represent "use default", > and default_iw_table just ends up being initialized to `1` for now. Because the contents of default_iw_table are just "default weight" for now. We don't need it for now. We can add it later. > I think it also allows MPOL_F_GWEIGHT to be eliminated. Do we need a way to distinguish whether to copy the global weights to local weights when the memory policy is created? That is, when the global weights are changed later, will the changes be used? One possible solution is - If no weights are specified in set_mempolicy2(), the global weights will be used always. - If at least one weight is specified in set_mempolicy2(), it will be used, and the other weights in global weights will be copied to the local weights. That is, changes to the global weights will not be used. -- Best Regards, Huang, Ying