compaction.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef _LINUX_COMPACTION_H
  2. #define _LINUX_COMPACTION_H
  3. /* Return values for compact_zone() and try_to_compact_pages() */
  4. /* compaction didn't start as it was not possible or direct reclaim was more suitable */
  5. #define COMPACT_SKIPPED 0
  6. /* compaction should continue to another pageblock */
  7. #define COMPACT_CONTINUE 1
  8. /* direct compaction partially compacted a zone and there are suitable pages */
  9. #define COMPACT_PARTIAL 2
  10. /* The full zone was compacted */
  11. #define COMPACT_COMPLETE 3
  12. #ifdef CONFIG_COMPACTION
  13. extern int sysctl_compact_memory;
  14. extern int sysctl_compaction_handler(struct ctl_table *table, int write,
  15. void __user *buffer, size_t *length, loff_t *ppos);
  16. extern int fragmentation_index(struct zone *zone, unsigned int order);
  17. extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
  18. int order, gfp_t gfp_mask, nodemask_t *mask);
  19. #else
  20. static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
  21. int order, gfp_t gfp_mask, nodemask_t *nodemask)
  22. {
  23. return COMPACT_CONTINUE;
  24. }
  25. #endif /* CONFIG_COMPACTION */
  26. #if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
  27. extern int compaction_register_node(struct node *node);
  28. extern void compaction_unregister_node(struct node *node);
  29. #else
  30. static inline int compaction_register_node(struct node *node)
  31. {
  32. return 0;
  33. }
  34. static inline void compaction_unregister_node(struct node *node)
  35. {
  36. }
  37. #endif /* CONFIG_COMPACTION && CONFIG_SYSFS && CONFIG_NUMA */
  38. #endif /* _LINUX_COMPACTION_H */