sagig wrote:
Hey Konstantin,
Do you have any comments on V2?
only one, below.
On 2/6/2012 4:40 PM, sagig@xxxxxxxxxxxx wrote:
From: Sagi Grimberg<sagig@xxxxxxxxxxxxxx>
Now that anon_vma lock and i_mmap_mutex are both sleepable mutex, it is possible to schedule inside invalidation callbacks
(such as invalidate_page, invalidate_range_start/end and change_pte) .
This is essential for a scheduling HW sync in RDMA drivers which apply on demand paging methods.
Signed-off-by: Sagi Grimberg<sagig@xxxxxxxxxxxxxx>
---
changes from V1:
1. converted synchronize_rcu() to synchronize_srcu() to racing candidates (unregister, release)
2. do_mmu_notifier_register: moved init_srcu_struct out of mmap_sem locking.
3. do_mmu_notifier_register: fixed error path.
include/linux/mmu_notifier.h | 3 +++
mm/mmu_notifier.c | 38 +++++++++++++++++++++++++-------------
2 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 1d1b1e1..f3d6f30 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -226,8 +233,12 @@ static int do_mmu_notifier_register(struct mmu_notifier *mn,
out_cleanup:
if (take_mmap_sem)
up_write(&mm->mmap_sem);
- /* kfree() does nothing if mmu_notifier_mm is NULL */
- kfree(mmu_notifier_mm);
+
+ if (mm->mmu_notifier_mm) {
+ /* in the case srcu_init failed srcu_cleanup is safe */
+ cleanup_srcu_struct(&mm->mmu_notifier_mm->srcu);
+ kfree(mmu_notifier_mm);
+ }
this seems incorrect. there must be:
if (mmu_notifier_mm) {
cleanup_srcu_struct(&mmu_notifier_mm->srcu);
kfree(mmu_notifier_mm);
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>