Re: [PATCH] hugetlb: Convert alloc_buddy_hugetlb_folio to use a folio

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

 



On Tue, Apr 02, 2024 at 09:06:54PM +0100, Matthew Wilcox (Oracle) wrote:
> While this function returned a folio, it was still using __alloc_pages()
> and __free_pages().  Use __folio_alloc() and put_folio() instead.  This
> actually removes a call to compound_head(), but more importantly, it
> prepares us for the move to memdescs.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>

Reviewed-by: Oscar Salvador <osalvador@xxxxxxx>

> -	page = __alloc_pages(gfp_mask, order, nid, nmask);
> +	folio = __folio_alloc(gfp_mask, order, nid, nmask);
>  
> -	/* Freeze head page */
> -	if (page && !page_ref_freeze(page, 1)) {
> -		__free_pages(page, order);
> +	if (folio && !folio_ref_freeze(folio, 1)) {
> +		folio_put(folio);

This made me look again at the problem we had in the past with
speculative refcount vs hugetlb pages, and made me think whether there
are any more users trying to defeat speculative refcounts this way.
It was discussed some time ago that maybe all pages returned from the buddy
allocator should have its refcount frozen, to avoid this.
 

-- 
Oscar Salvador
SUSE Labs




[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