page.h 452 B

1234567891011121314151617181920212223242526
  1. #ifndef _ASM_GENERIC_PAGE_H
  2. #define _ASM_GENERIC_PAGE_H
  3. #ifdef __KERNEL__
  4. #ifndef __ASSEMBLY__
  5. #include <linux/compiler.h>
  6. /* Pure 2^n version of get_order */
  7. static __inline__ __attribute_const__ int get_order(unsigned long size)
  8. {
  9. int order;
  10. size = (size - 1) >> (PAGE_SHIFT - 1);
  11. order = -1;
  12. do {
  13. size >>= 1;
  14. order++;
  15. } while (size);
  16. return order;
  17. }
  18. #endif /* __ASSEMBLY__ */
  19. #endif /* __KERNEL__ */
  20. #endif /* _ASM_GENERIC_PAGE_H */