All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Michal Hocko <mhocko@kernel.org>
Cc: <linux-mm@kvack.org>, LKML <linux-kernel@vger.kernel.org>,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	David Rientjes <rientjes@google.com>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH 2/9] mm, oom: introduce oom reaper
Date: Tue, 22 Mar 2016 15:45:33 -0700	[thread overview]
Message-ID: <20160322154533.c269d76a65b81bb1b8f72545@linux-foundation.org> (raw)
In-Reply-To: <1458644426-22973-3-git-send-email-mhocko@kernel.org>

On Tue, 22 Mar 2016 12:00:19 +0100 Michal Hocko <mhocko@kernel.org> wrote:

> This is based on the idea from Mel Gorman discussed during LSFMM 2015 and
> independently brought up by Oleg Nesterov.

What happened to oom-reaper-handle-mlocked-pages.patch?  I have it in
-mm but I don't see it in this v6.


From: Michal Hocko <mhocko@suse.com>
Subject: oom reaper: handle mlocked pages

__oom_reap_vmas current skips over all mlocked vmas because they need a
special treatment before they are unmapped.  This is primarily done for
simplicity.  There is no reason to skip over them and reduce the amount of
reclaimed memory.  This is safe from the semantic point of view because
try_to_unmap_one during rmap walk would keep tell the reclaim to cull the
page back and mlock it again.

munlock_vma_pages_all is also safe to be called from the oom reaper
context because it doesn't sit on any locks but mmap_sem (for read).

Signed-off-by: Michal Hocko <mhocko@suse.com>
Cc: Andrea Argangeli <andrea@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/oom_kill.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff -puN mm/oom_kill.c~oom-reaper-handle-mlocked-pages mm/oom_kill.c
--- a/mm/oom_kill.c~oom-reaper-handle-mlocked-pages
+++ a/mm/oom_kill.c
@@ -442,13 +442,6 @@ static bool __oom_reap_vmas(struct mm_st
 			continue;
 
 		/*
-		 * mlocked VMAs require explicit munlocking before unmap.
-		 * Let's keep it simple here and skip such VMAs.
-		 */
-		if (vma->vm_flags & VM_LOCKED)
-			continue;
-
-		/*
 		 * Only anonymous pages have a good chance to be dropped
 		 * without additional steps which we cannot afford as we
 		 * are OOM already.
@@ -458,9 +451,12 @@ static bool __oom_reap_vmas(struct mm_st
 		 * we do not want to block exit_mmap by keeping mm ref
 		 * count elevated without a good reason.
 		 */
-		if (vma_is_anonymous(vma) || !(vma->vm_flags & VM_SHARED))
+		if (vma_is_anonymous(vma) || !(vma->vm_flags & VM_SHARED)) {
+			if (vma->vm_flags & VM_LOCKED)
+				munlock_vma_pages_all(vma);
 			unmap_page_range(&tlb, vma, vma->vm_start, vma->vm_end,
 					 &details);
+		}
 	}
 	tlb_finish_mmu(&tlb, 0, -1);
 	up_read(&mm->mmap_sem);
_

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Michal Hocko <mhocko@kernel.org>
Cc: linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
	David Rientjes <rientjes@google.com>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH 2/9] mm, oom: introduce oom reaper
Date: Tue, 22 Mar 2016 15:45:33 -0700	[thread overview]
Message-ID: <20160322154533.c269d76a65b81bb1b8f72545@linux-foundation.org> (raw)
In-Reply-To: <1458644426-22973-3-git-send-email-mhocko@kernel.org>

On Tue, 22 Mar 2016 12:00:19 +0100 Michal Hocko <mhocko@kernel.org> wrote:

> This is based on the idea from Mel Gorman discussed during LSFMM 2015 and
> independently brought up by Oleg Nesterov.

What happened to oom-reaper-handle-mlocked-pages.patch?  I have it in
-mm but I don't see it in this v6.


From: Michal Hocko <mhocko@suse.com>
Subject: oom reaper: handle mlocked pages

__oom_reap_vmas current skips over all mlocked vmas because they need a
special treatment before they are unmapped.  This is primarily done for
simplicity.  There is no reason to skip over them and reduce the amount of
reclaimed memory.  This is safe from the semantic point of view because
try_to_unmap_one during rmap walk would keep tell the reclaim to cull the
page back and mlock it again.

munlock_vma_pages_all is also safe to be called from the oom reaper
context because it doesn't sit on any locks but mmap_sem (for read).

Signed-off-by: Michal Hocko <mhocko@suse.com>
Cc: Andrea Argangeli <andrea@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/oom_kill.c |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff -puN mm/oom_kill.c~oom-reaper-handle-mlocked-pages mm/oom_kill.c
--- a/mm/oom_kill.c~oom-reaper-handle-mlocked-pages
+++ a/mm/oom_kill.c
@@ -442,13 +442,6 @@ static bool __oom_reap_vmas(struct mm_st
 			continue;
 
 		/*
-		 * mlocked VMAs require explicit munlocking before unmap.
-		 * Let's keep it simple here and skip such VMAs.
-		 */
-		if (vma->vm_flags & VM_LOCKED)
-			continue;
-
-		/*
 		 * Only anonymous pages have a good chance to be dropped
 		 * without additional steps which we cannot afford as we
 		 * are OOM already.
@@ -458,9 +451,12 @@ static bool __oom_reap_vmas(struct mm_st
 		 * we do not want to block exit_mmap by keeping mm ref
 		 * count elevated without a good reason.
 		 */
-		if (vma_is_anonymous(vma) || !(vma->vm_flags & VM_SHARED))
+		if (vma_is_anonymous(vma) || !(vma->vm_flags & VM_SHARED)) {
+			if (vma->vm_flags & VM_LOCKED)
+				munlock_vma_pages_all(vma);
 			unmap_page_range(&tlb, vma, vma->vm_start, vma->vm_end,
 					 &details);
+		}
 	}
 	tlb_finish_mmu(&tlb, 0, -1);
 	up_read(&mm->mmap_sem);
_

--
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>

  reply	other threads:[~2016-03-22 22:45 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-22 11:00 [PATCH 0/9] oom reaper v6 Michal Hocko
2016-03-22 11:00 ` Michal Hocko
2016-03-22 11:00 ` [PATCH 1/9] sched: add schedule_timeout_idle() Michal Hocko
2016-03-22 11:00   ` Michal Hocko
2016-03-22 12:23   ` Peter Zijlstra
2016-03-22 12:23     ` Peter Zijlstra
2016-03-22 12:33     ` Michal Hocko
2016-03-22 12:33       ` Michal Hocko
2016-03-22 12:51       ` Peter Zijlstra
2016-03-22 12:51         ` Peter Zijlstra
2016-03-22 13:08         ` Michal Hocko
2016-03-22 13:08           ` Michal Hocko
2016-03-22 13:22           ` Peter Zijlstra
2016-03-22 13:22             ` Peter Zijlstra
2016-03-22 17:56             ` Johannes Weiner
2016-03-22 17:56               ` Johannes Weiner
2016-03-22 21:23               ` Peter Zijlstra
2016-03-22 21:23                 ` Peter Zijlstra
2016-03-23 10:43                 ` Michal Hocko
2016-03-23 10:43                   ` Michal Hocko
2016-03-22 23:02     ` Andrew Morton
2016-03-22 23:02       ` Andrew Morton
2016-03-22 11:00 ` [PATCH 2/9] mm, oom: introduce oom reaper Michal Hocko
2016-03-22 11:00   ` Michal Hocko
2016-03-22 22:45   ` Andrew Morton [this message]
2016-03-22 22:45     ` Andrew Morton
2016-03-22 22:58     ` Hugh Dickins
2016-03-22 22:58       ` Hugh Dickins
2016-03-22 11:00 ` [PATCH 3/9] oom: clear TIF_MEMDIE after oom_reaper managed to unmap the address space Michal Hocko
2016-03-22 11:00   ` Michal Hocko
2016-03-22 11:00 ` [PATCH 4/9] mm, oom_reaper: report success/failure Michal Hocko
2016-03-22 11:00   ` Michal Hocko
2016-03-22 11:00 ` [PATCH 5/9] mm, oom_reaper: implement OOM victims queuing Michal Hocko
2016-03-22 11:00   ` Michal Hocko
2016-03-22 11:00 ` [PATCH 6/9] oom, oom_reaper: disable oom_reaper for oom_kill_allocating_task Michal Hocko
2016-03-22 11:00   ` Michal Hocko
2016-03-22 11:00 ` [PATCH 7/9] oom: make oom_reaper_list single linked Michal Hocko
2016-03-22 11:00   ` Michal Hocko
2016-03-22 11:00 ` [PATCH 8/9] oom: make oom_reaper freezable Michal Hocko
2016-03-22 11:00   ` Michal Hocko
2016-03-22 11:00 ` [PATCH 9/9] oom, oom_reaper: protect oom_reaper_list using simpler way Michal Hocko
2016-03-22 11:00   ` Michal Hocko
2016-03-22 22:08 ` [PATCH 0/9] oom reaper v6 David Rientjes
2016-03-22 22:08   ` David Rientjes
2016-03-23 11:11   ` Tetsuo Handa
2016-03-23 11:11     ` Tetsuo Handa
2016-03-23 12:07     ` Michal Hocko
2016-03-23 12:07       ` Michal Hocko
2023-12-21 21:24 [PATCH 2/9] mm, oom: introduce oom reaper AGUNG YULIYANA

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=20160322154533.c269d76a65b81bb1b8f72545@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=rientjes@google.com \
    /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 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.