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: <20190213144102.GA18351@quack2.suse.cz>
Date:   Wed, 13 Feb 2019 15:41:02 +0100
From:   Jan Kara <jack@...e.cz>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     "Kirill A . Shutemov" <kirill@...temov.name>, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        Hugh Dickins <hughd@...gle.com>,
        William Kucharski <william.kucharski@...cle.com>
Subject: Re: [PATCH v2] page cache: Store only head pages in i_pages

On Tue 12-02-19 10:34:54, Matthew Wilcox wrote:
> Transparent Huge Pages are currently stored in i_pages as pointers to
> consecutive subpages.  This patch changes that to storing consecutive
> pointers to the head page in preparation for storing huge pages more
> efficiently in i_pages.
> 
> Large parts of this are "inspired" by Kirill's patch
> https://lore.kernel.org/lkml/20170126115819.58875-2-kirill.shutemov@linux.intel.com/
> 
> Signed-off-by: Matthew Wilcox <willy@...radead.org>

I like the idea!

> @@ -1778,33 +1767,27 @@ unsigned find_get_pages_range(struct address_space *mapping, pgoff_t *start,
>  
>  	rcu_read_lock();
>  	xas_for_each(&xas, page, end) {
> -		struct page *head;
>  		if (xas_retry(&xas, page))
>  			continue;
>  		/* Skip over shadow, swap and DAX entries */
>  		if (xa_is_value(page))
>  			continue;
>  
> -		head = compound_head(page);
> -		if (!page_cache_get_speculative(head))
> +		if (!page_cache_get_speculative(page))
>  			goto retry;
>  
> -		/* The page was split under us? */
> -		if (compound_head(page) != head)
> -			goto put_page;
> -
> -		/* Has the page moved? */
> +		/* Has the page moved or been split? */
>  		if (unlikely(page != xas_reload(&xas)))
>  			goto put_page;
>  
> -		pages[ret] = page;
> +		pages[ret] = find_subpage(page, xas.xa_index);
>  		if (++ret == nr_pages) {
>  			*start = page->index + 1;
>  			goto out;
>  		}

So this subtly changes the behavior because now we will be returning in
'*start' a different index. So you should rather use 'pages[ret]->index'
instead.

> @@ -1923,26 +1899,21 @@ unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index,
>  		if (xa_is_value(page))
>  			continue;
>  
> -		head = compound_head(page);
> -		if (!page_cache_get_speculative(head))
> +		if (!page_cache_get_speculative(page))
>  			goto retry;
>  
> -		/* The page was split under us? */
> -		if (compound_head(page) != head)
> -			goto put_page;
> -
> -		/* Has the page moved? */
> +		/* Has the page moved or been split? */
>  		if (unlikely(page != xas_reload(&xas)))
>  			goto put_page;
>  
> -		pages[ret] = page;
> +		pages[ret] = find_subpage(page, xas.xa_index);
>  		if (++ret == nr_pages) {
>  			*index = page->index + 1;
>  			goto out;
>  		}

Ditto here.

Otherwise the patch looks good to me so feel free to add:

Acked-by: Jan Kara <jack@...e.cz>

after fixing these two.

								Honza
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ