cregit-Linux how code gets into the kernel

Release 4.7 include/asm-generic/getorder.h

#ifndef __ASM_GENERIC_GETORDER_H

#define __ASM_GENERIC_GETORDER_H

#ifndef __ASSEMBLY__

#include <linux/compiler.h>
#include <linux/log2.h>

/*
 * Runtime evaluation of get_order()
 */

static inline __attribute_const__ int __get_order(unsigned long size) { int order; size--; size >>= PAGE_SHIFT; #if BITS_PER_LONG == 32 order = fls(size); #else order = fls64(size); #endif return order; }

Contributors

PersonTokensPropCommitsCommitProp
david howellsdavid howells2347.92%240.00%
stephen rothwellstephen rothwell1633.33%120.00%
linus torvaldslinus torvalds816.67%120.00%
arnd bergmannarnd bergmann12.08%120.00%
Total48100.00%5100.00%

/** * get_order - Determine the allocation order of a memory size * @size: The size for which to get the order * * Determine the allocation order of a particular sized block of memory. This * is on a logarithmic scale, where: * * 0 -> 2^0 * PAGE_SIZE and below * 1 -> 2^1 * PAGE_SIZE to 2^0 * PAGE_SIZE + 1 * 2 -> 2^2 * PAGE_SIZE to 2^1 * PAGE_SIZE + 1 * 3 -> 2^3 * PAGE_SIZE to 2^2 * PAGE_SIZE + 1 * 4 -> 2^4 * PAGE_SIZE to 2^3 * PAGE_SIZE + 1 * ... * * The order returned is used to find the smallest allocation granule required * to hold an object of the specified size. * * The result is undefined if the size is 0. * * This function may be used to initialise variables with compile time * evaluations of constants. */ #define get_order(n) \ ( \ __builtin_constant_p(n) ? ( \ ((n) == 0UL) ? BITS_PER_LONG - PAGE_SHIFT : \ (((n) < (1UL << PAGE_SHIFT)) ? 0 : \ ilog2((n) - 1) - PAGE_SHIFT + 1) \ ) : \ __get_order(n) \ ) #endif /* __ASSEMBLY__ */ #endif /* __ASM_GENERIC_GETORDER_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
david howellsdavid howells3544.30%233.33%
stephen rothwellstephen rothwell3037.97%116.67%
linus torvaldslinus torvalds911.39%116.67%
arnd bergmannarnd bergmann45.06%116.67%
joerg roedeljoerg roedel11.27%116.67%
Total79100.00%6100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}