2019-07-10 23:12:15 +03:00
|
|
|
#ifndef _LINUX_SCHED_MM_H
|
|
|
|
#define _LINUX_SCHED_MM_H
|
|
|
|
|
2020-11-30 07:55:51 +03:00
|
|
|
#define PF_MEMALLOC 0x00000800 /* Allocating memory */
|
|
|
|
#define PF_MEMALLOC_NOFS 0x00040000 /* All allocation requests will inherit GFP_NOFS */
|
2019-07-10 23:12:15 +03:00
|
|
|
|
|
|
|
static inline unsigned int memalloc_nofs_save(void)
|
|
|
|
{
|
|
|
|
unsigned int flags = current->flags & PF_MEMALLOC_NOFS;
|
|
|
|
current->flags |= PF_MEMALLOC_NOFS;
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void memalloc_nofs_restore(unsigned int flags)
|
|
|
|
{
|
|
|
|
current->flags = (current->flags & ~PF_MEMALLOC_NOFS) | flags;
|
|
|
|
}
|
|
|
|
|
2020-11-30 07:55:51 +03:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-07-10 23:12:15 +03:00
|
|
|
#endif /* _LINUX_SCHED_MM_H */
|