From: Honggyu Kim <honggyu.kim@sk.com>
To: Gregory Price <gourry@gourry.net>, Oscar Salvador <osalvador@suse.de>
Cc: kernel_team@skhynix.com,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Vlastimil Babka <vbabka@suse.cz>,
Hyeonggon Yoo <42.hyeyoo@gmail.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Rakie Kim <rakie.kim@sk.com>, Harry Yoo <harry.yoo@oracle.com>,
dan.carpenter@linaro.org
Subject: Re: [PATCH v3 2/3] mm,memory_hotplug: Implement numa node notifier
Date: Wed, 28 May 2025 11:23:53 +0900 [thread overview]
Message-ID: <3ad3bcba-b8b6-4e30-8ad9-adba5761e923@sk.com> (raw)
In-Reply-To: <aBTkgnYYSN0SMQCU@gourry-fedora-PF4VCD3F>
Hi Gregory and Oscar,
On 5/3/2025 12:28 AM, Gregory Price wrote:
> On Fri, May 02, 2025 at 10:36:23AM +0200, Oscar Salvador wrote:
>> There are at least six consumers of hotplug_memory_notifier that what they
>> really are interested in is whether any numa node changed its state, e.g: going
>> from being memory aware to becoming memoryless and vice versa.
>>
>> Implement a specific notifier for numa nodes when their state gets changed,
>> and have those consumers that only care about numa node state changes use it.
>>
>> Signed-off-by: Oscar Salvador <osalvador@suse.de>
>> Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
>> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>>
>> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
>> index f43951668c41..b3ad63fb3a2b 100644
>> --- a/mm/mempolicy.c
>> +++ b/mm/mempolicy.c
>> @@ -3591,20 +3591,20 @@ static int wi_node_notifier(struct notifier_block *nb,
>> unsigned long action, void *data)
>> {
>> int err;
>> - struct memory_notify *arg = data;
>> + struct node_notify *arg = data;
>> int nid = arg->status_change_nid;
>>
>> if (nid < 0)
>> return NOTIFY_OK;
>>
>> switch (action) {
>> - case MEM_ONLINE:
>> + case NODE_BECAME_MEM_AWARE:
>> err = sysfs_wi_node_add(nid);
>> if (err)
>> pr_err("failed to add sysfs for node%d during hotplug: %d\n",
>> nid, err);
>> break;
>
> May I suggest rolling this patch in with this change:
> https://lore.kernel.org/linux-mm/aAij2oUCP1zmcoPv@stanley.mountain/
>
> seems to fix the underlying problem, and returning an error now makes
> sense given the change.
The 'err' of sysfs_wi_node_add() wasn't propagated to its caller before
this change as discussed with David at the following.
https://lore.kernel.org/198f2cbe-b1cb-4239-833e-9aac33d978fa@redhat.com
But as Gregory mentioned, we can pass 'err' now with this numa node notifier
so for this hunk, shouldn't we add the following change on top of this?
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 3a7717e09506..3073ebd4e7ee 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -3792,7 +3792,7 @@ static int sysfs_wi_node_add(int nid)
static int wi_node_notifier(struct notifier_block *nb,
unsigned long action, void *data)
{
- int err;
+ int err = 0;
struct node_notify *arg = data;
int nid = arg->status_change_nid;
@@ -3811,7 +3811,7 @@ static int wi_node_notifier(struct notifier_block *nb,
break;
}
- return NOTIFY_OK;
+ return notifier_from_errno(err);
}
static int __init add_weighted_interleave_group(struct kobject *mempolicy_kobj)
>
> +cc: Honggyu Kim, Dan Carpenter
Thanks for cc-ing me into this thread.
Honggyu
>
>> - case MEM_OFFLINE:
>> + case NODE_BECAME_MEMORYLESS:
>> sysfs_wi_node_delete(nid);
>> break;
>> }
>> @@ -3639,7 +3639,7 @@ static int __init add_weighted_interleave_group(struct kobject *mempolicy_kobj)
>> }
>> }
>>
>> - hotplug_memory_notifier(wi_node_notifier, DEFAULT_CALLBACK_PRI);
>> + hotplug_node_notifier(wi_node_notifier, DEFAULT_CALLBACK_PRI);
>> return 0;
>>
>> err_cleanup_kobj:
next prev parent reply other threads:[~2025-05-28 2:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-02 8:36 [PATCH v3 0/3] " Oscar Salvador
2025-05-02 8:36 ` [PATCH v3 1/3] mm,slub: Do not special case N_NORMAL nodes for slab_nodes Oscar Salvador
2025-05-05 13:43 ` Vlastimil Babka
2025-05-02 8:36 ` [PATCH v3 2/3] mm,memory_hotplug: Implement numa node notifier Oscar Salvador
2025-05-02 15:28 ` Gregory Price
2025-05-05 14:51 ` Dan Carpenter
2025-05-28 2:23 ` Honggyu Kim [this message]
2025-06-03 9:14 ` Oscar Salvador
2025-05-02 19:09 ` ALOK TIWARI
2025-05-05 13:58 ` Vlastimil Babka
2025-05-02 8:36 ` [PATCH v3 3/3] mm,memory_hotplug: Rename status_change_nid parameter in memory_notify Oscar Salvador
2025-05-02 19:15 ` ALOK TIWARI
2025-05-04 3:03 ` [PATCH v3 0/3] Implement numa node notifier Andrew Morton
2025-05-04 5:44 ` Oscar Salvador
2025-05-04 6:16 ` Andrew Morton
2025-05-05 17:07 ` Gregory Price
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=3ad3bcba-b8b6-4e30-8ad9-adba5761e923@sk.com \
--to=honggyu.kim@sk.com \
--cc=42.hyeyoo@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@linaro.org \
--cc=david@redhat.com \
--cc=gourry@gourry.net \
--cc=harry.yoo@oracle.com \
--cc=kernel_team@skhynix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
--cc=rakie.kim@sk.com \
--cc=vbabka@suse.cz \
/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