sched/headers: Move the memalloc_noio_*() APIs to <linux/sched/mm.h>
authorIngo Molnar <mingo@kernel.org>
Thu, 2 Feb 2017 19:43:54 +0000 (20:43 +0100)
committerIngo Molnar <mingo@kernel.org>
Fri, 3 Mar 2017 00:43:42 +0000 (01:43 +0100)
In preparation to remove the <linux/gfp.h> include from <linux/sched.h>.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/sched.h
include/linux/sched/mm.h

index 1e04000..dbc3ff0 100644 (file)
@@ -1468,28 +1468,6 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, u64 *ut, u64 *s
 #define tsk_used_math(p) ((p)->flags & PF_USED_MATH)
 #define used_math() tsk_used_math(current)
 
-/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags
- * __GFP_FS is also cleared as it implies __GFP_IO.
- */
-static inline gfp_t memalloc_noio_flags(gfp_t flags)
-{
-       if (unlikely(current->flags & PF_MEMALLOC_NOIO))
-               flags &= ~(__GFP_IO | __GFP_FS);
-       return flags;
-}
-
-static inline unsigned int memalloc_noio_save(void)
-{
-       unsigned int flags = current->flags & PF_MEMALLOC_NOIO;
-       current->flags |= PF_MEMALLOC_NOIO;
-       return flags;
-}
-
-static inline void memalloc_noio_restore(unsigned int flags)
-{
-       current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags;
-}
-
 /* Per-process atomic flags. */
 #define PFA_NO_NEW_PRIVS 0     /* May not gain new privileges. */
 #define PFA_SPREAD_PAGE  1      /* Spread page cache over cpuset */
index 64d83fa..62dca4e 100644 (file)
@@ -147,4 +147,26 @@ static inline bool in_vfork(struct task_struct *tsk)
        return ret;
 }
 
+/* __GFP_IO isn't allowed if PF_MEMALLOC_NOIO is set in current->flags
+ * __GFP_FS is also cleared as it implies __GFP_IO.
+ */
+static inline gfp_t memalloc_noio_flags(gfp_t flags)
+{
+       if (unlikely(current->flags & PF_MEMALLOC_NOIO))
+               flags &= ~(__GFP_IO | __GFP_FS);
+       return flags;
+}
+
+static inline unsigned int memalloc_noio_save(void)
+{
+       unsigned int flags = current->flags & PF_MEMALLOC_NOIO;
+       current->flags |= PF_MEMALLOC_NOIO;
+       return flags;
+}
+
+static inline void memalloc_noio_restore(unsigned int flags)
+{
+       current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags;
+}
+
 #endif /* _LINUX_SCHED_MM_H */