Re: [PATCH 03/10] hugetlb: Use LIST_HEAD() to define a list head

From: Miaohe Lin
Date: Fri Aug 26 2022 - 22:28:00 EST


On 2022/8/27 9:47, Muchun Song wrote:
>
>
>> On Aug 26, 2022, at 17:24, Miaohe Lin <linmiaohe@xxxxxxxxxx> wrote:
>>
>> We can avoid unneeded WRITE_ONCE() overhead by using LIST_HEAD() to define
>> a list head.
>
> IIUC, the overhead doesn’t change. Right?

I think the overhead is changed. LIST_HEAD is initialized without using WRITE_ONCE():

#define LIST_HEAD_INIT(name) { &(name), &(name) }

#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)

while INIT_LIST_HEAD has:

static inline void INIT_LIST_HEAD(struct list_head *list)
{
WRITE_ONCE(list->next, list);
WRITE_ONCE(list->prev, list);
}

Or am I miss something?

>
> I’m fine with your changes.
>
> Reviewed-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>

Many thanks for your review and comment. :)

Thanks,
Miaohe Lin