[PATCH v5 07/10] drivers,hmat: Use node-notifier instead of memory-notifier

Oscar Salvador posted 10 patches 6 months, 2 weeks ago
There is a newer version of this series
[PATCH v5 07/10] drivers,hmat: Use node-notifier instead of memory-notifier
Posted by Oscar Salvador 6 months, 2 weeks ago
hmat driver is only concerned when a numa node changes its memory state,
specifically when a numa node with memory comes into play for the first
time, because it will register the memory_targets belonging to that numa
node.
So stop using the memory notifier and use the new numa node notifer
instead.

Signed-off-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
---
 drivers/acpi/numa/hmat.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
index 9d9052258e92..fe626e969fdc 100644
--- a/drivers/acpi/numa/hmat.c
+++ b/drivers/acpi/numa/hmat.c
@@ -962,10 +962,10 @@ static int hmat_callback(struct notifier_block *self,
 			 unsigned long action, void *arg)
 {
 	struct memory_target *target;
-	struct memory_notify *mnb = arg;
-	int pxm, nid = mnb->status_change_nid;
+	struct node_notify *nb = arg;
+	int pxm, nid = nb->nid;
 
-	if (nid == NUMA_NO_NODE || action != MEM_ONLINE)
+	if (nid == NUMA_NO_NODE || action != NODE_ADDED_FIRST_MEMORY)
 		return NOTIFY_OK;
 
 	pxm = node_to_pxm(nid);
@@ -1118,7 +1118,7 @@ static __init int hmat_init(void)
 	hmat_register_targets();
 
 	/* Keep the table and structures if the notifier may use them */
-	if (hotplug_memory_notifier(hmat_callback, HMAT_CALLBACK_PRI))
+	if (hotplug_node_notifier(hmat_callback, HMAT_CALLBACK_PRI))
 		goto out_put;
 
 	if (!hmat_set_default_dram_perf())
-- 
2.49.0
Re: [PATCH v5 07/10] drivers,hmat: Use node-notifier instead of memory-notifier
Posted by David Hildenbrand 6 months, 2 weeks ago
On 05.06.25 16:22, Oscar Salvador wrote:
> hmat driver is only concerned when a numa node changes its memory state,
> specifically when a numa node with memory comes into play for the first
> time, because it will register the memory_targets belonging to that numa
> node.
> So stop using the memory notifier and use the new numa node notifer
> instead.
> 
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
> Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
> ---
>   drivers/acpi/numa/hmat.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/acpi/numa/hmat.c b/drivers/acpi/numa/hmat.c
> index 9d9052258e92..fe626e969fdc 100644
> --- a/drivers/acpi/numa/hmat.c
> +++ b/drivers/acpi/numa/hmat.c
> @@ -962,10 +962,10 @@ static int hmat_callback(struct notifier_block *self,
>   			 unsigned long action, void *arg)
>   {
>   	struct memory_target *target;
> -	struct memory_notify *mnb = arg;
> -	int pxm, nid = mnb->status_change_nid;
> +	struct node_notify *nb = arg;
> +	int pxm, nid = nb->nid;
>   
> -	if (nid == NUMA_NO_NODE || action != MEM_ONLINE)
> +	if (nid == NUMA_NO_NODE || action != NODE_ADDED_FIRST_MEMORY)

Same comment :)

-- 
Cheers,

David / dhildenb
Re: [PATCH v5 07/10] drivers,hmat: Use node-notifier instead of memory-notifier
Posted by Andrew Morton 6 months, 2 weeks ago
On Fri, 6 Jun 2025 13:51:35 +0200 David Hildenbrand <david@redhat.com> wrote:

> > -	if (nid == NUMA_NO_NODE || action != MEM_ONLINE)
> > +	if (nid == NUMA_NO_NODE || action != NODE_ADDED_FIRST_MEMORY)
> 
> Same comment :)

Thanks.  It appears that quite a few updates are coming so I'll remove
the v5 series from mm.git.