]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - mm/oom_kill.c
UBUNTU: [Config] CONFIG_SENSORS_IR35221=m
[mirror_ubuntu-artful-kernel.git] / mm / oom_kill.c
index 9e8b4f030c1c43cb92da706306e1b9390658af7b..5f6a52903770fa4f79539ff620269dc1ea8339bd 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/ratelimit.h>
 #include <linux/kthread.h>
 #include <linux/init.h>
+#include <linux/mmu_notifier.h>
 
 #include <asm/tlb.h>
 #include "internal.h"
@@ -494,6 +495,21 @@ static bool __oom_reap_task_mm(struct task_struct *tsk, struct mm_struct *mm)
                goto unlock_oom;
        }
 
+       /*
+        * If the mm has notifiers then we would need to invalidate them around
+        * unmap_page_range and that is risky because notifiers can sleep and
+        * what they do is basically undeterministic.  So let's have a short
+        * sleep to give the oom victim some more time.
+        * TODO: we really want to get rid of this ugly hack and make sure that
+        * notifiers cannot block for unbounded amount of time and add
+        * mmu_notifier_invalidate_range_{start,end} around unmap_page_range
+        */
+       if (mm_has_notifiers(mm)) {
+               up_read(&mm->mmap_sem);
+               schedule_timeout_idle(HZ);
+               goto unlock_oom;
+       }
+
        /*
         * increase mm_users only after we know we will reap something so
         * that the mmput_async is called only when we have reaped something