diff options
Diffstat (limited to 'include/linux/sched.h')
| -rw-r--r-- | include/linux/sched.h | 22 | 
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index e4112aad296..c2182b53dac 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -51,6 +51,7 @@ struct sched_param {  #include <linux/cred.h>  #include <linux/llist.h>  #include <linux/uidgid.h> +#include <linux/gfp.h>  #include <asm/processor.h> @@ -1791,6 +1792,7 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,  #define PF_FROZEN	0x00010000	/* frozen for system suspend */  #define PF_FSTRANS	0x00020000	/* inside a filesystem transaction */  #define PF_KSWAPD	0x00040000	/* I am kswapd */ +#define PF_MEMALLOC_NOIO 0x00080000	/* Allocating memory without IO involved */  #define PF_LESS_THROTTLE 0x00100000	/* Throttle me less: I clean memory */  #define PF_KTHREAD	0x00200000	/* I am a kernel thread */  #define PF_RANDOMIZE	0x00400000	/* randomize virtual address space */ @@ -1828,6 +1830,26 @@ extern void thread_group_cputime_adjusted(struct task_struct *p, cputime_t *ut,  #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 */ +static inline gfp_t memalloc_noio_flags(gfp_t flags) +{ +	if (unlikely(current->flags & PF_MEMALLOC_NOIO)) +		flags &= ~__GFP_IO; +	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; +} +  /*   * task->jobctl flags   */  |