On 2022/12/28 2:14, Matthew Wilcox wrote:
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;
}
Thanks Matthew, this is more complete, will update.
return NULL;