From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH 2/2] page cache: Store only head pages in i_pages
Date: Fri, 23 Nov 2018 20:36:51 +0300 [thread overview]
Message-ID: <20181123173650.eteuc44bppvxwbcd@kshutemo-mobl1> (raw)
In-Reply-To: <20181123171900.GU3065@bombadil.infradead.org>
On Fri, Nov 23, 2018 at 09:19:00AM -0800, Matthew Wilcox wrote:
> On Fri, Nov 23, 2018 at 01:56:44PM +0300, Kirill A. Shutemov wrote:
> > On Thu, Nov 22, 2018 at 01:32:24PM -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.
> >
> > I probably miss something, I don't see how it wouldn't break
> > split_huge_page().
> >
> > I don't see what would replace head pages in i_pages with
> > formerly-tail-pages?
>
> You're quite right. Where's your test-suite? ;-)
Yeah-yeah...
> I think this should do the job:
>
> +++ b/mm/huge_memory.c
> @@ -2464,6 +2464,9 @@ static void __split_huge_page(struct page *page, struct list_head *list,
> if (IS_ENABLED(CONFIG_SHMEM) && PageSwapBacked(head))
> shmem_uncharge(head->mapping->host, 1);
> put_page(head + i);
> + } else if (!PageAnon(page)) {
> + __xa_store(&head->mapping->i_pages, head[i].index,
> + head + i, 0);
> }
> }
Looks good to me. But I still need to look into the rest of the patch.
> Having looked at this area, I think there was actually a bug in the patch
> you wrote that I'm cribbing from. You inserted the tail pages before
> calling __split_huge_page_tail(), so a racing lookup would have found
> a tail page before it got transformed into a non-tail page.
I don't think so.
The page still has refcount==0 and any lookup of the page suppose to fail
due to !page_cache_get_speculative() or block on tree lock.
--
Kirill A. Shutemov
prev parent reply other threads:[~2018-11-23 17:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-22 21:32 [PATCH 0/2] Better support for THP in page cache Matthew Wilcox
2018-11-22 21:32 ` [PATCH 1/2] mm: Remove redundant test from find_get_pages_contig Matthew Wilcox
2018-11-23 10:47 ` Kirill A. Shutemov
2018-11-23 17:59 ` Matthew Wilcox
2018-11-22 21:32 ` [PATCH 2/2] page cache: Store only head pages in i_pages Matthew Wilcox
2018-11-23 10:56 ` Kirill A. Shutemov
2018-11-23 17:19 ` Matthew Wilcox
2018-11-23 17:36 ` Kirill A. Shutemov [this message]
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=20181123173650.eteuc44bppvxwbcd@kshutemo-mobl1 \
--to=kirill@shutemov.name \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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).