Re: [PATCH v3 2/3] mm,memory_hotplug: Implement numa node notifier

From: Oscar Salvador
Date: Tue Jun 03 2025 - 05:14:28 EST


On Wed, May 28, 2025 at 11:23:53AM +0900, Honggyu Kim wrote:
> 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@xxxxxxxxxx
>
> 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);

I do not think so.
NODE_BECAME_MEM_AWARE is already too late to react.
We only tell the system that __now__ we are in this state, so there is
no rollback possible from this point forward.


--
Oscar Salvador
SUSE Labs