aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2010-08-09 20:19:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-09 23:45:03 -0400
commit57250a5bf0f6ff68dc339572adbd881a11f366fa (patch)
treeef11c141a9f89403bcd4b1fc705d672c0ff41818
parent58c37f6e0dfaaab85a3c11fcbf24451dfe70c721 (diff)
mmu-notifiers: remove mmu notifier calls in apply_to_page_range()
It is not appropriate for apply_to_page_range() to directly call any mmu notifiers, because it is a general purpose function whose effect depends on what context it is called in and what the callback function does. In particular, if it is being used as part of an mmu notifier implementation, the recursive calls can be particularly problematic. It is up to apply_to_page_range's caller to do any notifier calls if necessary. It does not affect any in-tree users because they all operate on init_mm, and mmu notifiers only pertain to usermode mappings. [stefano.stabellini@eu.citrix.com: remove unused local `start'] Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Avi Kivity <avi@qumranet.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/memory.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 1ecca56e0a4..858829d06a9 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2006,11 +2006,10 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr,
2006{ 2006{
2007 pgd_t *pgd; 2007 pgd_t *pgd;
2008 unsigned long next; 2008 unsigned long next;
2009 unsigned long start = addr, end = addr + size; 2009 unsigned long end = addr + size;
2010 int err; 2010 int err;
2011 2011
2012 BUG_ON(addr >= end); 2012 BUG_ON(addr >= end);
2013 mmu_notifier_invalidate_range_start(mm, start, end);
2014 pgd = pgd_offset(mm, addr); 2013 pgd = pgd_offset(mm, addr);
2015 do { 2014 do {
2016 next = pgd_addr_end(addr, end); 2015 next = pgd_addr_end(addr, end);
@@ -2018,7 +2017,7 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr,
2018 if (err) 2017 if (err)
2019 break; 2018 break;
2020 } while (pgd++, addr = next, addr != end); 2019 } while (pgd++, addr = next, addr != end);
2021 mmu_notifier_invalidate_range_end(mm, start, end); 2020
2022 return err; 2021 return err;
2023} 2022}
2024EXPORT_SYMBOL_GPL(apply_to_page_range); 2023EXPORT_SYMBOL_GPL(apply_to_page_range);