Re: [PATCH] device-dax: use fallback nid when numa_node is invalid

From: David Hildenbrand
Date: Mon Aug 02 2021 - 11:47:55 EST


On 29.07.21 16:44, Justin He wrote:
Hi David

-----Original Message-----
From: David Hildenbrand <david@xxxxxxxxxx>
Sent: Thursday, July 29, 2021 3:59 PM
To: Justin He <Justin.He@xxxxxxx>; Dan Williams <dan.j.williams@xxxxxxxxx>;
Vishal Verma <vishal.l.verma@xxxxxxxxx>; Dave Jiang <dave.jiang@xxxxxxxxx>
Cc: nvdimm@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; nd <nd@xxxxxxx>
Subject: Re: [PATCH] device-dax: use fallback nid when numa_node is
invalid

Hi Justin,



Note that this patch conflicts with:

https://lkml.kernel.org/r/20210723125210.29987-7-david@xxxxxxxxxx

But nothing fundamental. Determining a single NID is similar to how I'm
handling it for ACPI:

https://lkml.kernel.org/r/20210723125210.29987-6-david@xxxxxxxxxx


Okay, got it. Thanks for the reminder.
Seems my patch is not useful after your patch.


I think your patch still makes sense. With

https://lore.kernel.org/linux-acpi/20210723125210.29987-7-
david@xxxxxxxxxx/

We'd have to detect the node id in the first loop instead.

Ok, I got your point. I will do that in v2.

Btw, sorry for commenting there about your patch 06 since I didn't
subscribe lkml via this mailbox.

Sure, you really should subscribe :)

> + for (i = 0; i < dev_dax->nr_range; i++) {
+ struct range range;
+
+ rc = dax_kmem_range(dev_dax, i, &range);
+ if (rc) {
+ dev_info(dev, "mapping%d: %#llx-%#llx too small after alignment\n",
+ i, range.start, range.end);
+ continue;
+ }
+ total_len += range_len(&range);
+ }
You add an additional loop to get the total_len.
I wonder is it independent on 2nd loop?
If yes, why not merge the 2 loops into one?
Sorry if this question is too simple, I don't know too much
about the background of your patch.

We need total_len to register the memory group. We need the memory group to add memory. Therefore, we need a second loop to calculate total_len upfront.


--
Thanks,

David / dhildenb