aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Ahern <david.ahern@oracle.com>2015-04-14 13:49:33 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-04-24 11:44:47 -0400
commit4ad1f4300e3bddf63109aa63cfb2d37e8585ecc7 (patch)
tree68f522be24889bbc5d913a4b57d36e2aba940db8 /tools
parentde28c15daf60e9625bece22f13a091fac8d05f1d (diff)
perf kmem: Fix compiles on RHEL6/OL6
0d68bc92c48 breaks compiles on RHEL6/OL6: cc1: warnings being treated as errors builtin-kmem.c: In function ‘search_page_alloc_stat’: builtin-kmem.c:322: error: declaration of ‘stat’ shadows a global declaration node = &parent->rb_left; /usr/include/sys/stat.h:455: error: shadowed declaration is here builtin-kmem.c: In function ‘perf_evsel__process_page_alloc_event’: builtin-kmem.c:378: error: declaration of ‘stat’ shadows a global declaration /usr/include/sys/stat.h:455: error: shadowed declaration is here builtin-kmem.c: In function ‘perf_evsel__process_page_free_event’: builtin-kmem.c:431: error: declaration of ‘stat’ shadows a global declaration /usr/include/sys/stat.h:455: error: shadowed declaration is here Rename local variable to pstat to avoid the name conflict. Signed-off-by: David Ahern <david.ahern@oracle.com> Link: http://lkml.kernel.org/r/1429033773-31383-1-git-send-email-david.ahern@oracle.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-kmem.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index a1915b430044..1634186d537c 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -319,7 +319,7 @@ static int page_stat_cmp(struct page_stat *a, struct page_stat *b)
319 return 0; 319 return 0;
320} 320}
321 321
322static struct page_stat *search_page_alloc_stat(struct page_stat *stat, bool create) 322static struct page_stat *search_page_alloc_stat(struct page_stat *pstat, bool create)
323{ 323{
324 struct rb_node **node = &page_alloc_tree.rb_node; 324 struct rb_node **node = &page_alloc_tree.rb_node;
325 struct rb_node *parent = NULL; 325 struct rb_node *parent = NULL;
@@ -331,7 +331,7 @@ static struct page_stat *search_page_alloc_stat(struct page_stat *stat, bool cre
331 parent = *node; 331 parent = *node;
332 data = rb_entry(*node, struct page_stat, node); 332 data = rb_entry(*node, struct page_stat, node);
333 333
334 cmp = page_stat_cmp(data, stat); 334 cmp = page_stat_cmp(data, pstat);
335 if (cmp < 0) 335 if (cmp < 0)
336 node = &parent->rb_left; 336 node = &parent->rb_left;
337 else if (cmp > 0) 337 else if (cmp > 0)
@@ -345,10 +345,10 @@ static struct page_stat *search_page_alloc_stat(struct page_stat *stat, bool cre
345 345
346 data = zalloc(sizeof(*data)); 346 data = zalloc(sizeof(*data));
347 if (data != NULL) { 347 if (data != NULL) {
348 data->page = stat->page; 348 data->page = pstat->page;
349 data->order = stat->order; 349 data->order = pstat->order;
350 data->gfp_flags = stat->gfp_flags; 350 data->gfp_flags = pstat->gfp_flags;
351 data->migrate_type = stat->migrate_type; 351 data->migrate_type = pstat->migrate_type;
352 352
353 rb_link_node(&data->node, parent, node); 353 rb_link_node(&data->node, parent, node);
354 rb_insert_color(&data->node, &page_alloc_tree); 354 rb_insert_color(&data->node, &page_alloc_tree);
@@ -375,7 +375,7 @@ static int perf_evsel__process_page_alloc_event(struct perf_evsel *evsel,
375 unsigned int migrate_type = perf_evsel__intval(evsel, sample, 375 unsigned int migrate_type = perf_evsel__intval(evsel, sample,
376 "migratetype"); 376 "migratetype");
377 u64 bytes = kmem_page_size << order; 377 u64 bytes = kmem_page_size << order;
378 struct page_stat *stat; 378 struct page_stat *pstat;
379 struct page_stat this = { 379 struct page_stat this = {
380 .order = order, 380 .order = order,
381 .gfp_flags = gfp_flags, 381 .gfp_flags = gfp_flags,
@@ -401,21 +401,21 @@ static int perf_evsel__process_page_alloc_event(struct perf_evsel *evsel,
401 * This is to find the current page (with correct gfp flags and 401 * This is to find the current page (with correct gfp flags and
402 * migrate type) at free event. 402 * migrate type) at free event.
403 */ 403 */
404 stat = search_page(page, true); 404 pstat = search_page(page, true);
405 if (stat == NULL) 405 if (pstat == NULL)
406 return -ENOMEM; 406 return -ENOMEM;
407 407
408 stat->order = order; 408 pstat->order = order;
409 stat->gfp_flags = gfp_flags; 409 pstat->gfp_flags = gfp_flags;
410 stat->migrate_type = migrate_type; 410 pstat->migrate_type = migrate_type;
411 411
412 this.page = page; 412 this.page = page;
413 stat = search_page_alloc_stat(&this, true); 413 pstat = search_page_alloc_stat(&this, true);
414 if (stat == NULL) 414 if (pstat == NULL)
415 return -ENOMEM; 415 return -ENOMEM;
416 416
417 stat->nr_alloc++; 417 pstat->nr_alloc++;
418 stat->alloc_bytes += bytes; 418 pstat->alloc_bytes += bytes;
419 419
420 order_stats[order][migrate_type]++; 420 order_stats[order][migrate_type]++;
421 421
@@ -428,7 +428,7 @@ static int perf_evsel__process_page_free_event(struct perf_evsel *evsel,
428 u64 page; 428 u64 page;
429 unsigned int order = perf_evsel__intval(evsel, sample, "order"); 429 unsigned int order = perf_evsel__intval(evsel, sample, "order");
430 u64 bytes = kmem_page_size << order; 430 u64 bytes = kmem_page_size << order;
431 struct page_stat *stat; 431 struct page_stat *pstat;
432 struct page_stat this = { 432 struct page_stat this = {
433 .order = order, 433 .order = order,
434 }; 434 };
@@ -441,8 +441,8 @@ static int perf_evsel__process_page_free_event(struct perf_evsel *evsel,
441 nr_page_frees++; 441 nr_page_frees++;
442 total_page_free_bytes += bytes; 442 total_page_free_bytes += bytes;
443 443
444 stat = search_page(page, false); 444 pstat = search_page(page, false);
445 if (stat == NULL) { 445 if (pstat == NULL) {
446 pr_debug2("missing free at page %"PRIx64" (order: %d)\n", 446 pr_debug2("missing free at page %"PRIx64" (order: %d)\n",
447 page, order); 447 page, order);
448 448
@@ -453,18 +453,18 @@ static int perf_evsel__process_page_free_event(struct perf_evsel *evsel,
453 } 453 }
454 454
455 this.page = page; 455 this.page = page;
456 this.gfp_flags = stat->gfp_flags; 456 this.gfp_flags = pstat->gfp_flags;
457 this.migrate_type = stat->migrate_type; 457 this.migrate_type = pstat->migrate_type;
458 458
459 rb_erase(&stat->node, &page_tree); 459 rb_erase(&pstat->node, &page_tree);
460 free(stat); 460 free(pstat);
461 461
462 stat = search_page_alloc_stat(&this, false); 462 pstat = search_page_alloc_stat(&this, false);
463 if (stat == NULL) 463 if (pstat == NULL)
464 return -ENOENT; 464 return -ENOENT;
465 465
466 stat->nr_free++; 466 pstat->nr_free++;
467 stat->free_bytes += bytes; 467 pstat->free_bytes += bytes;
468 468
469 return 0; 469 return 0;
470} 470}