Commit:     462e00cc7151ed91fba688594436c453c80efb5d
Parent:     b71636e29823c0602d908a2a62e94c9b57a97491
Author:     Ethan Solomita <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 15 23:38:16 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Mon Jul 16 09:05:36 2007 -0700

    oom: stop allocating user memory if TIF_MEMDIE is set
    get_user_pages() can try to allocate a nearly unlimited amount of memory on
    behalf of a user process, even if that process has been OOM killed.  The
    OOM kill occurs upon return to user space via a SIGKILL, but
    get_user_pages() will try allocate all its memory before returning.  Change
    get_user_pages() to check for TIF_MEMDIE, and if set then return
    Signed-off-by: Ethan Solomita <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 mm/memory.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index ee29259..cfddcd2 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1055,6 +1055,14 @@ int get_user_pages(struct task_struct *tsk, struct 
mm_struct *mm,
                do {
                        struct page *page;
+                       /*
+                        * If tsk is ooming, cut off its access to large memory
+                        * allocations. It has a pending SIGKILL, but it can't
+                        * be processed until returning to user space.
+                        */
+                       if (unlikely(test_tsk_thread_flag(tsk, TIF_MEMDIE)))
+                               return -ENOMEM;
                        if (write)
                                foll_flags |= FOLL_WRITE;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to