Re: [PATCH] thp, mlock: update unevictable-lru.txt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 15, 2016 at 06:42:58PM +0300, Kirill A. Shutemov wrote:
> On Tue, Mar 15, 2016 at 08:30:54AM -0700, Dave Hansen wrote:
> > On 03/15/2016 07:55 AM, Kirill A. Shutemov wrote:
> > > +Transparent huge page is represented by single entry on a lru list and
> > > +therefore we can only make unevictable entire compound page, not
> > > +individual subpages.
> > 
> > A few grammar nits:
> > 
> > A transparent huge page is represented by a single entry on an lru list.
> > Therefore, we can only make unevictable an entire compound page, not
> > individual subpages.
> 
> Thanks.
> 
> > > +We handle this by forbidding mlocking PTE-mapped huge pages. This way we
> > > +keep the huge page accessible for vmscan. Under memory pressure the page
> > > +will be split, subpages from VM_LOCKED VMAs moved to unevictable lru and
> > > +the rest can be evicted.
> > 
> > What do you mean by "mlocking" in this context?  Do you mean that we
> > actually return -ESOMETHING from mlock() on PTE-mapped huge pages?  Or,
> > do you just mean that we defer treating PTE-mapped huge pages as
> > PageUnevictable() inside the kernel?
> 
> The latter.
> 
> > I think we should probably avoid saying "mlocking" when we really mean
> > "kernel-internal mlocked page handling" aka. the unevictable list.
> 
> What about
> 
> "We handle this by keeping PTE-mapped huge pages on normal LRU lists."
> 
> ?
> 
> The updated patch is below.

Err. That was the old patch.


>From 2d805c15cf5f2ebee324f12646da6db3e095a4ba Mon Sep 17 00:00:00 2001
From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
Date: Tue, 15 Mar 2016 17:48:16 +0300
Subject: [PATCH] thp, mlock: update unevictable-lru.txt

Add description of THP handling into unevictable-lru.txt.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
---
 Documentation/vm/unevictable-lru.txt | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/Documentation/vm/unevictable-lru.txt b/Documentation/vm/unevictable-lru.txt
index fa3b527086fa..0026a8d33fc0 100644
--- a/Documentation/vm/unevictable-lru.txt
+++ b/Documentation/vm/unevictable-lru.txt
@@ -461,6 +461,27 @@ unevictable LRU is enabled, the work of compaction is mostly handled by
 the page migration code and the same work flow as described in MIGRATING
 MLOCKED PAGES will apply.
 
+MLOCKING TRANSPARENT HUGE PAGES
+-------------------------------
+
+A transparent huge page is represented by a single entry on an LRU list.
+Therefore, we can only make unevictable an entire compound page, not
+individual subpages.
+
+If a user tries to mlock() part of a huge page, we want the rest of the
+page to be reclaimable.
+
+We cannot just split the page on partial mlock() as split_huge_page() can
+fail and new intermittent failure mode for the syscall is undesirable.
+
+We handle this by keeping PTE-mapped huge pages on normal LRU lists: the
+PMD on border of VM_LOCKED VMA will be split into PTE table.
+
+This way the huge page is accessible for vmscan. Under memory pressure the
+page will be split, subpages which belong to VM_LOCKED VMAs will be moved
+to unevictable LRU and the rest can be reclaimed.
+
+See also comment in follow_trans_huge_pmd().
 
 mmap(MAP_LOCKED) SYSTEM CALL HANDLING
 -------------------------------------
-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]