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: Tue, 21 Mar 2017 09:59:05 -0400	[thread overview]
Message-ID: <1490104745.17719.6.camel@linux.intel.com> (raw)
In-Reply-To: <871stsbr4y.fsf@yhuang-dev.intel.com>

On Mon, 2017-03-20 at 10:47 +0800, Huang, Ying wrote:
> Hi, Tim,
> 
> Tim Chen <tim.c.chen@linux.intel.com> writes:
> 
> > 
> > On Tue, Mar 14, 2017 at 05:25:29PM +0800, Huang, Ying wrote:
> > > 
> > > +struct page *do_swap_page_readahead(struct vm_fault *vmf,
> > > +				A A A A struct vma_swap_readahead *swap_ra,
> > > +				A A A A swp_entry_t fentry,
> > > +				A A A A 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?
> I don't call put_page() here because the page will be mapped to process
> page table.
> 
> > 
> > 		put_page(fpage);
> > 
> > I think there is no put_page on the returned page when you return from
> > do_swap_page_readahead.
> In the original swapin_readahead(), the read_swap_cache_async() will be
> called for the fault swap entry again in the end of the function, and
> pug_page() is not called there.
> 

I missed the second call to read_swap_cache_async in swapin_readahead.
You're right that we should keep the reference on the faulted page and not call
put_page on fpage here.

Thanks.

Tim

--
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-21 13:59 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
2017-03-20  2:47   ` Huang, Ying
2017-03-21 13:59     ` Tim Chen [this message]

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=1490104745.17719.6.camel@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).