Re: [PATCH 1/2] mm: Turn folio_test_hugetlb into a PageType

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2024/3/14 22:33, Matthew Wilcox wrote:
> On Thu, Mar 14, 2024 at 11:26:17AM +0100, David Hildenbrand wrote:
>> Should we include this hunk:
>>
>> diff --git a/mm/debug.c b/mm/debug.c
>> index c1c1a6a484e4c..f521e17150a10 100644
>> --- a/mm/debug.c
>> +++ b/mm/debug.c
>> @@ -63,7 +63,8 @@ static void __dump_folio(struct folio *folio, struct page *page,
>>          * encode own info, and we must avoid calling page_folio() again.
>>          */
>>         if (!folio_test_slab(folio)) {
>> -               mapcount = atomic_read(&page->_mapcount) + 1;
>> +               if (!folio_test_hugetlb(folio))
>> +                       mapcount = atomic_read(&page->_mapcount) + 1;
>>                 if (folio_test_large(folio))
>>                         mapcount += folio_entire_mapcount(folio);
>>         }
>>
>> Apart from that, LGTM
> 
> I actually want to do a bit more here ...
> 
> +++ b/mm/debug.c
> @@ -58,15 +58,10 @@ static void __dump_folio(struct folio *folio, struct page *page,
>         int mapcount = 0;
>         char *type = "";
> 
> -       /*
> -        * page->_mapcount space in struct page is used by slab pages to
> -        * encode own info, and we must avoid calling page_folio() again.
> -        */
> -       if (!folio_test_slab(folio)) {
> +       if (!page_has_type(page)) {
>                 mapcount = atomic_read(&page->_mapcount) + 1;
> -               if (folio_test_large(folio))
> -                       mapcount += folio_entire_mapcount(folio);
> -       }
> +       if (folio_test_large(folio))
> +               mapcount += folio_entire_mapcount(folio);

Why folio_test_large is not within the "if (!page_has_type(page))" block? I think a slab page could also be large folio.
Or am I miss something?

Thanks.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux