Re: [PATCH v6 4/4] mm/hwpoison: introduce per-memory_block hwpoison counter

From: Miaohe Lin
Date: Mon Oct 17 2022 - 09:31:41 EST


On 2022/10/17 19:43, HORIGUCHI NAOYA(堀口 直也) wrote:
> On Sat, Oct 15, 2022 at 10:28:00AM +0800, Miaohe Lin wrote:
>> On 2022/10/7 9:07, Naoya Horiguchi wrote:
> ...
>>> diff --git a/include/linux/memory.h b/include/linux/memory.h
>>> index aa619464a1df..ad8cd9bb3239 100644
>>> --- a/include/linux/memory.h
>>> +++ b/include/linux/memory.h
>>> @@ -85,6 +85,9 @@ struct memory_block {
>>> unsigned long nr_vmemmap_pages;
>>> struct memory_group *group; /* group (if any) for this block */
>>> struct list_head group_next; /* next block inside memory group */
>>> +#if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_MEMORY_HOTPLUG)
>>> + atomic_long_t nr_hwpoison;
>>> +#endif
>>> };
>>>
>>> int arch_get_memory_phys_device(unsigned long start_pfn);
>>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>>> index 17119dbf8fad..f80269e90772 100644
>>> --- a/include/linux/mm.h
>>> +++ b/include/linux/mm.h
>>> @@ -3280,6 +3280,7 @@ extern int soft_offline_page(unsigned long pfn, int flags);
>>> extern int __get_huge_page_for_hwpoison(unsigned long pfn, int flags,
>>> bool *migratable_cleared);
>>> extern void num_poisoned_pages_inc(unsigned long pfn);
>>> +extern void num_poisoned_pages_sub(unsigned long pfn, long i);
>>
>> The prototype of this function is: *inline* void num_poisoned_pages_sub(unsigned long pfn, long i).
>> The combination of inline and extern looks weird to me. Is this a common use case?
>
> No, it seems not. I can find a few place of such a comination like task_curr()
> and raise_softirq_irqoff(), but as long as I understand, there's little meaning
> (showing explicitly but redundant) to add extern keyword to functions in shared
> header files. So I think of dropping the extern keyword.

That looks fine to me. My Reviewed-by tag still applies. Thanks Naoya.

Thanks,
Miaohe Lin

>
>>
>> Anyway, this patch looks good to me. Thanks.
>> Reviewed-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>
> Thank you.
>
> - Naoya Horiguchi
>