linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Tim Chen <tim.c.chen@linux.intel.com>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andi Kleen <ak@linux.intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Shaohua Li <shli@kernel.org>, Rik van Riel <riel@redhat.com>,
	Ingo Molnar <mingo@kernel.org>, Michal Hocko <mhocko@suse.com>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Minchan Kim <minchan@kernel.org>,
	Dmitry Safonov <dsafonov@virtuozzo.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Vegard Nossum <vegard.nossum@oracle.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	Jan Kara <jack@suse.cz>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Lorenzo Stoakes <lstoakes@gmail.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Hugh Dickins <hughd@google.com>,
	Gerald Schaefer <gerald.schaefer@de.ibm.com>,
	Aaron Lu <aaron.lu@intel.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm, swap: VMA based swap readahead
Date: Sun, 19 Mar 2017 18:01:41 -0700	[thread overview]
Message-ID: <20170320010140.GA19343@linux.intel.com> (raw)
In-Reply-To: <20170314092538.32649-1-ying.huang@intel.com>

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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-03-20  1:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14  9:25 [PATCH] mm, swap: VMA based swap readahead Huang, Ying
2017-03-20  1:01 ` Tim Chen [this message]
2017-03-20  2:47   ` Huang, Ying
2017-03-21 13:59     ` Tim Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170320010140.GA19343@linux.intel.com \
    --to=tim.c.chen@linux.intel.com \
    --cc=aaron.lu@intel.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dsafonov@virtuozzo.com \
    --cc=gerald.schaefer@de.ibm.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jack@suse.cz \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=mingo@kernel.org \
    --cc=riel@redhat.com \
    --cc=ross.zwisler@linux.intel.com \
    --cc=shli@kernel.org \
    --cc=vdavydov.dev@gmail.com \
    --cc=vegard.nossum@oracle.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).