Skip to contentSkip to conversation

mmu notifier srcu

PATCH New Andrea Arcangeli 1 participant 2 messages Aug 23, 2012

Subsystems (2)
lore
Share & tools
lore
#1 lore raw

PATCH 1/1 mm: mmu_notifier: have mmu_notifiers use a global SRCU so they may safely schedule

In reply to Andrea Arcangeli

From: Sagi Grimberg <[email protected]>

With an RCU based mmu_notifier implementation, any callout to mmu_notifier_invalidate_range_start, mmu_notifier_invalidate_range_end, or mmu_notifier_invalidate_page would not be allowed to call schedule as that could potentially allow a modification to the mmu_notifier structure while it is currently being used.

Since srcu allocs 4 machine words per instance per cpu, we may endup with memory exhaustion if we use srcu per mm. so all mms will share a global srcu. Note that during large mmu_notifier activity exit & unregister paths might hang for longer periods, but it is tolerable for current mmu_notifier clients.

---
 include/linux/mmu_notifier.h |    1 +
 mm/mmu_notifier.c            |   73 +++++++++++++++++++++++++++--------------
 2 files changed, 49 insertions(+), 25 deletions(-)
include/linux/mmu_notifier.h +1 -0
index 6f32b2b..4b7183e 100644
@@ -4,6 +4,7 @@
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <linux/mm_types.h>
+#include <linux/srcu.h>
 
 struct mmu_notifier;
 struct mmu_notifier_ops;
mm/mmu_notifier.c +48 -25

222 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#0 lore raw

PATCH 1/1 mmu notifier srcu

Hi Andrew,

Now that the i_mmap_mutex and anon_vma.lock are mutexes, it's easier to allow all mmu notifier methods to schedule. This is the first patch that is required to allow that. Others will follow shortly.

This has been updated compared to previous versions, according to Peter's suggestion to make the srcu global to save per-cpu memory (originally there was a srcu object in every mmu notifier structure). This slightly increases contention in the mmu_notifier_unregister or exit_mmap paths. But that's by far not a concern for KVM and hopefully for all other mmu notifier users.

Sagi Grimberg (1):
mm: mmu_notifier: have mmu_notifiers use a global SRCU so they may
safely schedule

 include/linux/mmu_notifier.h |    1 +
 mm/mmu_notifier.c            |   73 +++++++++++++++++++++++++++--------------
 2 files changed, 49 insertions(+), 25 deletions(-)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>