[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f562c165-f652-4f40-9620-8f5f610b433f@kernel.org>
Date: Fri, 28 Nov 2025 12:26:42 +0100
From: "David Hildenbrand (Red Hat)" <david@...nel.org>
To: Fushuai Wang <fushuai.wang@...ux.dev>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org, muchun.song@...ux.dev,
osalvador@...e.de, wangfushuai@...du.com
Subject: Re: [PATCH] hugetlb: Add guard support
On 11/28/25 12:23, Fushuai Wang wrote:
>>> include/linux/hugetlb.h | 8 ++++++++
>>> 1 file changed, 8 insertions(+)
>>>
>>> diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
>>> index 8e63e46b8e1f..f97cb2f123a3 100644
>>> --- a/include/linux/hugetlb.h
>>> +++ b/include/linux/hugetlb.h
>>> @@ -15,6 +15,7 @@
>>> #include <linux/gfp.h>
>>> #include <linux/userfaultfd_k.h>
>>> #include <linux/nodemask.h>
>>> +#include <linux/cleanup.h>
>>>
>>> struct ctl_table;
>>> struct user_struct;
>>> @@ -468,6 +469,13 @@ static inline void hugetlb_split(struct vm_area_struct *vma, unsigned long addr)
>>>
>>> #endif /* !CONFIG_HUGETLB_PAGE */
>>>
>>> +DEFINE_GUARD(hugetlb_vma_read, struct vm_area_struct *,
>>> + hugetlb_vma_lock_read(_T), hugetlb_vma_unlock_read(_T))
>>> +
>>> +DEFINE_GUARD(hugetlb_vma_write, struct vm_area_struct *,
>>> + hugetlb_vma_lock_write(_T), hugetlb_vma_unlock_write(_T))
>>> +DEFINE_GUARD_COND(hugetlb_vma_write, _try, hugetlb_vma_trylock_write(_T))
>>
>> Do I understand correctly that the code you are introducing does not
>> have any users?
>
> Yes, it is not used now, but it can be used in future development to simplify
> the code. If there are complex hugetlb_vma locks in the current code, this can
> also be used later to optimize them.
Right, but we usually don't add dead code. So it should ideally be
introduced with actual users.
--
Cheers
David
Powered by blists - more mailing lists