Re: [PATCH -next v2 1/7] mm: page_idle: Convert page idle to use folios

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

 



On Tue, Dec 27, 2022 at 08:27:08PM +0800, Kefeng Wang wrote:
> -static struct page *page_idle_get_page(unsigned long pfn)
> +static struct folio *page_idle_get_folio(unsigned long pfn)
>  {
>  	struct page *page = pfn_to_online_page(pfn);
> +	struct folio *folio;
>  
> -	if (!page || !PageLRU(page) ||
> -	    !get_page_unless_zero(page))
> +	if (!page || !PageLRU(page) || !get_page_unless_zero(page))
>  		return NULL;

Mmmm, no.  PageLRU hides a compound_head() call.  Try doing this instead:

	if (!page || PageTail(page))
		return NULL;
	folio = page_folio(page);
	if (!folio_test_lru(folio) || !folio_try_get(folio))
		return NULL;
	if (page_folio(page) != folio || !folio_test_lru(folio)) {
		folio_put(folio);
		folio = NULL;
	}

	return NULL;





[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