Re: [PATCH 1/2] mm,swap: extract swap single page readahead into its own function
From: Christoph Hellwig
Date: Wed Sep 23 2020 - 02:32:51 EST
On Mon, Sep 21, 2020 at 10:01:47PM -0400, Rik van Riel wrote:
> +static struct page *swap_cluster_read_one(swp_entry_t entry,
> + unsigned long offset, gfp_t gfp_mask,
> + struct vm_area_struct *vma, unsigned long addr, bool readahead)
> +{
> + bool page_allocated;
> + struct page *page;
> +
> + page =__read_swap_cache_async(swp_entry(swp_type(entry), offset),
> + gfp_mask, vma, addr, &page_allocated);
Missing whitespace after the "=".
> + if (!page)
> + return NULL;
> + if (page_allocated) {
> + swap_readpage(page, false);
> + if (readahead) {
> + SetPageReadahead(page);
> + count_vm_event(SWAP_RA);
> + }
> + }
> + put_page(page);
> + return page;
> +}
I think swap_vma_readahead can be switched to your new helper
pretty trivially as well, as could many of the users of
read_swap_cache_async.