[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160226103253.GA22450@node.shutemov.name>
Date: Fri, 26 Feb 2016 13:32:53 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Andrea Arcangeli <aarcange@...hat.com>
Cc: Mel Gorman <mgorman@...hsingularity.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Rik van Riel <riel@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] mm: thp: Redefine default THP defrag behaviour
disable it by default
On Thu, Feb 25, 2016 at 08:01:44PM +0100, Andrea Arcangeli wrote:
> Another problem is that khugepaged isn't able to collapse shared
> readonly anon pages, mostly because of the rmap complexities. I agree
> with Kirill we should be looking into how make this work, although I
> doubt the simpler refcounting is going to help much in this regard as
> the problem is in dealing with rmap, not so much with refcounts.
Could you elaborate on problems with rmap? I have looked into this deeply
yet.
Do you see anything what would prevent following basic scheme:
- Identify series of small pages as candidate for collapsing into
a compound page. Not sure how difficult it would be. I guess it can be
done by looking for adjacent pages which belong to the same anon_vma.
- Setup migration entries for pte which maps these pages.
- Collapse small pages into compound page. IIUC, it only will be possible
if these pages are not pinned.
- Replace migration entries with ptes which point to subpages of the new
compound page.
- Scan over all vmas mapping this compound page, looking for VMA suitable
for huge page. We cannot collapse it right away due lock inversion of
anon_vma->rwsem vs. mmap_sem.
- For found VMAs, collapse page table into PMD one VMA a time under
down_write(mmap_sem).
Even if would fail to create any PMDs, we would reduce LRU pressure by
collapsing small pages into compound one.
--
Kirill A. Shutemov
Powered by blists - more mailing lists