|
@@ -2877,6 +2877,20 @@ static inline void mmdrop(struct mm_struct *mm)
|
|
|
__mmdrop(mm);
|
|
|
}
|
|
|
|
|
|
+static inline void mmdrop_async_fn(struct work_struct *work)
|
|
|
+{
|
|
|
+ struct mm_struct *mm = container_of(work, struct mm_struct, async_put_work);
|
|
|
+ __mmdrop(mm);
|
|
|
+}
|
|
|
+
|
|
|
+static inline void mmdrop_async(struct mm_struct *mm)
|
|
|
+{
|
|
|
+ if (unlikely(atomic_dec_and_test(&mm->mm_count))) {
|
|
|
+ INIT_WORK(&mm->async_put_work, mmdrop_async_fn);
|
|
|
+ schedule_work(&mm->async_put_work);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static inline bool mmget_not_zero(struct mm_struct *mm)
|
|
|
{
|
|
|
return atomic_inc_not_zero(&mm->mm_users);
|