Re: [PATCH RESEND] mm: hugetlb: simplify per-node sysfs creation and removal

From: Mike Kravetz
Date: Fri Aug 19 2022 - 19:41:56 EST


On 08/19/22 16:00, Muchun Song wrote:
> The following commit offload per-node sysfs creation and removal to a kworker and
> did not say why it is needed. And it also said "I don't know that this is
> absolutely required". It seems like the author was not sure as well. Since it
> only complicates the code, this patch will revert the changes to simplify the code.
>
> 39da08cb074c ("hugetlb: offload per node attribute registrations")
>
> We could use memory hotplug notifier to do per-node sysfs creation and removal
> instead of inserting those operations to node registration and unregistration.
> Then, it can reduce the code coupling between node.c and hugetlb.c. Also, it can
> simplify the code.
>
> Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
> ---

Looking at commit 39da08cb074c, it mentions that other memory register/unregister
handlers use work queues. That seemed to be true at the time, but those handlers
have been rewritten or no longer exist. With a quick look, I did not find any
memory notifiers doing so today.

I certainly like decoupling node driver and hugetlb code. By no means am I an
expert in the hotplug interfaces. I could not find any issues in moving the
functionality to memory hotplug notification. FWICT, functionality should be

>
> Cc Andi per Greg.
>
> drivers/base/node.c | 139 ++-------------------------------------------------
> include/linux/node.h | 24 ++-------
> mm/hugetlb.c | 45 +++++++++++------
> 3 files changed, 36 insertions(+), 172 deletions(-)

Acked-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
--
Mike Kravetz