linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: 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: Fri, 15 Feb 2019 12:28:58 -0800	[thread overview]
Message-ID: <20190215202858.GL12668@bombadil.infradead.org> (raw)
In-Reply-To: <20190214222944.74ipvbnvo2lvfgnr@kshutemo-mobl1>

On Fri, Feb 15, 2019 at 01:29:44AM +0300, Kirill A. Shutemov wrote:
> On Thu, Feb 14, 2019 at 04:30:04PM +0300, Kirill A. Shutemov wrote:
> > On Tue, Feb 12, 2019 at 10:34:54AM -0800, 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 believe I found few missing pieces:
> > 
> >  - page_cache_delete_batch() will blow up on
> > 
> > 			VM_BUG_ON_PAGE(page->index + HPAGE_PMD_NR - tail_pages
> > 					!= pvec->pages[i]->index, page);
> > 
> >  - migrate_page_move_mapping() has to be converted too.
> 
> Other missing pieces are memfd_wait_for_pins() and memfd_tag_pins()
> We need to call page_mapcount() for tail pages there.

@@ -39,6 +39,7 @@ static void memfd_tag_pins(struct xa_state *xas)
        xas_for_each(xas, page, ULONG_MAX) {
                if (xa_is_value(page))
                        continue;
+               page = find_subpage(page, xas.xa_index);
                if (page_count(page) - page_mapcount(page) > 1)
                        xas_set_mark(xas, MEMFD_TAG_PINNED);
 
@@ -88,6 +89,7 @@ static int memfd_wait_for_pins(struct address_space *mapping)
                        bool clear = true;
                        if (xa_is_value(page))
                                continue;
+                       page = find_subpage(page, xas.xa_index);
                        if (page_count(page) - page_mapcount(page) != 1) {
                                /*
                                 * On the last scan, we clean up all those tags


  reply	other threads:[~2019-02-15 20:29 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
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 [this message]
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=20190215202858.GL12668@bombadil.infradead.org \
    --to=willy@infradead.org \
    --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 \
    /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).