All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thp, mlock: update unevictable-lru.txt
@ 2016-03-15 14:55 Kirill A. Shutemov
  2016-03-15 15:30 ` Dave Hansen
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2016-03-15 14:55 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, Kirill A. Shutemov

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

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

diff --git a/Documentation/vm/unevictable-lru.txt b/Documentation/vm/unevictable-lru.txt
index fa3b527086fa..c47566fc49cb 100644
--- a/Documentation/vm/unevictable-lru.txt
+++ b/Documentation/vm/unevictable-lru.txt
@@ -461,6 +461,25 @@ 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
+-------------------------------
+
+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.
+
+We allow a part of transparent huge page to be mapped PTEs (i.e. after
+mremap() or mprotect()) and VMA with PTE-mapped huge page can be mlocked.
+
+That means we need to be careful, not making entire huge page unevicable
+if user mlock() only part of it.
+
+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.
+
+See also comment in follow_trans_huge_pmd().
 
 mmap(MAP_LOCKED) SYSTEM CALL HANDLING
 -------------------------------------
-- 
2.7.0

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] thp, mlock: update unevictable-lru.txt
  2016-03-15 14:55 [PATCH] thp, mlock: update unevictable-lru.txt Kirill A. Shutemov
@ 2016-03-15 15:30 ` Dave Hansen
  2016-03-15 15:42   ` Kirill A. Shutemov
  0 siblings, 1 reply; 4+ messages in thread
From: Dave Hansen @ 2016-03-15 15:30 UTC (permalink / raw)
  To: Kirill A. Shutemov, Andrew Morton; +Cc: linux-mm

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.

...
> +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?

I think we should probably avoid saying "mlocking" when we really mean
"kernel-internal mlocked page handling" aka. the unevictable list.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] thp, mlock: update unevictable-lru.txt
  2016-03-15 15:30 ` Dave Hansen
@ 2016-03-15 15:42   ` Kirill A. Shutemov
  2016-03-15 16:56     ` Kirill A. Shutemov
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2016-03-15 15:42 UTC (permalink / raw)
  To: Dave Hansen; +Cc: Kirill A. Shutemov, Andrew Morton, linux-mm

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] thp, mlock: update unevictable-lru.txt
  2016-03-15 15:42   ` Kirill A. Shutemov
@ 2016-03-15 16:56     ` Kirill A. Shutemov
  0 siblings, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2016-03-15 16:56 UTC (permalink / raw)
  To: Kirill A. Shutemov; +Cc: Dave Hansen, Andrew Morton, linux-mm

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-15 16:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-15 14:55 [PATCH] thp, mlock: update unevictable-lru.txt Kirill A. Shutemov
2016-03-15 15:30 ` Dave Hansen
2016-03-15 15:42   ` Kirill A. Shutemov
2016-03-15 16:56     ` Kirill A. Shutemov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.