lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1490104745.17719.6.camel@linux.intel.com>
Date:   Tue, 21 Mar 2017 09:59:05 -0400
From:   Tim Chen <tim.c.chen@...ux.intel.com>
To:     "Huang, Ying" <ying.huang@...el.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Andi Kleen <ak@...ux.intel.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Shaohua Li <shli@...nel.org>, Rik van Riel <riel@...hat.com>,
        Ingo Molnar <mingo@...nel.org>, Michal Hocko <mhocko@...e.com>,
        Vladimir Davydov <vdavydov.dev@...il.com>,
        Minchan Kim <minchan@...nel.org>,
        Dmitry Safonov <dsafonov@...tuozzo.com>,
        Mark Rutland <mark.rutland@....com>,
        Vegard Nossum <vegard.nossum@...cle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Johannes Weiner <hannes@...xchg.org>,
        Mel Gorman <mgorman@...hsingularity.net>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Ross Zwisler <ross.zwisler@...ux.intel.com>,
        Jan Kara <jack@...e.cz>,
        "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
        Lorenzo Stoakes <lstoakes@...il.com>,
        Dave Jiang <dave.jiang@...el.com>,
        Hugh Dickins <hughd@...gle.com>,
        Gerald Schaefer <gerald.schaefer@...ibm.com>,
        Aaron Lu <aaron.lu@...el.com>, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org
Subject: Re: [PATCH] mm, swap: VMA based swap readahead

On Mon, 2017-03-20 at 10:47 +0800, Huang, Ying wrote:
> Hi, Tim,
> 
> Tim Chen <tim.c.chen@...ux.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,
> > > +				    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?
> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ