oom.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef __INCLUDE_LINUX_OOM_H
  2. #define __INCLUDE_LINUX_OOM_H
  3. /* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
  4. #define OOM_DISABLE (-17)
  5. /* inclusive */
  6. #define OOM_ADJUST_MIN (-16)
  7. #define OOM_ADJUST_MAX 15
  8. #ifdef __KERNEL__
  9. #include <linux/types.h>
  10. #include <linux/nodemask.h>
  11. struct zonelist;
  12. struct notifier_block;
  13. /*
  14. * Types of limitations to the nodes from which allocations may occur
  15. */
  16. enum oom_constraint {
  17. CONSTRAINT_NONE,
  18. CONSTRAINT_CPUSET,
  19. CONSTRAINT_MEMORY_POLICY,
  20. };
  21. extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags);
  22. extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
  23. extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
  24. int order, nodemask_t *mask);
  25. extern int register_oom_notifier(struct notifier_block *nb);
  26. extern int unregister_oom_notifier(struct notifier_block *nb);
  27. extern bool oom_killer_disabled;
  28. static inline void oom_killer_disable(void)
  29. {
  30. oom_killer_disabled = true;
  31. }
  32. static inline void oom_killer_enable(void)
  33. {
  34. oom_killer_disabled = false;
  35. }
  36. #endif /* __KERNEL__*/
  37. #endif /* _INCLUDE_LINUX_OOM_H */