linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <hyeonggon.yoo@sk.com>
To: "Huang, Ying" <ying.huang@linux.alibaba.com>,
	Gregory Price <gourry@gourry.net>,
	Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: kernel_team@skhynix.com, 42.hyeyoo@gmail.com,
	"rafael@kernel.org" <rafael@kernel.org>,
	"lenb@kernel.org" <lenb@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"김홍규(KIM HONGGYU) System SW" <honggyu.kim@sk.com>,
	"김락기(KIM RAKIE) System SW" <rakie.kim@sk.com>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"Jonathan.Cameron@huawei.com" <Jonathan.Cameron@huawei.com>,
	"dave.jiang@intel.com" <dave.jiang@intel.com>,
	"horen.chuang@linux.dev" <horen.chuang@linux.dev>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"kernel-team@meta.com" <kernel-team@meta.com>
Subject: Re: [External Mail] Re: [External Mail] [RFC PATCH] mm/mempolicy: Weighted interleave auto-tuning
Date: Wed, 8 Jan 2025 10:19:19 +0900	[thread overview]
Message-ID: <769f98b3-f5e5-448c-966e-4dd5468e5041@sk.com> (raw)
In-Reply-To: <874j2lll91.fsf@DESKTOP-5N7EMDA>



On 2024-12-30 3:48 AM, Huang, Ying wrote:
> Gregory Price <gourry@gourry.net> writes:
> 
>> On Fri, Dec 27, 2024 at 09:59:30AM +0800, Huang, Ying wrote:
>>> Gregory Price <gourry@gourry.net> writes:
>>>> This still allows 0 to be a manual "reset specific node to default"
>>>> mechanism for a specific node, and gives us a clean override.
>>>
>>> The difficulty is that users don't know the default value when they
>>> reset a node's weight.  We don't have an interface to show them.  So, I
>>> suggest to disable the functionality: "reset specific node to default".
>>> They can still use "echo 1 > use_defaults" to reset all nodes to
>>> default.
>>>
>>
>> Good point, and agree.  So lets just ditch 0.  Since that "feature"
>> wasn't even functional in the current code (it just reset it to 1 at
>> this point), it's probably safe to just ditch it.  Worst case scenario
>> if someone takes issues, we can just have it revert the weight to 1.
> 
> Before implementing the new version, it's better to summarize the user
> space interface design first.  So, we can check whether we have some
> flaws.

Hi, hope you all had a nice year-end holiday :)

Let me summarize the points we've discussed:

- A new knob 'weightiness' is unnecessary until it's proven useful.
   Just using an internal default weightiness value will be enough.

- It will be counter-intuitive to update the value previously set by
   user, even if the value will no longer be valid (e.g. due to CXL
   memory hot-plug). User should update the weights accordingly in that
   case, instead of the kernel updating automatically overwriting them.

- Ditch the way of using 0 as 'system default' value because the user
   won't know what will be the default when setting it anyway. 0 value
   now means the kernel won't weight-interleave the node.

- Setting a node weight to default value (e.g. via the previous
   semantic of '0') could be problematic because it's not atomic -
   the system may be updating default values while the user's
   trying to set a node weight to default value.

   To deal with that, Huang suggested 'use_defaults' to atomically update
   all the weights to system default.

Please let me know if there's any point we discussed that I am missing.

Additionally I would like to mention that within an internal discussion
my colleague Honggyu suggested introducing 'mode' parameter which can be
either 'manual' or 'auto' instead of 'use_defaults' to be provide more
intuitive interface.

With Honggyu's suggestion and the points we've discussed,
I think the interface could be:

# At booting, the mode is 'auto' where the kernel can automatically
# update any weights.

mode             auto         # User hasn't specified any weight yet.
effective        [2, 1, -, -] # Using system defaults for node 0-1,
                               # and node 2-3 not populated yet.

# When a new NUMA node is added (e.g. via hotplug) in the 'auto' mode,
# all weights are re-calculated based on ACPI HMAT table, including the
# weight of the new node.

mode             auto         # User hasn't specified weights yet.
effective        [2, 1, 1, -] # Using system defaults for node 0-2,
                               # and node 3 not populated yet.

# When user set at least one weight value, change the mode to 'manual'
# where the kernel does not update any weights automatically without
# user's consent.

mode             manual       # User changed the weight of node 0 to 4,
                               # changing the mode to manual config mode.
effective        [4, 1, 1, -]


# When a new NUMA node is added (e.g. via hotplug) in the manual mode,
# the new node's weight is zero because it's in manual mode and user
# did not specify the weight for the new node yet.

mode             manual
effective        [4, 1, 1, 0]

# When user changes the mode to 'auto', all weights are changed to
# system defaults based on the ACPI HMAT table.

mode             auto
effective        [2, 1, 1, 1]  # system defaults

In the example I did not distinguish 'default weights' and 'user
weights' because it's not important where the weight values came from --
but it's important to know 1) what's the effective weights now and 2) if
the kernel can update them.

Any thoughts?

---
Best,
Hyeonggon


  reply	other threads:[~2025-01-08  1:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 21:54 Joshua Hahn
2024-12-13  6:19 ` [External Mail] " Hyeonggon Yoo
2024-12-13 16:28   ` Gregory Price
2024-12-13 19:57   ` Joshua Hahn
2024-12-16  7:53     ` Hyeonggon Yoo
2024-12-16 15:46       ` Joshua Hahn
2024-12-21  5:57     ` Huang, Ying
2024-12-21 14:58       ` Gregory Price
2024-12-22  8:29         ` Huang, Ying
2024-12-22 16:54           ` Gregory Price
2024-12-25  0:25             ` Huang, Ying
2024-12-25  9:30               ` Joshua Hahn
2024-12-26  1:35                 ` Huang, Ying
2024-12-26 18:13                   ` Gregory Price
2024-12-27  1:59                     ` Huang, Ying
2024-12-27 15:35                       ` Gregory Price
2024-12-30  6:48                         ` Huang, Ying
2025-01-08  1:19                           ` Hyeonggon Yoo [this message]
2025-01-08 16:56                             ` [External Mail] " Joshua Hahn
2025-01-09 15:56                             ` Gregory Price
2025-01-09 17:18                               ` Joshua Hahn
2025-01-09 19:10                                 ` Joshua Hahn
2025-01-21 11:01                                   ` Huang, Ying

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=769f98b3-f5e5-448c-966e-4dd5468e5041@sk.com \
    --to=hyeonggon.yoo@sk.com \
    --cc=42.hyeyoo@gmail.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=gourry@gourry.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=honggyu.kim@sk.com \
    --cc=horen.chuang@linux.dev \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=kernel_team@skhynix.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rafael@kernel.org \
    --cc=rakie.kim@sk.com \
    --cc=ying.huang@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox