]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - mm/mmu_notifier.c
mm/mempolicy: fix the check of nodemask from user
[mirror_ubuntu-bionic-kernel.git] / mm / mmu_notifier.c
index 314285284e6e6a4c764d0f8126dd0fecf8f7f84e..96edb33fd09a79601ac0a54378ca4ff26df9112a 100644 (file)
@@ -190,7 +190,9 @@ void __mmu_notifier_invalidate_range_start(struct mm_struct *mm,
 EXPORT_SYMBOL_GPL(__mmu_notifier_invalidate_range_start);
 
 void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
-                                 unsigned long start, unsigned long end)
+                                        unsigned long start,
+                                        unsigned long end,
+                                        bool only_end)
 {
        struct mmu_notifier *mn;
        int id;
@@ -204,8 +206,13 @@ void __mmu_notifier_invalidate_range_end(struct mm_struct *mm,
                 * subsystem registers either invalidate_range_start()/end() or
                 * invalidate_range(), so this will be no additional overhead
                 * (besides the pointer check).
+                *
+                * We skip call to invalidate_range() if we know it is safe ie
+                * call site use mmu_notifier_invalidate_range_only_end() which
+                * is safe to do when we know that a call to invalidate_range()
+                * already happen under page table lock.
                 */
-               if (mn->ops->invalidate_range)
+               if (!only_end && mn->ops->invalidate_range)
                        mn->ops->invalidate_range(mn, mm, start, end);
                if (mn->ops->invalidate_range_end)
                        mn->ops->invalidate_range_end(mn, mm, start, end);