If we're using PF_MEMALLOC, we might have a fallback and might not to warn about a failing allocation - thus we need a PF_* equivalent of __GFP_NOWARN. Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Darrick J. Wong <djwong@xxxxxxxxxx> --- include/linux/sched.h | 8 ++++---- include/linux/sched/mm.h | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index cdb8ea53c365..36a5046ea3fa 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1632,11 +1632,11 @@ extern struct pid *cad_pid; #define PF_KSWAPD 0x00020000 /* I am kswapd */ #define PF_MEMALLOC_NOFS 0x00040000 /* All allocation requests will inherit GFP_NOFS */ #define PF_MEMALLOC_NOIO 0x00080000 /* All allocation requests will inherit GFP_NOIO */ -#define PF_LOCAL_THROTTLE 0x00100000 /* Throttle writes only against the bdi I write to, +#define PF_MEMALLOC_NOWARN 0x00100000 /* All allocation requests will inherit __GFP_NOWARN */ +#define PF_LOCAL_THROTTLE 0x00200000 /* Throttle writes only against the bdi I write to, * I am cleaning dirty pages from some other bdi. */ -#define PF_KTHREAD 0x00200000 /* I am a kernel thread */ -#define PF_RANDOMIZE 0x00400000 /* Randomize virtual address space */ -#define PF__HOLE__00800000 0x00800000 +#define PF_KTHREAD 0x00400000 /* I am a kernel thread */ +#define PF_RANDOMIZE 0x00800000 /* Randomize virtual address space */ #define PF__HOLE__01000000 0x01000000 #define PF__HOLE__02000000 0x02000000 #define PF_NO_SETAFFINITY 0x04000000 /* Userland is not allowed to meddle with cpus_mask */ diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index f00d7ecc2adf..817f5c1bf3d5 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h @@ -236,7 +236,10 @@ static inline gfp_t current_gfp_context(gfp_t flags) { unsigned int pflags = READ_ONCE(current->flags); - if (unlikely(pflags & (PF_MEMALLOC_NOIO | PF_MEMALLOC_NOFS | PF_MEMALLOC_PIN))) { + if (unlikely(pflags & (PF_MEMALLOC_NOIO | + PF_MEMALLOC_NOFS | + PF_MEMALLOC_NOWARN | + PF_MEMALLOC_PIN))) { /* * NOIO implies both NOIO and NOFS and it is a weaker context * so always make sure it makes precedence @@ -246,6 +249,9 @@ static inline gfp_t current_gfp_context(gfp_t flags) else if (pflags & PF_MEMALLOC_NOFS) flags &= ~__GFP_FS; + if (pflags & PF_MEMALLOC_NOWARN) + flags |= __GFP_NOWARN; + if (pflags & PF_MEMALLOC_PIN) flags &= ~__GFP_MOVABLE; } -- 2.43.0