X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=include%2Flinux%2Fsched%2Fmm.h;h=03feda7ab1defe0d03c9dce745df7a52f311d3c7;hb=1e574cb1aa07ab3a796c7d6c5501b96f3056ef4d;hp=347105c6e0caa83b7637459bd73de71bfe5bfb47;hpb=41bec63b265a38dd9fa168b6042ea5bf07135048;p=bcachefs-tools-debian diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h index 347105c..03feda7 100644 --- a/include/linux/sched/mm.h +++ b/include/linux/sched/mm.h @@ -1,7 +1,8 @@ #ifndef _LINUX_SCHED_MM_H #define _LINUX_SCHED_MM_H -#define PF_MEMALLOC_NOFS 0 +#define PF_MEMALLOC 0x00000800 /* Allocating memory */ +#define PF_MEMALLOC_NOFS 0x00040000 /* All allocation requests will inherit GFP_NOFS */ static inline unsigned int memalloc_nofs_save(void) { @@ -15,4 +16,16 @@ static inline void memalloc_nofs_restore(unsigned int flags) current->flags = (current->flags & ~PF_MEMALLOC_NOFS) | flags; } +static inline unsigned int memalloc_noreclaim_save(void) +{ + unsigned int flags = current->flags & PF_MEMALLOC; + current->flags |= PF_MEMALLOC; + return flags; +} + +static inline void memalloc_noreclaim_restore(unsigned int flags) +{ + current->flags = (current->flags & ~PF_MEMALLOC) | flags; +} + #endif /* _LINUX_SCHED_MM_H */