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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140208114334.GA25841@localhost.localdomain>
Date:	Sat, 8 Feb 2014 09:43:35 -0200
From:	Rafael Aquini <aquini@...hat.com>
To:	Johannes Weiner <hannes@...xchg.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Andi Kleen <andi@...stfloor.org>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Bob Liu <bob.liu@...cle.com>,
	Christoph Hellwig <hch@...radead.org>,
	Dave Chinner <david@...morbit.com>,
	Greg Thelen <gthelen@...gle.com>,
	Hugh Dickins <hughd@...gle.com>, Jan Kara <jack@...e.cz>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Luigi Semenzato <semenzato@...gle.com>,
	Mel Gorman <mgorman@...e.de>,
	Metin Doslu <metin@...usdata.com>,
	Michel Lespinasse <walken@...gle.com>,
	Minchan Kim <minchan.kim@...il.com>,
	Ozgun Erdogan <ozgun@...usdata.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Rik van Riel <riel@...hat.com>,
	Roman Gushchin <klamm@...dex-team.ru>,
	Ryan Mallon <rmallon@...il.com>, Tejun Heo <tj@...nel.org>,
	Vlastimil Babka <vbabka@...e.cz>, linux-mm@...ck.org,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [patch 02/10] fs: cachefiles: use add_to_page_cache_lru()

On Mon, Feb 03, 2014 at 07:53:34PM -0500, Johannes Weiner wrote:
> This code used to have its own lru cache pagevec up until a0b8cab3
> ("mm: remove lru parameter from __pagevec_lru_add and remove parts of
> pagevec API").  Now it's just add_to_page_cache() followed by
> lru_cache_add(), might as well use add_to_page_cache_lru() directly.
>

Just a heads-up, here: take a look at https://lkml.org/lkml/2014/2/7/587

I'm not saying that hunks below will cause the same leak issue as depicted on 
the thread I pointed, but it surely doesn't hurt to double-check them

Regards,
-- Rafael

> Signed-off-by: Johannes Weiner <hannes@...xchg.org>
> Reviewed-by: Rik van Riel <riel@...hat.com>
> Reviewed-by: Minchan Kim <minchan@...nel.org>
> ---
>  fs/cachefiles/rdwr.c | 33 +++++++++++++--------------------
>  1 file changed, 13 insertions(+), 20 deletions(-)
> 
> diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
> index ebaff368120d..4b1fb5ca65b8 100644
> --- a/fs/cachefiles/rdwr.c
> +++ b/fs/cachefiles/rdwr.c
> @@ -265,24 +265,22 @@ static int cachefiles_read_backing_file_one(struct cachefiles_object *object,
>  				goto nomem_monitor;
>  		}
>  
> -		ret = add_to_page_cache(newpage, bmapping,
> -					netpage->index, cachefiles_gfp);
> +		ret = add_to_page_cache_lru(newpage, bmapping,
> +					    netpage->index, cachefiles_gfp);
>  		if (ret == 0)
>  			goto installed_new_backing_page;
>  		if (ret != -EEXIST)
>  			goto nomem_page;
>  	}
>  
> -	/* we've installed a new backing page, so now we need to add it
> -	 * to the LRU list and start it reading */
> +	/* we've installed a new backing page, so now we need to start
> +	 * it reading */
>  installed_new_backing_page:
>  	_debug("- new %p", newpage);
>  
>  	backpage = newpage;
>  	newpage = NULL;
>  
> -	lru_cache_add_file(backpage);
> -
>  read_backing_page:
>  	ret = bmapping->a_ops->readpage(NULL, backpage);
>  	if (ret < 0)
> @@ -510,24 +508,23 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
>  					goto nomem;
>  			}
>  
> -			ret = add_to_page_cache(newpage, bmapping,
> -						netpage->index, cachefiles_gfp);
> +			ret = add_to_page_cache_lru(newpage, bmapping,
> +						    netpage->index,
> +						    cachefiles_gfp);
>  			if (ret == 0)
>  				goto installed_new_backing_page;
>  			if (ret != -EEXIST)
>  				goto nomem;
>  		}
>  
> -		/* we've installed a new backing page, so now we need to add it
> -		 * to the LRU list and start it reading */
> +		/* we've installed a new backing page, so now we need
> +		 * to start it reading */
>  	installed_new_backing_page:
>  		_debug("- new %p", newpage);
>  
>  		backpage = newpage;
>  		newpage = NULL;
>  
> -		lru_cache_add_file(backpage);
> -
>  	reread_backing_page:
>  		ret = bmapping->a_ops->readpage(NULL, backpage);
>  		if (ret < 0)
> @@ -538,8 +535,8 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
>  	monitor_backing_page:
>  		_debug("- monitor add");
>  
> -		ret = add_to_page_cache(netpage, op->mapping, netpage->index,
> -					cachefiles_gfp);
> +		ret = add_to_page_cache_lru(netpage, op->mapping,
> +					    netpage->index, cachefiles_gfp);
>  		if (ret < 0) {
>  			if (ret == -EEXIST) {
>  				page_cache_release(netpage);
> @@ -549,8 +546,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
>  			goto nomem;
>  		}
>  
> -		lru_cache_add_file(netpage);
> -
>  		/* install a monitor */
>  		page_cache_get(netpage);
>  		monitor->netfs_page = netpage;
> @@ -613,8 +608,8 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
>  	backing_page_already_uptodate:
>  		_debug("- uptodate");
>  
> -		ret = add_to_page_cache(netpage, op->mapping, netpage->index,
> -					cachefiles_gfp);
> +		ret = add_to_page_cache_lru(netpage, op->mapping,
> +					    netpage->index, cachefiles_gfp);
>  		if (ret < 0) {
>  			if (ret == -EEXIST) {
>  				page_cache_release(netpage);
> @@ -631,8 +626,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object,
>  
>  		fscache_mark_page_cached(op, netpage);
>  
> -		lru_cache_add_file(netpage);
> -
>  		/* the netpage is unlocked and marked up to date here */
>  		fscache_end_io(op, netpage, 0);
>  		page_cache_release(netpage);
> -- 
> 1.8.5.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ