linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Kirill A . Shutemov" <kirill@shutemov.name>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, Hugh Dickins <hughd@google.com>,
	William Kucharski <william.kucharski@oracle.com>
Subject: Re: [PATCH v2] page cache: Store only head pages in i_pages
Date: Wed, 13 Feb 2019 15:41:02 +0100	[thread overview]
Message-ID: <20190213144102.GA18351@quack2.suse.cz> (raw)
In-Reply-To: <20190212183454.26062-1-willy@infradead.org>

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@infradead.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@suse.cz>

after fixing these two.

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

  reply	other threads:[~2019-02-13 14:41 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 18:34 [PATCH v2] page cache: Store only head pages in i_pages Matthew Wilcox
2019-02-13 14:41 ` Jan Kara [this message]
2019-02-13 20:17   ` Matthew Wilcox
2019-02-14 16:27     ` Jan Kara
2019-02-14 13:30 ` Kirill A. Shutemov
2019-02-14 20:53   ` Matthew Wilcox
2019-02-14 22:03     ` Kirill A. Shutemov
2019-02-14 22:25       ` Matthew Wilcox
2019-02-14 21:17   ` Matthew Wilcox
2019-02-14 22:08     ` Kirill A. Shutemov
2019-02-14 22:11       ` Matthew Wilcox
2019-02-14 22:29         ` Kirill A. Shutemov
2019-02-14 22:29   ` Kirill A. Shutemov
2019-02-15 20:28     ` Matthew Wilcox
2019-02-14 22:41   ` Kirill A. Shutemov
2019-02-15 20:20     ` Matthew Wilcox
2019-02-15 21:17       ` Kirill A. Shutemov

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=20190213144102.GA18351@quack2.suse.cz \
    --to=jack@suse.cz \
    --cc=hughd@google.com \
    --cc=kirill@shutemov.name \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=william.kucharski@oracle.com \
    --cc=willy@infradead.org \
    /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).