This source file includes following definitions.
- get_order
1
2 #ifndef __ASM_GENERIC_GETORDER_H
3 #define __ASM_GENERIC_GETORDER_H
4
5 #ifndef __ASSEMBLY__
6
7 #include <linux/compiler.h>
8 #include <linux/log2.h>
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 static inline __attribute_const__ int get_order(unsigned long size)
30 {
31 if (__builtin_constant_p(size)) {
32 if (!size)
33 return BITS_PER_LONG - PAGE_SHIFT;
34
35 if (size < (1UL << PAGE_SHIFT))
36 return 0;
37
38 return ilog2((size) - 1) - PAGE_SHIFT + 1;
39 }
40
41 size--;
42 size >>= PAGE_SHIFT;
43 #if BITS_PER_LONG == 32
44 return fls(size);
45 #else
46 return fls64(size);
47 #endif
48 }
49
50 #endif
51
52 #endif