Re: [PATCH v1 6/6] mm/hugetlb: use folio->lru int demote_free_hugetlb_folios()

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

 



On Fri, Jan 10, 2025 at 07:21:49PM +0100, David Hildenbrand wrote:
> We are demoting hugetlb folios to smaller hugetlb folios; let's avoid
> messing with pages where avoidable.
> 
> Signed-off-by: David Hildenbrand <david@xxxxxxxxxx>

Good stuff.  I have questions.

> +++ b/mm/hugetlb.c
> @@ -3822,13 +3822,15 @@ static long demote_free_hugetlb_folios(struct hstate *src, struct hstate *dst,
>  
>  		for (i = 0; i < pages_per_huge_page(src); i += pages_per_huge_page(dst)) {
>  			struct page *page = folio_page(folio, i);
> +			struct folio *new_folio;

I'm usually very against casting from page to folio, but I think it
might be the better option in this case ...

>  			page->mapping = NULL;

because then we could do new_folio->mapping = NULL.

We're going to have to do serious changes to this function anyway to
convert from Ottawa to the New York interpretation, so the cast doesn't
give me the feeling of danger that it would elsewhere.

>  			clear_compound_head(page);
>  			prep_compound_page(page, dst->order);
> +			new_folio = page_folio(page);
>  
> -			init_new_hugetlb_folio(dst, page_folio(page));
> -			list_add(&page->lru, &dst_list);
> +			init_new_hugetlb_folio(dst, new_folio);
> +			list_add(&new_folio->lru, &dst_list);
>  		}
>  	}
>  
> -- 
> 2.47.1
> 




[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