]> git.sesse.net Git - bcachefs-tools-debian/blob - c_src/include/linux/sched/mm.h
03feda7ab1defe0d03c9dce745df7a52f311d3c7
[bcachefs-tools-debian] / c_src / include / linux / sched / mm.h
1 #ifndef _LINUX_SCHED_MM_H
2 #define _LINUX_SCHED_MM_H
3
4 #define PF_MEMALLOC             0x00000800      /* Allocating memory */
5 #define PF_MEMALLOC_NOFS        0x00040000      /* All allocation requests will inherit GFP_NOFS */
6
7 static inline unsigned int memalloc_nofs_save(void)
8 {
9         unsigned int flags = current->flags & PF_MEMALLOC_NOFS;
10         current->flags |= PF_MEMALLOC_NOFS;
11         return flags;
12 }
13
14 static inline void memalloc_nofs_restore(unsigned int flags)
15 {
16         current->flags = (current->flags & ~PF_MEMALLOC_NOFS) | flags;
17 }
18
19 static inline unsigned int memalloc_noreclaim_save(void)
20 {
21         unsigned int flags = current->flags & PF_MEMALLOC;
22         current->flags |= PF_MEMALLOC;
23         return flags;
24 }
25
26 static inline void memalloc_noreclaim_restore(unsigned int flags)
27 {
28         current->flags = (current->flags & ~PF_MEMALLOC) | flags;
29 }
30
31 #endif /* _LINUX_SCHED_MM_H */