[PATCH 08/16] perf symbol: only set vmlinux longname & mark loaded if really loaded

2012-08-09 Thread Cody P Schafer
g 0 symbols does not cause it to consider itself loaded, and do not set long_name in such a case. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 90d2760..9e31

[PATCH 14/16] perf symbol: factor want_symtab out of dso__load_sym()

2012-08-09 Thread Cody P Schafer
erf symbol: use both runtime and debug images" Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 26 +++--- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index f8fbde2..83d2276 100644 --- a/

[PATCH 06/16] perf symbol: remove unneeded call to dso__set_long_name()

2012-08-09 Thread Cody P Schafer
dso__set_long_name() is already called by dso__load_vmlinux(), avoid calling it a second time unnecessarily. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c

[PATCH 03/16] perf symbol: only un-prelink non-zero symbols

2012-08-09 Thread Cody P Schafer
Prelink only adjusts the addresses of non-zero symbols. Do the same when we reverse the adjustments. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index b2f7597

[PATCH 09/16] perf symbol: avoid segfault in elf_strptr

2012-08-09 Thread Cody P Schafer
fixed in libelf/elfutils. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 4 1 file changed, 4 insertions(+) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 9e31cbb..6afc92d 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -973,6

[PATCH 16/16] perf symbol: use both runtime and debug images

2012-08-09 Thread Cody P Schafer
a .opd section exsists, it is contained in the highest priority image with a dynsym section. - This generally implies that the debug image lacks a dynsym section (ie: it is marked as NO_BITS). Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 82 +++---

[PATCH 12/16] perf symbol: set symtab_type in dso__load_sym

2012-08-09 Thread Cody P Schafer
ype as well). Setup for later patch "perf symbol: use both runtime and debug images" Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index

[PATCH 13/16] perf symbol: switch dso__synthesize_plt_symbols() to use symsrc

2012-08-09 Thread Cody P Schafer
Previously dso__synthesize_plt_symbols() was reopening the elf file to obtain dynsyms from it. Rather than reopen the file, use the already opened reference within the symsrc to access it. Setup for the later patch "perf symbol: use both runtime and debug images" Signed-off-by: Cody

[PATCH 02/16] perf symbol: remove unused 'end' arg in kallsyms parse cb

2012-08-09 Thread Cody P Schafer
ymbol creation (kallsyms__parse() is not in general used to create symbols). Signed-off-by: Cody P Schafer --- tools/perf/util/event.c | 2 +- tools/perf/util/symbol.c | 21 ++--- tools/perf/util/symbol.h | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/

Re: [PATCH 02/16] perf symbol: remove unused 'end' arg in kallsyms parse cb

2012-08-10 Thread Cody P Schafer
I guess that length of 1 effectively same as zero length in this case since we end up calling symbols__fixup_end. The 'end - start + 1' part looks like a leftover from previous change and not needed anymore - KSYM_NAME_LEN check too, IMHO - so I suggest using 0 length to make it clear. Got it.

[PATCH v2 00/16] perf: various symbol resolution fixes, including .opd section use.

2012-08-10 Thread Cody P Schafer
1-4,6,7 are small cleanups. 5 fixes a potential segfault. 8 fixes a use after free for dso->long_name 9 avoids a segfault in elfutils when a truncated elf is loaded. 10 properly tracks that a dso had symbols loaded from a vmlinux image 11-16 fix handling of the '.opd' section in the presence o

[PATCH 01/16] perf symbol: correct comment wrt kallsyms loading

2012-08-10 Thread Cody P Schafer
y, start & end define an inclusive range. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index f02de8a..891f83c 100644 --- a/tools/perf/util/symbol.c +++ b/tools/

[PATCH 12/16] perf symbol: set symtab_type in dso__load_sym

2012-08-10 Thread Cody P Schafer
ype as well). Setup for later patch "perf symbol: use both runtime and debug images" Signed-off-by: Cody P Schafer --- tools/perf/util/symbol-elf.c | 2 ++ tools/perf/util/symbol.c | 13 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/symb

[PATCH 13/16] perf symbol: switch dso__synthesize_plt_symbols() to use symsrc

2012-08-10 Thread Cody P Schafer
Previously dso__synthesize_plt_symbols() was reopening the elf file to obtain dynsyms from it. Rather than reopen the file, use the already opened reference within the symsrc to access it. Setup for the later patch "perf symbol: use both runtime and debug images" Signed-off-by: Cody

[PATCH 15/16] perf symbol: convert dso__load_syms to take 2 symsrc's

2012-08-10 Thread Cody P Schafer
exists in the runtime image) is the same in both the runtime and debug/symbols image. Both of these are true on RHEL, but it is unclear how accurate they are in general (on platforms with function descriptors in opd sections). Signed-off-by: Cody P Schafer --- tools/perf/util/symbol-

[PATCH 09/16] perf symbol: avoid segfault in elf_strptr

2012-08-10 Thread Cody P Schafer
fixed in libelf/elfutils. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol-elf.c | 4 1 file changed, 4 insertions(+) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index a2e994e..a9a194d 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol

[PATCH 10/16] perf symbol: track symtab_type of vmlinux

2012-08-10 Thread Cody P Schafer
Previously, symtab_type would have been left at 0, or KALLSYMS, which is not quite accurate. Introduce DSO_SYMTAB_TYPE__VMLINUX[_GUEST]. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 9 + tools/perf/util/symbol.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a

[PATCH 11/16] perf symbol: introduce symsrc structure.

2012-08-10 Thread Cody P Schafer
duplicate code for looking up the same sections and checking for the existence of an important section wouldn't be as clean (and we need to keep the Elf stuff confined to symtab-elf.c). Utilized by the later patch "perf symbol: use both runtime and debug images" Signed-off-by: Cod

[PATCH 06/16] perf symbol: remove unneeded call to dso__set_long_name()

2012-08-10 Thread Cody P Schafer
dso__set_long_name() is already called by dso__load_vmlinux(), avoid calling it a second time unnecessarily. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c

[PATCH 16/16] perf symbol: use both runtime and debug images

2012-08-10 Thread Cody P Schafer
f a .opd section exists, it is contained in the highest priority image with a dynsym section. - This generally implies that the debug image lacks a dynsym section (ie: it is marked as NO_BITS). Signed-off-by: Cody P Schafer --- tools/perf/util/symbol-elf.c | 5 +++ tools/perf/util/symbol-m

[PATCH 08/16] perf symbol: only set vmlinux longname & mark loaded if really loaded

2012-08-10 Thread Cody P Schafer
g 0 symbols does not cause it to consider itself loaded, and do not set long_name in such a case. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index e5c3817..96db

[PATCH 05/16] perf symbol: don't try to synthesize plt without dynstr.

2012-08-10 Thread Cody P Schafer
If .dynsym exists but .dynstr is empty (NO_BITS or size==0), a segfault occurs. Avoid this by checking that .dynstr is not empty. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol-elf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util

[PATCH 03/16] perf symbol: only un-prelink non-zero symbols

2012-08-10 Thread Cody P Schafer
Prelink only adjusts the addresses of non-zero symbols. Do the same when we reverse the adjustments. Signed-off-by: Cody P Schafer --- tools/perf/util/symbol-elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c

[PATCH 02/16] perf symbol: remove unused 'end' arg in kallsyms parse cb

2012-08-10 Thread Cody P Schafer
ymbol creation (kallsyms__parse() is not in general used to create symbols). Signed-off-by: Cody P Schafer --- tools/perf/util/event.c | 2 +- tools/perf/util/symbol.c | 21 ++--- tools/perf/util/symbol.h | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/

[PATCH 14/16] perf symbol: factor want_symtab out of dso__load_sym()

2012-08-10 Thread Cody P Schafer
erf symbol: use both runtime and debug images" Signed-off-by: Cody P Schafer --- tools/perf/util/symbol-elf.c | 21 ++--- tools/perf/util/symbol-minimal.c | 8 ++-- tools/perf/util/symbol.c | 10 +++--- tools/perf/util/symbol.h | 3 ++- 4 fi

[PATCH 07/16] perf symbol: simplify out_fixup in kernel syms loading

2012-08-10 Thread Cody P Schafer
The only site that jumps to out_fixup has (kallsyms_filename == NULL). And all paths that reach 'if (err > 0)' without 'goto out_fixup' have kallsyms_filename != NULL. So skip over both the check & dso__set_long_name(), and remove the check. Signed-off-by: Cody P Sc

[PATCH 04/16] perf utils: remove unused function map__objdump_2ip

2012-08-10 Thread Cody P Schafer
map__objdump_2ip was introduced in: ee11b90b12 perf top: Fix annotate for userspace And it's last user removed in: 36532461a0 perf top: Ditch private annotation code, share perf annotate's Remove it. Signed-off-by: Cody P Schafer --- tools/perf/util/map.c | 8 tools/perf/

Re: [PATCH 0/2] Add decoder for GFP masks to tools.

2013-01-10 Thread Cody P Schafer
(Sorry Mel, you're getting this twice because I forgot CC's last time) On 01/10/2013 03:36 AM, Mel Gorman wrote: Any particular reason you did not use scripts/gfp-translate? Because I didn't look hard enough & didn't see it :( Script is dumb as rocks, requires access to the source code and do

[PATCH 00/17] mm: zone & pgdat accessors plus some cleanup

2013-01-15 Thread Cody P Schafer
Summaries: 01 - removes the use of zone_end_pfn as a local var name. 02 - adds zone_end_pfn(), zone_is_initialized(), zone_is_empty() and zone_spans_pfn() 03 - adds a VM_BUG using zone_is_initialized() in __free_one_page() 04 - add ensure_zone_is_initialized() (for memory_hotplug) 05 - use the a

[PATCH 01/17] mm/compaction: rename var zone_end_pfn to avoid conflicts with new function

2013-01-15 Thread Cody P Schafer
Patches that follow add a inline function zone_end_pfn(), which conflicts with the naming of a local variable in isolate_freepages(). Rename the variable so it does not conflict. Signed-off-by: Cody P Schafer --- mm/compaction.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff

[PATCH 05/17] mm/memory_hotplug: use ensure_zone_is_initialized()

2013-01-15 Thread Cody P Schafer
Remove open coding of ensure_zone_is_initialzied(). Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 29 ++--- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 875bdfe..8e352fe 100644 --- a/mm

[PATCH 13/17] mm: add SECTION_IN_PAGE_FLAGS

2013-01-15 Thread Cody P Schafer
Instead of directly utilizing a combination of config options to determine this, add a macro to specifically address it. Signed-off-by: Cody P Schafer --- include/linux/mm.h | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index

[PATCH 17/17] mm/compaction: use zone_end_pfn()

2013-01-15 Thread Cody P Schafer
Switch to using zone_end_pfn from open coding. Signed-off-by: Cody P Schafer --- mm/compaction.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 1b52528..ea66be3 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -85,7 +85,7

[PATCH 11/17] mm/kmemleak: use node_{start,end}_pfn()

2013-01-15 Thread Cody P Schafer
From: Cody P Schafer Instead of open coding, use the exsisting node_start_pfn() and node_end_pfn() helpers. Signed-off-by: Cody P Schafer --- mm/kmemleak.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mm/kmemleak.c b/mm/kmemleak.c index 752a705..83dd5fb 100644

[PATCH 15/17] mm/page_alloc: add informative debugging message in page_outside_zone_boundaries()

2013-01-15 Thread Cody P Schafer
Add a debug message which prints when a page is found outside of the boundaries of the zone it should belong to. Format is: "page $pfn outside zone [ $start_pfn - $end_pfn ]" Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 7 +++ 1 file changed, 7 insertions(+) diff

[PATCH 09/17] mm/page_alloc: use zone_end_pfn() & zone_spans_pfn()

2013-01-15 Thread Cody P Schafer
From: Cody P Schafer Change several open coded zone_end_pfn()s and a zone_spans_pfn() in the page allocator to use the provided helper functions. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/page_alloc.c b

[PATCH 12/17] mm/memory_hotplug: use pgdat_end_pfn() instead of open coding the same.

2013-01-15 Thread Cody P Schafer
From: Cody P Schafer Replace open coded pgdat_end_pfn() with helper function. Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 8e352fe..0a74b86a 100644 --- a/mm

[PATCH 10/17] mm/vmstat: use zone_end_pfn() instead of opencoding

2013-01-15 Thread Cody P Schafer
In vmstat, use zone_end_pfn() instead of an opencoded version. Signed-off-by: Cody P Schafer --- mm/vmstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index 9800306..ca99641 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -890,7 +890,7 @@ static

[PATCH 16/17] mm/memory_hotplug: use zone_end_pfn() instead of open coding

2013-01-15 Thread Cody P Schafer
Switch to using zone_end_pfn() in move_pfn_range_left() and move_pfn_range_right() instead of open coding the same. Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c

[PATCH 14/17] mm/memory_hotplug: factor out zone+pgdat growth.

2013-01-15 Thread Cody P Schafer
Create a new function grow_pgdat_and_zone() which handles locking + growth of a zone & the pgdat which it is associated with. Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/mm/memory_hotplug.c

[PATCH 08/17] mm/page_alloc: use zone_spans_pfn() instead of open coded checks.

2013-01-15 Thread Cody P Schafer
From: Cody P Schafer In 2 VM_BUG()s, avoid open coding zone ownership of pfns. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3911c1a..c5d70ce 100644 --- a/mm/page_alloc.c

[PATCH 07/17] mm/page_alloc: use zone_spans_pfn() instead of open coding.

2013-01-15 Thread Cody P Schafer
igure it out. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index da5a5ec..3911c1a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -978,9 +978,9 @@ int move_freepages_block(struct zo

[PATCH 03/17] mm/page_alloc: add a VM_BUG in __free_one_page() if the zone is uninitialized.

2013-01-15 Thread Cody P Schafer
From: Cody P Schafer Freeing pages to uninitialized zones is not handled by __free_one_page(), and should never happen when the code is correct. Ran into this while writing some code that dynamically onlines extra zones. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 2 ++ 1 file

[PATCH 04/17] mm: add helper ensure_zone_is_initialized()

2013-01-15 Thread Cody P Schafer
From: Cody P Schafer ensure_zone_is_initialized() checks if a zone is in a empty & not initialized state (typically occuring after it is created in memory hotplugging), and, if so, calls init_currently_empty_zone() to initialize the zone. Signed-off-by: Cody P Schafer --- mm/memory_hotpl

[PATCH 02/17] mmzone: add various zone_*() helper functions.

2013-01-15 Thread Cody P Schafer
From: Cody P Schafer Add zone_is_initialized(), zone_is_empty(), zone_spans_pfn(), and zone_end_pfn(). Signed-off-by: Cody P Schafer --- include/linux/mmzone.h | 20 1 file changed, 20 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index

[PATCH 06/17] mmzone: add pgdat_{end_pfn,is_empty}() helpers & consolidate.

2013-01-15 Thread Cody P Schafer
From: Cody P Schafer Add pgdat_end_pfn() and pgdat_is_empty() helpers which match the similar zone_*() functions. Change node_end_pfn() to be a wrapper of pgdat_end_pfn(). Signed-off-by: Cody P Schafer --- include/linux/mmzone.h | 14 ++ 1 file changed, 10 insertions(+), 4

[PATCH 1/9] mm: add SECTION_IN_PAGE_FLAGS

2013-01-17 Thread Cody P Schafer
Instead of directly utilizing a combination of config options to determine this, add a macro to specifically address it. Signed-off-by: Cody P Schafer --- include/linux/mm.h | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index

[PATCH 6/9] mm/page_alloc: add informative debugging message in page_outside_zone_boundaries()

2013-01-17 Thread Cody P Schafer
Add a debug message which prints when a page is found outside of the boundaries of the zone it should belong to. Format is: "page $pfn outside zone [ $start_pfn - $end_pfn ]" Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 7 +++ 1 file changed, 7 insertions(+) diff

[PATCH 9/9] mm/memory_hotplug: use pgdat_end_pfn() instead of open coding the same.

2013-01-17 Thread Cody P Schafer
Replace open coded pgdat_end_pfn() with helper function. Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 016944f..6eb93a5 100644 --- a/mm/memory_hotplug.c +++ b/mm

[PATCH 5/9] mmzone: add pgdat_{end_pfn,is_empty}() helpers & consolidate.

2013-01-17 Thread Cody P Schafer
From: Cody P Schafer Add pgdat_end_pfn() and pgdat_is_empty() helpers which match the similar zone_*() functions. Change node_end_pfn() to be a wrapper of pgdat_end_pfn(). Signed-off-by: Cody P Schafer --- include/linux/mmzone.h | 14 ++ 1 file changed, 10 insertions(+), 4

[PATCH 8/9] mm/memory_hotplug: use ensure_zone_is_initialized()

2013-01-17 Thread Cody P Schafer
Remove open coding of ensure_zone_is_initialzied(). Signed-off-by: Cody P Schafer --- mm/memory_hotplug.c | 29 ++--- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index bede456..016944f 100644 --- a/mm

[PATCH 7/9] mm: add helper ensure_zone_is_initialized()

2013-01-17 Thread Cody P Schafer
From: Cody P Schafer ensure_zone_is_initialized() checks if a zone is in a empty & not initialized state (typically occuring after it is created in memory hotplugging), and, if so, calls init_currently_empty_zone() to initialize the zone. Signed-off-by: Cody P Schafer --- mm/memory_hotpl

[PATCH v2 0/9] mm: zone & pgdat accessors plus some cleanup

2013-01-17 Thread Cody P Schafer
Summaries: 1 - avoid repeating checks for section in page flags by adding a define. 2 - add & switch to zone_end_pfn() and zone_spans_pfn() 3 - adds zone_is_initialized() & zone_is_empty() 4 - adds a VM_BUG using zone_is_initialized() in __free_one_page() 5 - add pgdat_end_pfn() and pgdat_is_empty(

[PATCH 4/9] mm/page_alloc: add a VM_BUG in __free_one_page() if the zone is uninitialized.

2013-01-17 Thread Cody P Schafer
From: Cody P Schafer Freeing pages to uninitialized zones is not handled by __free_one_page(), and should never happen when the code is correct. Ran into this while writing some code that dynamically onlines extra zones. Signed-off-by: Cody P Schafer --- mm/page_alloc.c | 2 ++ 1 file

[PATCH 2/9] mm: add & use zone_end_pfn() and zone_spans_pfn()

2013-01-17 Thread Cody P Schafer
Add 2 helpers (zone_end_pfn() and zone_spans_pfn()) to reduce code duplication. This also switches to using them in compaction (where an additional variable needed to be renamed), page_alloc, vmstat, memory_hotplug, and kmemleak. Signed-off-by: Cody P Schafer --- Note that in compaction.c I

[PATCH 3/9] mm: add zone_is_empty() and zone_is_initialized()

2013-01-17 Thread Cody P Schafer
Factoring out these 2 checks makes it more clear what we are actually checking for. Signed-off-by: Cody P Schafer --- include/linux/mmzone.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index d91d964..696cb7c 100644 --- a

[PATCH 0/2] Add decoder for GFP masks to tools.

2013-01-08 Thread Cody P Schafer
I needed to decode some gfp_masks to debug an oom-killer invocation, and wrote this tool to avoid doing the decoding manually. Bad things about this: slightly hacky use of code intended for use with ftrace, splitting linux/gfp.h into 2 parts. Good things: No additional places need modification to

[PATCH 2/2] tools: add gfp mask decoder

2013-01-08 Thread Cody P Schafer
From: Cody P Schafer Allows decoding of gfp_masks printed, for example, when the oom-killer is invoked. Example usage: [6.464753] kthreadd invoked oom-killer: gfp_mask=0x1000d0, order=1, oom_score_adj=0 $ ./gfp-decode 0x1000d0 GFP_KERNEL|GFP_KMEMCG Internally, it

[PATCH 1/2] gfp: split out defines for gfp flags into seperate header

2013-01-08 Thread Cody P Schafer
Split the current linux/gfp.h into gfp.h and gfp-flags.h All the defines for flags are placed into gfp-flags.h which is included from gfp.h This split allows the use of the defines by userspace tools, such as a gfp decoder. Signed-off-by: Cody P Schafer --- include/linux/gfp-flags.h | 143

[PATCH v2] powerpc/mm: eliminate unneeded for_each_memblock

2013-01-09 Thread Cody P Schafer
The only persistent change made by this loop is calling memblock_set_node() once for each memblock, which is not useful (and has no effect) as memblock_set_node() is not called with any memblock-specific parameters. Subsistute a single memblock_set_node(). Signed-off-by: Cody P Schafer --- Now

[PATCH] MAINTAINERS: mm: add additional include files to listing

2013-01-09 Thread Cody P Schafer
Add gfp.h, mmzone.h, memory_hotplug.h & vmalloc.h to the "MEMORY MANAGMENT" section so scripts/get_maintainer.pl can do a better job of making recommendations. Signed-off-by: Cody P Schafer --- MAINTAINERS | 4 1 file changed, 4 insertions(+) diff --git a/MAINTAINERS b/MAI

[PATCH] rbtree: clarify documentation of rbtree_postorder_for_each_entry_safe()

2015-10-04 Thread Cody P Schafer
ds of rb_node & cgwb_congested_tree as required by other users of those structures. CC: Tejun Heo Signed-off-by: Cody P Schafer --- include/linux/rbtree.h | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h inde

Re: [PATCH v5 1/4] tools/perf: support parsing parameterized events

2014-12-05 Thread Cody P Schafer
On Thu, Dec 4, 2014 at 7:44 AM, Jiri Olsa wrote: > On Tue, Dec 02, 2014 at 06:09:35PM -0800, Sukadev Bhattiprolu wrote: >> From: Cody P Schafer >> >> Enable event specification like: >> >> pmu/event_name,param1=0x1,param2=0x4/ >> >> Assuming t

Re: [PATCH] perf: prevent overflow in size calculation

2012-07-19 Thread Cody P Schafer
+ /* Check for overflow when calculating sizeof_sym_hist */ + if (size > (SIZE_MAX / sizeof(u64))) + return -1; How does it guarantee that the end result which used in zalloc below would not overflow? + + sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeo

Re: [PATCH v2] perf: prevent overflow in size calculation

2012-07-19 Thread Cody P Schafer
struct annotation *notes = symbol__annotation(sym); const size_t size = symbol__size(sym); - size_t sizeof_sym_hist = (sizeof(struct sym_hist) + size * sizeof(u64)); + size_t sizeof_sym_hist; + + /* Check for overflow when calculating sizeof_sym_hist */ +

[PATCH] powerpc: warn users of smt-snooze-delay that the API isn't there anymore

2014-02-21 Thread Cody P Schafer
move into the cpuidle driver, essentially by adjusting target_residency to the specified value. At the moment, target_residency is not exposed by cpuidle's sysfs, so there isn't a drop in replacement for this. Signed-off-by: Cody P Schafer --- arch/powerpc/kernel/sysfs.c | 6 ++ 1 fi

Re: [PATCH v2 01/11] perf: add PMU_RANGE_ATTR() helper for use by sw-like pmus

2014-02-25 Thread Cody P Schafer
On 02/24/2014 07:33 PM, Michael Ellerman wrote: On Fri, 2014-14-02 at 22:02:05 UTC, Cody P Schafer wrote: Add PMU_RANGE_ATTR() and PMU_RANGE_RESV() (for reserved areas) which generate functions to extract the relevent bits from event->attr.config{,1,2} for use by sw-like pmus where the 

Re: [PATCH v2 05/11] powerpc: add hv_gpci interface header

2014-02-25 Thread Cody P Schafer
On 02/24/2014 07:33 PM, Michael Ellerman wrote: On Fri, 2014-14-02 at 22:02:09 UTC, Cody P Schafer wrote: "H_GetPerformanceCounterInfo" (refered to as hv_gpci or just gpci from here on) is an interface to retrieve specific performance counters and other data from the hypervisor. A

Re: [PATCH v2 09/11] powerpc/perf: add support for the hv 24x7 interface

2014-02-25 Thread Cody P Schafer
On 02/24/2014 07:33 PM, Michael Ellerman wrote: On Fri, 2014-14-02 at 22:02:13 UTC, Cody P Schafer wrote: This provides a basic interface between hv_24x7 and perf. Similar to the one provided for gpci, it lacks transaction support and does not list any events. Signed-off-by: Cody P Schafer

Re: [PATCH v2 04/11] powerpc: add hvcalls for 24x7 and gpci (get performance counter info)

2014-02-25 Thread Cody P Schafer
On 02/24/2014 07:33 PM, Michael Ellerman wrote: On Fri, 2014-14-02 at 22:02:08 UTC, Cody P Schafer wrote: Signed-off-by: Cody P Schafer --- arch/powerpc/include/asm/hvcall.h | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include

Re: [PATCH v2 07/11] powerpc: add a shared interface to get gpci version and capabilities

2014-02-25 Thread Cody P Schafer
On 02/24/2014 07:33 PM, Michael Ellerman wrote: [PATCH v2 07/11] powerpc: add a shared interface to get gpci version and capabilities All the patches that touch perf should be "powerpc/perf: foo" Ok. On Fri, 2014-14-02 at 22:02:11 UTC, Cody P Schafer wrote: ... I realise

Re: [PATCH v2 08/11] powerpc/perf: add support for the hv gpci (get performance counter info) interface

2014-02-25 Thread Cody P Schafer
On 02/24/2014 07:33 PM, Michael Ellerman wrote: On Fri, 2014-14-02 at 22:02:12 UTC, Cody P Schafer wrote: This provides a basic link between perf and hv_gpci. Notably, it does not yet support transactions and does not list any events (they can still be manually composed). Can you explain how

Re: [PATCH v2 10/11] powerpc/perf: add kconfig option for hypervisor provided counters

2014-02-25 Thread Cody P Schafer
On 02/24/2014 07:33 PM, Michael Ellerman wrote: On Fri, 2014-14-02 at 22:02:14 UTC, Cody P Schafer wrote: Signed-off-by: Cody P Schafer --- arch/powerpc/perf/Makefile | 2 ++ arch/powerpc/platforms/Kconfig.cputype | 6 ++ 2 files changed, 8 insertions(+) diff --git a/arch

Re: [PATCH v2 02/11] perf core: export swevent hrtimer helpers

2014-02-25 Thread Cody P Schafer
On 02/25/2014 02:20 AM, Peter Zijlstra wrote: On Tue, Feb 25, 2014 at 02:33:26PM +1100, Michael Ellerman wrote: On Fri, 2014-14-02 at 22:02:06 UTC, Cody P Schafer wrote: Export the swevent hrtimer helpers currently only used in events/core.c to allow the addition of architecture specific sw

Re: [PATCH v2 01/11] perf: add PMU_RANGE_ATTR() helper for use by sw-like pmus

2014-02-25 Thread Cody P Schafer
On 02/25/2014 12:33 PM, Cody P Schafer wrote: On 02/24/2014 07:33 PM, Michael Ellerman wrote: On Fri, 2014-14-02 at 22:02:05 UTC, Cody P Schafer wrote: Add PMU_RANGE_ATTR() and PMU_RANGE_RESV() (for reserved areas) which generate functions to extract the relevent bits from event->attr.con

Re: [PATCH] powerpc: warn users of smt-snooze-delay that the API isn't there anymore

2014-02-25 Thread Cody P Schafer
On 02/24/2014 08:53 PM, Madhavan Srinivasan wrote: On Saturday 22 February 2014 05:44 AM, Cody P Schafer wrote: /sys/devices/system/cpu/cpu*/smt-snooze-delay was converted into a NOP in commit 3fa8cad82b94d0bed002571bd246f2299ffc876b, and now does nothing. Add a pr_warn() to convince any users

[PATCH 5/8] fs/jffs2: use rbtree postorder iteration helper instead of opencoding

2013-11-01 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- fs/jffs2/nodelist.c | 28 ++-- fs/jffs2/readinode.c | 26 +++--- 2 files

[PATCH 7/8] mtd/ubi: use rbtree postorder iteration helper instead of opencoding

2013-11-01 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- drivers/mtd/ubi/attach.c | 49 +++- drivers/mtd/ubi/wl.c | 25

[PATCH 6/8] fs/ext3: use rbtree postorder iteration helper instead of opencoding

2013-11-01 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- fs/ext3/dir.c | 36 +--- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git

[PATCH 8/8] sh/dwarf: use rbtree postorder iteration helper instead of solution using repeated rb_erase()

2013-11-01 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of using repeated rb_erase() calls Signed-off-by: Cody P Schafer --- arch/sh/kernel/dwarf.c | 18 -- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel

[PATCH 1/8] net ipset: use rbtree postorder iteration instead of opencoding

2013-11-01 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- net/netfilter/ipset/ip_set_hash_netiface.c | 27 --- 1 file changed, 4 insertions(+), 23

[PATCH 3/8] fs/ubifs: use rbtree postorder iteration helper instead of opencoding

2013-11-01 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- fs/ubifs/debug.c| 22 +++--- fs/ubifs/log.c | 21 ++--- fs/ubifs/orphan.c

[PATCH 4/8] fs/ext4: use rbtree postorder iteration helper instead of opencoding

2013-11-01 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- fs/ext4/block_validity.c | 33 - fs/ext4/dir.c| 35

[PATCH 2/8] trace/trace_stat: use rbtree postorder iteration helper instead of opencoding

2013-11-01 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- kernel/trace/trace_stat.c | 42 ++ 1 file changed, 6 insertions(+), 36

Re: [PATCH 2/8] trace/trace_stat: use rbtree postorder iteration helper instead of opencoding

2013-11-04 Thread Cody P Schafer
On 11/01/2013 07:45 PM, Steven Rostedt wrote: On Fri, 1 Nov 2013 15:38:46 -0700 Cody P Schafer wrote: Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- kernel

Re: [PATCH 6/8] fs/ext3: use rbtree postorder iteration helper instead of opencoding

2013-11-04 Thread Cody P Schafer
On 11/04/2013 04:45 PM, Jan Kara wrote: On Mon 04-11-13 15:26:38, Jan Kara wrote: On Fri 01-11-13 15:38:50, Cody P Schafer wrote: Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Thanks. I&#x

[PATCH 1/2] rbtree: fix postorder iteration when the rb_node is not the first element in an entry

2013-11-04 Thread Cody P Schafer
(). Signed-off-by: Cody P Schafer --- include/linux/rbtree.h | 20 +++- lib/rbtree.c | 2 -- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h index aa870a4..630eedb 100644 --- a/include/linux/rbtree.h +++ b

[PATCH 2/2] rbtree/test: move rb_node to the middle of the test struct

2013-11-04 Thread Cody P Schafer
Avoid making the rb_node the first entry to catch some bugs around NULL checking the rb_node. Signed-off-by: Cody P Schafer --- lib/rbtree_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rbtree_test.c b/lib/rbtree_test.c index 31dd4cc..df6c125 100644 --- a/lib

Re: [PATCH 1/2] rbtree: fix postorder iteration when the rb_node is not the first element in an entry

2013-11-05 Thread Cody P Schafer
On 11/04/2013 05:40 PM, Cody P Schafer wrote: > Provide a new helper called rb_next_postorder_entry() to perform NULL > checks and container_of() coversions and use it in > rbtree_for_each_entry_safe() to fix oopses that occur when rb_node is > not the first element in the entry

Re: [PATCH 1/2] rbtree: fix postorder iteration when the rb_node is not the first element in an entry

2013-11-06 Thread Cody P Schafer
On 11/05/2013 02:56 PM, Jan Kara wrote: On Tue 05-11-13 22:57:55, Jan Kara wrote: >On Tue 05-11-13 02:05:44, Cody P Schafer wrote: > >On 11/04/2013 05:40 PM, Cody P Schafer wrote: > > >Provide a new helper called rb_next_postorder_entry() to perform NULL > >

[PATCH] rbtree/test: test rbtree_postorder_for_each_entry_safe()

2013-11-06 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- lib/rbtree_test.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/lib/rbtree_test.c b/lib/rbtree_test.c index df6c125..8b3c9dc 100644 --- a/lib/rbtree_test.c +++ b/lib/rbtree_test.c @@ -114,6 +114,16 @@ static int black_path_count(struct rb_node

[PATCH v2 03/11] rbtree/test: test rbtree_postorder_for_each_entry_safe()

2013-11-06 Thread Cody P Schafer
Signed-off-by: Cody P Schafer --- lib/rbtree_test.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/lib/rbtree_test.c b/lib/rbtree_test.c index df6c125..8b3c9dc 100644 --- a/lib/rbtree_test.c +++ b/lib/rbtree_test.c @@ -114,6 +114,16 @@ static int black_path_count(struct rb_node

[PATCH v2 09/11] fs/ext3: use rbtree postorder iteration helper instead of opencoding

2013-11-06 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- fs/ext3/dir.c | 36 +--- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git

[PATCH v2 01/11] rbtree: Fix rbtree_postorder_for_each_entry_safe() iterator

2013-11-06 Thread Cody P Schafer
ome gcc versions (e.g. 4.3.4) assume the above expression can never be equal to NULL. The net result is an oops because the iteration is not properly terminated. Fix the problem by modifying the iterator to avoid pointer underflows. Signed-off-by: Jan Kara Signed-off-by: Cody P Schafer --- includ

[PATCH v2 05/11] trace/trace_stat: use rbtree postorder iteration helper instead of opencoding

2013-11-06 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- kernel/trace/trace_stat.c | 42 ++ 1 file changed, 6 insertions(+), 36

[PATCH v2 02/11] rbtree/test: move rb_node to the middle of the test struct

2013-11-06 Thread Cody P Schafer
Avoid making the rb_node the first entry to catch some bugs around NULL checking the rb_node. Signed-off-by: Cody P Schafer --- lib/rbtree_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rbtree_test.c b/lib/rbtree_test.c index 31dd4cc..df6c125 100644 --- a/lib

[PATCH v2 08/11] fs/jffs2: use rbtree postorder iteration helper instead of opencoding

2013-11-06 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- fs/jffs2/nodelist.c | 28 ++-- fs/jffs2/readinode.c | 26 +++--- 2 files

[PATCH v2 07/11] fs/ext4: use rbtree postorder iteration helper instead of opencoding

2013-11-06 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- fs/ext4/block_validity.c | 33 - fs/ext4/dir.c| 35

[PATCH v2 00/11] rbtree: postorder iteration: fix, add tests, and use in various places

2013-11-06 Thread Cody P Schafer
New in v2: 1: Jan Kara's fix for rbtree_postorder_for_each_entry_safe() for when gcc tries to optimize it. 2,3: test the above mentioned macro and reorder the test struct to catch anther class of errors. Unchanged from v1: 4-11: use the postorder_for_each() in various locations. -- C

[PATCH v2 10/11] mtd/ubi: use rbtree postorder iteration helper instead of opencoding

2013-11-06 Thread Cody P Schafer
Use rbtree_postorder_for_each_entry_safe() to destroy the rbtree instead of opencoding an alternate postorder iteration that modifies the tree Signed-off-by: Cody P Schafer --- drivers/mtd/ubi/attach.c | 49 +++- drivers/mtd/ubi/wl.c | 25

<    1   2   3   4   5   >