Re: [PATCH v2] mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED for shmem

From: Matthew Wilcox
Date: Thu Dec 02 2021 - 09:59:30 EST


On Thu, Dec 02, 2021 at 04:20:53PM +0530, Charan Teja Reddy wrote:
> +static void shmem_isolate_pages_range(struct address_space *mapping, loff_t start,
> + loff_t end, struct list_head *list)
> +{
> + XA_STATE(xas, &mapping->i_pages, start);
> + struct page *page;
> +
> + rcu_read_lock();
> + xas_for_each(&xas, page, end) {
> + if (xas_retry(&xas, page))
> + continue;
> + if (xa_is_value(page))
> + continue;
> + if (!get_page_unless_zero(page))
> + continue;
> + if (isolate_lru_page(page))
> + continue;
> +
> + list_add(&page->lru, list);
> + inc_node_page_state(page, NR_ISOLATED_ANON +
> + page_is_file_lru(page));

... what if the page is a THP?