lkml.org 
[lkml]   [2015]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv5 04/28] mm, thp: adjust conditions when we can reuse the page on WP fault
On Tue, Apr 28, 2015 at 11:02:46AM +0800, Hillf Danton wrote:
> >
> > With new refcounting we will be able map the same compound page with
> > PTEs and PMDs. It requires adjustment to conditions when we can reuse
> > the page on write-protection fault.
> >
> > For PTE fault we can't reuse the page if it's part of huge page.
> >
> > For PMD we can only reuse the page if nobody else maps the huge page or
> > it's part. We can do it by checking page_mapcount() on each sub-page,
> > but it's expensive.
> >
> > The cheaper way is to check page_count() to be equal 1: every mapcount
> > takes page reference, so this way we can guarantee, that the PMD is the
> > only mapping.
> >
> > This approach can give false negative if somebody pinned the page, but
> > that doesn't affect correctness.
> >
> Then we have to try more to allocate THP if pinned?
> Are we adding new cost?

Yes we do. But that shouldn't be often.

Alternatively, we could iterate over all sub-pages and check their
mapcount.

--
Kirill A. Shutemov


\
 
 \ /
  Last update: 2015-04-28 19:01    [W:0.025 / U:1.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site