forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/…
…linux/kernel/git/tip/tip Pull perf fixes and cleanups from Ingo Molnar: "A kernel fix plus mostly tooling fixes, but also some tooling restructuring and cleanups" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (39 commits) perf: Fix building warning on ARM 32 perf symbols: Fix use after free in filename__read_build_id perf evlist: Use roundup_pow_of_two tools: Adopt roundup_pow_of_two perf tools: Make the mmap length autotuning more robust tools: Adopt rounddown_pow_of_two and deps tools: Adopt fls_long and deps tools: Move bitops.h from tools/perf/util to tools/ tools: Introduce asm-generic/bitops.h tools lib: Move asm-generic/bitops/find.h code to tools/include and tools/lib tools: Whitespace prep patches for moving bitops.h tools: Move code originally from asm-generic/atomic.h into tools/include/asm-generic/ tools: Move code originally from linux/log2.h to tools/include/linux/ tools: Move __ffs implementation to tools/include/asm-generic/bitops/__ffs.h perf evlist: Do not use hard coded value for a mmap_pages default perf trace: Let the perf_evlist__mmap autosize the number of pages to use perf evlist: Improve the strerror_mmap method perf evlist: Clarify sterror_mmap variable names perf evlist: Fixup brown paper bag on "hint" for --mmap-pages cmdline arg perf trace: Provide a better explanation when mmap fails ...
- Loading branch information
Showing
41 changed files
with
897 additions
and
714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef __TOOLS_ASM_GENERIC_BITOPS_H | ||
#define __TOOLS_ASM_GENERIC_BITOPS_H | ||
|
||
/* | ||
* tools/ copied this from include/asm-generic/bitops.h, bit by bit as it needed | ||
* some functions. | ||
* | ||
* For the benefit of those who are trying to port Linux to another | ||
* architecture, here are some C-language equivalents. You should | ||
* recode these in the native assembly language, if at all possible. | ||
* | ||
* C language equivalents written by Theodore Ts'o, 9/26/92 | ||
*/ | ||
|
||
#include <asm-generic/bitops/__ffs.h> | ||
#include <asm-generic/bitops/fls.h> | ||
#include <asm-generic/bitops/__fls.h> | ||
#include <asm-generic/bitops/fls64.h> | ||
#include <asm-generic/bitops/find.h> | ||
|
||
#ifndef _TOOLS_LINUX_BITOPS_H_ | ||
#error only <linux/bitops.h> can be included directly | ||
#endif | ||
|
||
#include <asm-generic/bitops/atomic.h> | ||
|
||
#endif /* __TOOLS_ASM_GENERIC_BITOPS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS___FFS_H_ | ||
#define _TOOLS_LINUX_ASM_GENERIC_BITOPS___FFS_H_ | ||
|
||
#include <asm/types.h> | ||
|
||
/** | ||
* __ffs - find first bit in word. | ||
* @word: The word to search | ||
* | ||
* Undefined if no bit exists, so code should check against 0 first. | ||
*/ | ||
static __always_inline unsigned long __ffs(unsigned long word) | ||
{ | ||
int num = 0; | ||
|
||
#if __BITS_PER_LONG == 64 | ||
if ((word & 0xffffffff) == 0) { | ||
num += 32; | ||
word >>= 32; | ||
} | ||
#endif | ||
if ((word & 0xffff) == 0) { | ||
num += 16; | ||
word >>= 16; | ||
} | ||
if ((word & 0xff) == 0) { | ||
num += 8; | ||
word >>= 8; | ||
} | ||
if ((word & 0xf) == 0) { | ||
num += 4; | ||
word >>= 4; | ||
} | ||
if ((word & 0x3) == 0) { | ||
num += 2; | ||
word >>= 2; | ||
} | ||
if ((word & 0x1) == 0) | ||
num += 1; | ||
return num; | ||
} | ||
|
||
#endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS___FFS_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <../../../../include/asm-generic/bitops/__fls.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ | ||
#define _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ | ||
|
||
#include <asm/types.h> | ||
|
||
static inline void set_bit(int nr, unsigned long *addr) | ||
{ | ||
addr[nr / __BITS_PER_LONG] |= 1UL << (nr % __BITS_PER_LONG); | ||
} | ||
|
||
static inline void clear_bit(int nr, unsigned long *addr) | ||
{ | ||
addr[nr / __BITS_PER_LONG] &= ~(1UL << (nr % __BITS_PER_LONG)); | ||
} | ||
|
||
static __always_inline int test_bit(unsigned int nr, const unsigned long *addr) | ||
{ | ||
return ((1UL << (nr % __BITS_PER_LONG)) & | ||
(((unsigned long *)addr)[nr / __BITS_PER_LONG])) != 0; | ||
} | ||
|
||
#endif /* _TOOLS_LINUX_ASM_GENERIC_BITOPS_ATOMIC_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_ | ||
#define _TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_ | ||
|
||
#ifndef find_next_bit | ||
/** | ||
* find_next_bit - find the next set bit in a memory region | ||
* @addr: The address to base the search on | ||
* @offset: The bitnumber to start searching at | ||
* @size: The bitmap size in bits | ||
* | ||
* Returns the bit number for the next set bit | ||
* If no bits are set, returns @size. | ||
*/ | ||
extern unsigned long find_next_bit(const unsigned long *addr, unsigned long | ||
size, unsigned long offset); | ||
#endif | ||
|
||
#ifndef find_first_bit | ||
|
||
/** | ||
* find_first_bit - find the first set bit in a memory region | ||
* @addr: The address to start the search at | ||
* @size: The maximum number of bits to search | ||
* | ||
* Returns the bit number of the first set bit. | ||
* If no bits are set, returns @size. | ||
*/ | ||
extern unsigned long find_first_bit(const unsigned long *addr, | ||
unsigned long size); | ||
|
||
#endif /* find_first_bit */ | ||
|
||
#endif /*_TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <../../../../include/asm-generic/bitops/fls.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include <../../../../include/asm-generic/bitops/fls64.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#ifndef _TOOLS_LINUX_BITOPS_H_ | ||
#define _TOOLS_LINUX_BITOPS_H_ | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/compiler.h> | ||
#include <asm/hweight.h> | ||
|
||
#ifndef __WORDSIZE | ||
#define __WORDSIZE (__SIZEOF_LONG__ * 8) | ||
#endif | ||
|
||
#define BITS_PER_LONG __WORDSIZE | ||
|
||
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) | ||
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) | ||
#define BITS_PER_BYTE 8 | ||
#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) | ||
#define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u64)) | ||
#define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32)) | ||
#define BITS_TO_BYTES(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE) | ||
|
||
/* | ||
* Include this here because some architectures need generic_ffs/fls in | ||
* scope | ||
* | ||
* XXX: this needs to be asm/bitops.h, when we get to per arch optimizations | ||
*/ | ||
#include <asm-generic/bitops.h> | ||
|
||
#define for_each_set_bit(bit, addr, size) \ | ||
for ((bit) = find_first_bit((addr), (size)); \ | ||
(bit) < (size); \ | ||
(bit) = find_next_bit((addr), (size), (bit) + 1)) | ||
|
||
/* same as for_each_set_bit() but use bit as value to start with */ | ||
#define for_each_set_bit_from(bit, addr, size) \ | ||
for ((bit) = find_next_bit((addr), (size), (bit)); \ | ||
(bit) < (size); \ | ||
(bit) = find_next_bit((addr), (size), (bit) + 1)) | ||
|
||
static inline unsigned long hweight_long(unsigned long w) | ||
{ | ||
return sizeof(w) == 4 ? hweight32(w) : hweight64(w); | ||
} | ||
|
||
static inline unsigned fls_long(unsigned long l) | ||
{ | ||
if (sizeof(l) == 4) | ||
return fls(l); | ||
return fls64(l); | ||
} | ||
|
||
#endif |
Oops, something went wrong.