Peter Zijlstra b972216e27 mmu_notifier: add call_srcu and sync function for listener to delay call and sync
When kernel device drivers or subsystems want to bind their lifespan to
t= he lifespan of the mm_struct, they usually use one of the following
methods:

1. Manually calling a function in the interested kernel module.  The
   funct= ion call needs to be placed in mmput.  This method was rejected
   by several ker= nel maintainers.

2. Registering to the mmu notifier release mechanism.

The problem with the latter approach is that the mmu_notifier_release
cal= lback is called from__mmu_notifier_release (called from exit_mmap).
That functi= on iterates over the list of mmu notifiers and don't expect
the release call= back function to remove itself from the list.
Therefore, the callback function= in the kernel module can't release the
mmu_notifier_object, which is actuall= y the kernel module's object
itself.  As a result, the destruction of the kernel module's object must
to be done in a delayed fashion.

This patch adds support for this delayed callback, by adding a new
mmu_notifier_call_srcu function that receives a function ptr and calls
th= at function with call_srcu.  In that function, the kernel module
releases its object.  To use mmu_notifier_call_srcu, the calling module
needs to call b= efore that a new function called
mmu_notifier_unregister_no_release that as its= name implies,
unregisters a notifier without calling its notifier release call= back.

This patch also adds a function that will call barrier_srcu so those
kern= el modules can sync with mmu_notifier.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Signed-off-by: Oded Gabbay <oded.gabbay@amd.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-08-06 18:01:22 -07:00
..
2014-05-06 17:54:53 -04:00
2014-08-05 16:19:15 -07:00
2014-06-11 08:35:34 -07:00
2014-06-03 23:12:20 +02:00
2014-08-01 22:35:55 +08:00
2014-08-05 15:59:35 -07:00
2014-07-08 13:36:52 -07:00
2014-06-04 13:34:30 +09:00
2014-07-13 21:38:49 -04:00
2014-04-18 14:20:48 +02:00
2014-05-20 10:30:40 +09:00
2014-08-06 18:01:19 -07:00
2014-06-06 16:08:13 -07:00
2014-06-02 16:05:24 -07:00
2014-06-02 14:56:01 -07:00
2014-07-08 09:40:06 +02:00
2014-04-17 12:30:40 -07:00
2014-06-16 16:26:54 +02:00
2014-06-25 17:45:43 -07:00
2014-07-22 21:55:45 +01:00
2014-05-27 17:38:11 -07:00
2014-06-04 10:02:38 -07:00
2014-06-10 14:35:22 -07:00
2014-06-10 14:35:22 -07:00
2014-08-04 17:32:24 -07:00
2014-07-09 14:58:37 +01:00
2014-06-04 16:54:07 -07:00
2014-06-04 16:54:21 -07:00
2014-05-05 17:25:50 +10:00
2014-06-04 16:54:12 -07:00
2014-06-06 16:08:12 -07:00
2014-06-12 00:21:11 -04:00
2014-06-04 16:53:57 -07:00
2014-06-04 16:53:56 -07:00
2014-05-14 09:46:32 -07:00
2014-05-30 11:35:54 -06:00
2014-06-04 16:53:57 -07:00
2014-06-04 16:53:57 -07:00