gfp.h 848 B

12345678910111213141516171819202122232425262728293031323334
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _GFP_H
  3. #define _GFP_H
  4. #include <linux/types.h>
  5. #define __GFP_BITS_SHIFT 26
  6. #define __GFP_BITS_MASK ((gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
  7. #define __GFP_HIGH 0x20u
  8. #define __GFP_IO 0x40u
  9. #define __GFP_FS 0x80u
  10. #define __GFP_NOWARN 0x200u
  11. #define __GFP_ZERO 0x8000u
  12. #define __GFP_ATOMIC 0x80000u
  13. #define __GFP_ACCOUNT 0x100000u
  14. #define __GFP_DIRECT_RECLAIM 0x400000u
  15. #define __GFP_KSWAPD_RECLAIM 0x2000000u
  16. #define __GFP_RECLAIM (__GFP_DIRECT_RECLAIM|__GFP_KSWAPD_RECLAIM)
  17. #define GFP_ZONEMASK 0x0fu
  18. #define GFP_ATOMIC (__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM)
  19. #define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS)
  20. #define GFP_NOWAIT (__GFP_KSWAPD_RECLAIM)
  21. static inline bool gfpflags_allow_blocking(const gfp_t gfp_flags)
  22. {
  23. return !!(gfp_flags & __GFP_DIRECT_RECLAIM);
  24. }
  25. #endif