diff options
Diffstat (limited to 'kernel/profile.c')
| -rw-r--r-- | kernel/profile.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/kernel/profile.c b/kernel/profile.c index 6631e1ef55ab..cb980f0c731b 100644 --- a/kernel/profile.c +++ b/kernel/profile.c | |||
| @@ -549,14 +549,14 @@ static int create_hash_tables(void) | |||
| 549 | struct page *page; | 549 | struct page *page; |
| 550 | 550 | ||
| 551 | page = alloc_pages_exact_node(node, | 551 | page = alloc_pages_exact_node(node, |
| 552 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 552 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
| 553 | 0); | 553 | 0); |
| 554 | if (!page) | 554 | if (!page) |
| 555 | goto out_cleanup; | 555 | goto out_cleanup; |
| 556 | per_cpu(cpu_profile_hits, cpu)[1] | 556 | per_cpu(cpu_profile_hits, cpu)[1] |
| 557 | = (struct profile_hit *)page_address(page); | 557 | = (struct profile_hit *)page_address(page); |
| 558 | page = alloc_pages_exact_node(node, | 558 | page = alloc_pages_exact_node(node, |
| 559 | GFP_KERNEL | __GFP_ZERO | GFP_THISNODE, | 559 | GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE, |
| 560 | 0); | 560 | 0); |
| 561 | if (!page) | 561 | if (!page) |
| 562 | goto out_cleanup; | 562 | goto out_cleanup; |
| @@ -591,18 +591,28 @@ out_cleanup: | |||
| 591 | int __ref create_proc_profile(void) /* false positive from hotcpu_notifier */ | 591 | int __ref create_proc_profile(void) /* false positive from hotcpu_notifier */ |
| 592 | { | 592 | { |
| 593 | struct proc_dir_entry *entry; | 593 | struct proc_dir_entry *entry; |
| 594 | int err = 0; | ||
| 594 | 595 | ||
| 595 | if (!prof_on) | 596 | if (!prof_on) |
| 596 | return 0; | 597 | return 0; |
| 597 | if (create_hash_tables()) | 598 | |
| 598 | return -ENOMEM; | 599 | cpu_notifier_register_begin(); |
| 600 | |||
| 601 | if (create_hash_tables()) { | ||
| 602 | err = -ENOMEM; | ||
| 603 | goto out; | ||
| 604 | } | ||
| 605 | |||
| 599 | entry = proc_create("profile", S_IWUSR | S_IRUGO, | 606 | entry = proc_create("profile", S_IWUSR | S_IRUGO, |
| 600 | NULL, &proc_profile_operations); | 607 | NULL, &proc_profile_operations); |
| 601 | if (!entry) | 608 | if (!entry) |
| 602 | return 0; | 609 | goto out; |
| 603 | proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t)); | 610 | proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t)); |
| 604 | hotcpu_notifier(profile_cpu_callback, 0); | 611 | __hotcpu_notifier(profile_cpu_callback, 0); |
| 605 | return 0; | 612 | |
| 613 | out: | ||
| 614 | cpu_notifier_register_done(); | ||
| 615 | return err; | ||
| 606 | } | 616 | } |
| 607 | module_init(create_proc_profile); | 617 | subsys_initcall(create_proc_profile); |
| 608 | #endif /* CONFIG_PROC_FS */ | 618 | #endif /* CONFIG_PROC_FS */ |
