bounds.c 943 B

1234567891011121314151617181920212223242526272829303132333435
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Generate definitions needed by the preprocessor.
  4. * This code generates raw asm output which is post-processed
  5. * to extract and format the required data.
  6. */
  7. #define __GENERATING_BOUNDS_H
  8. /* Include headers that define the enum constants of interest */
  9. #include <linux/page-flags.h>
  10. #include <linux/mmzone.h>
  11. #include <linux/kbuild.h>
  12. #include <linux/log2.h>
  13. #include <linux/spinlock_types.h>
  14. int main(void)
  15. {
  16. /* The enum constants to put into include/generated/bounds.h */
  17. DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);
  18. DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);
  19. #ifdef CONFIG_SMP
  20. DEFINE(NR_CPUS_BITS, ilog2(CONFIG_NR_CPUS));
  21. #endif
  22. DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));
  23. #ifdef CONFIG_LRU_GEN
  24. DEFINE(LRU_GEN_WIDTH, order_base_2(MAX_NR_GENS + 1));
  25. DEFINE(__LRU_REFS_WIDTH, MAX_NR_TIERS - 2);
  26. #else
  27. DEFINE(LRU_GEN_WIDTH, 0);
  28. DEFINE(__LRU_REFS_WIDTH, 0);
  29. #endif
  30. /* End of constants */
  31. return 0;
  32. }