|
@@ -2379,101 +2379,6 @@ static inline unsigned long sigsp(unsigned long sp, struct ksignal *ksig)
|
|
return sp;
|
|
return sp;
|
|
}
|
|
}
|
|
|
|
|
|
-/*
|
|
|
|
- * Routines for handling mm_structs
|
|
|
|
- */
|
|
|
|
-extern struct mm_struct * mm_alloc(void);
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * mmgrab() - Pin a &struct mm_struct.
|
|
|
|
- * @mm: The &struct mm_struct to pin.
|
|
|
|
- *
|
|
|
|
- * Make sure that @mm will not get freed even after the owning task
|
|
|
|
- * exits. This doesn't guarantee that the associated address space
|
|
|
|
- * will still exist later on and mmget_not_zero() has to be used before
|
|
|
|
- * accessing it.
|
|
|
|
- *
|
|
|
|
- * This is a preferred way to to pin @mm for a longer/unbounded amount
|
|
|
|
- * of time.
|
|
|
|
- *
|
|
|
|
- * Use mmdrop() to release the reference acquired by mmgrab().
|
|
|
|
- *
|
|
|
|
- * See also <Documentation/vm/active_mm.txt> for an in-depth explanation
|
|
|
|
- * of &mm_struct.mm_count vs &mm_struct.mm_users.
|
|
|
|
- */
|
|
|
|
-static inline void mmgrab(struct mm_struct *mm)
|
|
|
|
-{
|
|
|
|
- atomic_inc(&mm->mm_count);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/* mmdrop drops the mm and the page tables */
|
|
|
|
-extern void __mmdrop(struct mm_struct *);
|
|
|
|
-static inline void mmdrop(struct mm_struct *mm)
|
|
|
|
-{
|
|
|
|
- if (unlikely(atomic_dec_and_test(&mm->mm_count)))
|
|
|
|
- __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);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * mmget() - Pin the address space associated with a &struct mm_struct.
|
|
|
|
- * @mm: The address space to pin.
|
|
|
|
- *
|
|
|
|
- * Make sure that the address space of the given &struct mm_struct doesn't
|
|
|
|
- * go away. This does not protect against parts of the address space being
|
|
|
|
- * modified or freed, however.
|
|
|
|
- *
|
|
|
|
- * Never use this function to pin this address space for an
|
|
|
|
- * unbounded/indefinite amount of time.
|
|
|
|
- *
|
|
|
|
- * Use mmput() to release the reference acquired by mmget().
|
|
|
|
- *
|
|
|
|
- * See also <Documentation/vm/active_mm.txt> for an in-depth explanation
|
|
|
|
- * of &mm_struct.mm_count vs &mm_struct.mm_users.
|
|
|
|
- */
|
|
|
|
-static inline void mmget(struct mm_struct *mm)
|
|
|
|
-{
|
|
|
|
- atomic_inc(&mm->mm_users);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static inline bool mmget_not_zero(struct mm_struct *mm)
|
|
|
|
-{
|
|
|
|
- return atomic_inc_not_zero(&mm->mm_users);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-/* mmput gets rid of the mappings and all user-space */
|
|
|
|
-extern void mmput(struct mm_struct *);
|
|
|
|
-#ifdef CONFIG_MMU
|
|
|
|
-/* same as above but performs the slow path from the async context. Can
|
|
|
|
- * be called from the atomic context as well
|
|
|
|
- */
|
|
|
|
-extern void mmput_async(struct mm_struct *);
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-/* Grab a reference to a task's mm, if it is not already going away */
|
|
|
|
-extern struct mm_struct *get_task_mm(struct task_struct *task);
|
|
|
|
-/*
|
|
|
|
- * Grab a reference to a task's mm, if it is not already going away
|
|
|
|
- * and ptrace_may_access with the mode parameter passed to it
|
|
|
|
- * succeeds.
|
|
|
|
- */
|
|
|
|
-extern struct mm_struct *mm_access(struct task_struct *task, unsigned int mode);
|
|
|
|
-/* Remove the current tasks stale references to the old mm_struct */
|
|
|
|
-extern void mm_release(struct task_struct *, struct mm_struct *);
|
|
|
|
-
|
|
|
|
#ifdef CONFIG_HAVE_COPY_THREAD_TLS
|
|
#ifdef CONFIG_HAVE_COPY_THREAD_TLS
|
|
extern int copy_thread_tls(unsigned long, unsigned long, unsigned long,
|
|
extern int copy_thread_tls(unsigned long, unsigned long, unsigned long,
|
|
struct task_struct *, unsigned long);
|
|
struct task_struct *, unsigned long);
|