compaction.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 sysctl_extfrag_threshold;
  17. extern int sysctl_extfrag_handler(struct ctl_table *table, int write,
  18. void __user *buffer, size_t *length, loff_t *ppos);
  19. extern int fragmentation_index(struct zone *zone, unsigned int order);
  20. extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
  21. int order, gfp_t gfp_mask, nodemask_t *mask);
  22. #else
  23. static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
  24. int order, gfp_t gfp_mask, nodemask_t *nodemask)
  25. {
  26. return COMPACT_CONTINUE;
  27. }
  28. #endif /* CONFIG_COMPACTION */
  29. #if defined(CONFIG_COMPACTION) && defined(CONFIG_SYSFS) && defined(CONFIG_NUMA)
  30. extern int compaction_register_node(struct node *node);
  31. extern void compaction_unregister_node(struct node *node);
  32. #else
  33. static inline int compaction_register_node(struct node *node)
  34. {
  35. return 0;
  36. }
  37. static inline void compaction_unregister_node(struct node *node)
  38. {
  39. }
  40. #endif /* CONFIG_COMPACTION && CONFIG_SYSFS && CONFIG_NUMA */
  41. #endif /* _LINUX_COMPACTION_H */