Re: [PATCH] mm, swap: VMA based swap readahead

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

 



On Tue, Mar 14, 2017 at 05:25:29PM +0800, Huang, Ying wrote:
> +struct page *do_swap_page_readahead(struct vm_fault *vmf,
> +				    struct vma_swap_readahead *swap_ra,
> +				    swp_entry_t fentry,
> +				    struct page *fpage)
> +{
> +	struct blk_plug plug;
> +	struct vm_area_struct *vma = vmf->vma;
> +	struct page *page;
> +	unsigned long addr;
> +	pte_t *pte, pentry;
> +	gfp_t gfp_mask;
> +	swp_entry_t entry;
> +	int i, alloc = 0, count;
> +	bool page_allocated;
> +
> +	addr = vmf->address & PAGE_MASK;
> +	blk_start_plug(&plug);
> +	if (!fpage) {
> +		fpage = __read_swap_cache_async(fentry, GFP_HIGHUSER_MOVABLE,
> +						vma, addr, &page_allocated);
> +		if (!fpage) {
> +			blk_finish_plug(&plug);
> +			return NULL;
> +		}
> +		if (page_allocated) {
> +			alloc++;
> +			swap_readpage(fpage);
> +		}

Do you need to add here a put_page as there's a get_page
in __read-swap_cache_async?

		put_page(fpage);

I think there is no put_page on the returned page when you return from
do_swap_page_readahead.

Thanks.

Tim

> +	}
> +	/* fault page has been checked */
> +	count = 1;
> +	addr += PAGE_SIZE * swap_ra->direction;
> +	pte = swap_ra->ptes;
> +	if (swap_ra->direction < 0)
> +		pte += swap_ra->nr_pte - 1;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[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