1 #ifndef __ASM_GENERIC_GETORDER_H
2 #define __ASM_GENERIC_GETORDER_H
6 #include <linux/compiler.h>
9 * get_order - Determine the allocation order of a memory size
10 * @size: The size for which to get the order
12 * Determine the allocation order of a particular sized block of memory. This
13 * is on a logarithmic scale, where:
15 * 0 -> 2^0 * PAGE_SIZE and below
16 * 1 -> 2^1 * PAGE_SIZE to 2^0 * PAGE_SIZE + 1
17 * 2 -> 2^2 * PAGE_SIZE to 2^1 * PAGE_SIZE + 1
18 * 3 -> 2^3 * PAGE_SIZE to 2^2 * PAGE_SIZE + 1
19 * 4 -> 2^4 * PAGE_SIZE to 2^3 * PAGE_SIZE + 1
22 * The order returned is used to find the smallest allocation granule required
23 * to hold an object of the specified size.
25 * The result is undefined if the size is 0.
27 * This function may be used to initialise variables with compile time
28 * evaluations of constants.
30 static inline __attribute_const__ int get_order(unsigned long size)
34 size = (size - 1) >> (PAGE_SHIFT - 1);
43 #endif /* __ASSEMBLY__ */
45 #endif /* __ASM_GENERIC_GETORDER_H */