profile.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. /*
  2. * linux/kernel/profile.c
  3. * Simple profiling. Manages a direct-mapped profile hit count buffer,
  4. * with configurable resolution, support for restricting the cpus on
  5. * which profiling is done, and switching between cpu time and
  6. * schedule() calls via kernel command line parameters passed at boot.
  7. *
  8. * Scheduler profiling support, Arjan van de Ven and Ingo Molnar,
  9. * Red Hat, July 2004
  10. * Consolidation of architecture support code for profiling,
  11. * Nadia Yvette Chambers, Oracle, July 2004
  12. * Amortized hit count accounting via per-cpu open-addressed hashtables
  13. * to resolve timer interrupt livelocks, Nadia Yvette Chambers,
  14. * Oracle, 2004
  15. */
  16. #include <linux/export.h>
  17. #include <linux/profile.h>
  18. #include <linux/bootmem.h>
  19. #include <linux/notifier.h>
  20. #include <linux/mm.h>
  21. #include <linux/cpumask.h>
  22. #include <linux/cpu.h>
  23. #include <linux/highmem.h>
  24. #include <linux/mutex.h>
  25. #include <linux/slab.h>
  26. #include <linux/vmalloc.h>
  27. #include <asm/sections.h>
  28. #include <asm/irq_regs.h>
  29. #include <asm/ptrace.h>
  30. struct profile_hit {
  31. u32 pc, hits;
  32. };
  33. #define PROFILE_GRPSHIFT 3
  34. #define PROFILE_GRPSZ (1 << PROFILE_GRPSHIFT)
  35. #define NR_PROFILE_HIT (PAGE_SIZE/sizeof(struct profile_hit))
  36. #define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ)
  37. static atomic_t *prof_buffer;
  38. static unsigned long prof_len, prof_shift;
  39. int prof_on __read_mostly;
  40. EXPORT_SYMBOL_GPL(prof_on);
  41. static cpumask_var_t prof_cpu_mask;
  42. #if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
  43. static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits);
  44. static DEFINE_PER_CPU(int, cpu_profile_flip);
  45. static DEFINE_MUTEX(profile_flip_mutex);
  46. #endif /* CONFIG_SMP */
  47. int profile_setup(char *str)
  48. {
  49. static const char schedstr[] = "schedule";
  50. static const char sleepstr[] = "sleep";
  51. static const char kvmstr[] = "kvm";
  52. int par;
  53. if (!strncmp(str, sleepstr, strlen(sleepstr))) {
  54. #ifdef CONFIG_SCHEDSTATS
  55. prof_on = SLEEP_PROFILING;
  56. if (str[strlen(sleepstr)] == ',')
  57. str += strlen(sleepstr) + 1;
  58. if (get_option(&str, &par))
  59. prof_shift = par;
  60. pr_info("kernel sleep profiling enabled (shift: %ld)\n",
  61. prof_shift);
  62. #else
  63. pr_warn("kernel sleep profiling requires CONFIG_SCHEDSTATS\n");
  64. #endif /* CONFIG_SCHEDSTATS */
  65. } else if (!strncmp(str, schedstr, strlen(schedstr))) {
  66. prof_on = SCHED_PROFILING;
  67. if (str[strlen(schedstr)] == ',')
  68. str += strlen(schedstr) + 1;
  69. if (get_option(&str, &par))
  70. prof_shift = par;
  71. pr_info("kernel schedule profiling enabled (shift: %ld)\n",
  72. prof_shift);
  73. } else if (!strncmp(str, kvmstr, strlen(kvmstr))) {
  74. prof_on = KVM_PROFILING;
  75. if (str[strlen(kvmstr)] == ',')
  76. str += strlen(kvmstr) + 1;
  77. if (get_option(&str, &par))
  78. prof_shift = par;
  79. pr_info("kernel KVM profiling enabled (shift: %ld)\n",
  80. prof_shift);
  81. } else if (get_option(&str, &par)) {
  82. prof_shift = par;
  83. prof_on = CPU_PROFILING;
  84. pr_info("kernel profiling enabled (shift: %ld)\n",
  85. prof_shift);
  86. }
  87. return 1;
  88. }
  89. __setup("profile=", profile_setup);
  90. int __ref profile_init(void)
  91. {
  92. int buffer_bytes;
  93. if (!prof_on)
  94. return 0;
  95. /* only text is profiled */
  96. prof_len = (_etext - _stext) >> prof_shift;
  97. buffer_bytes = prof_len*sizeof(atomic_t);
  98. if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL))
  99. return -ENOMEM;
  100. cpumask_copy(prof_cpu_mask, cpu_possible_mask);
  101. prof_buffer = kzalloc(buffer_bytes, GFP_KERNEL|__GFP_NOWARN);
  102. if (prof_buffer)
  103. return 0;
  104. prof_buffer = alloc_pages_exact(buffer_bytes,
  105. GFP_KERNEL|__GFP_ZERO|__GFP_NOWARN);
  106. if (prof_buffer)
  107. return 0;
  108. prof_buffer = vzalloc(buffer_bytes);
  109. if (prof_buffer)
  110. return 0;
  111. free_cpumask_var(prof_cpu_mask);
  112. return -ENOMEM;
  113. }
  114. /* Profile event notifications */
  115. static BLOCKING_NOTIFIER_HEAD(task_exit_notifier);
  116. static ATOMIC_NOTIFIER_HEAD(task_free_notifier);
  117. static BLOCKING_NOTIFIER_HEAD(munmap_notifier);
  118. void profile_task_exit(struct task_struct *task)
  119. {
  120. blocking_notifier_call_chain(&task_exit_notifier, 0, task);
  121. }
  122. int profile_handoff_task(struct task_struct *task)
  123. {
  124. int ret;
  125. ret = atomic_notifier_call_chain(&task_free_notifier, 0, task);
  126. return (ret == NOTIFY_OK) ? 1 : 0;
  127. }
  128. void profile_munmap(unsigned long addr)
  129. {
  130. blocking_notifier_call_chain(&munmap_notifier, 0, (void *)addr);
  131. }
  132. int task_handoff_register(struct notifier_block *n)
  133. {
  134. return atomic_notifier_chain_register(&task_free_notifier, n);
  135. }
  136. EXPORT_SYMBOL_GPL(task_handoff_register);
  137. int task_handoff_unregister(struct notifier_block *n)
  138. {
  139. return atomic_notifier_chain_unregister(&task_free_notifier, n);
  140. }
  141. EXPORT_SYMBOL_GPL(task_handoff_unregister);
  142. int profile_event_register(enum profile_type type, struct notifier_block *n)
  143. {
  144. int err = -EINVAL;
  145. switch (type) {
  146. case PROFILE_TASK_EXIT:
  147. err = blocking_notifier_chain_register(
  148. &task_exit_notifier, n);
  149. break;
  150. case PROFILE_MUNMAP:
  151. err = blocking_notifier_chain_register(
  152. &munmap_notifier, n);
  153. break;
  154. }
  155. return err;
  156. }
  157. EXPORT_SYMBOL_GPL(profile_event_register);
  158. int profile_event_unregister(enum profile_type type, struct notifier_block *n)
  159. {
  160. int err = -EINVAL;
  161. switch (type) {
  162. case PROFILE_TASK_EXIT:
  163. err = blocking_notifier_chain_unregister(
  164. &task_exit_notifier, n);
  165. break;
  166. case PROFILE_MUNMAP:
  167. err = blocking_notifier_chain_unregister(
  168. &munmap_notifier, n);
  169. break;
  170. }
  171. return err;
  172. }
  173. EXPORT_SYMBOL_GPL(profile_event_unregister);
  174. #if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
  175. /*
  176. * Each cpu has a pair of open-addressed hashtables for pending
  177. * profile hits. read_profile() IPI's all cpus to request them
  178. * to flip buffers and flushes their contents to prof_buffer itself.
  179. * Flip requests are serialized by the profile_flip_mutex. The sole
  180. * use of having a second hashtable is for avoiding cacheline
  181. * contention that would otherwise happen during flushes of pending
  182. * profile hits required for the accuracy of reported profile hits
  183. * and so resurrect the interrupt livelock issue.
  184. *
  185. * The open-addressed hashtables are indexed by profile buffer slot
  186. * and hold the number of pending hits to that profile buffer slot on
  187. * a cpu in an entry. When the hashtable overflows, all pending hits
  188. * are accounted to their corresponding profile buffer slots with
  189. * atomic_add() and the hashtable emptied. As numerous pending hits
  190. * may be accounted to a profile buffer slot in a hashtable entry,
  191. * this amortizes a number of atomic profile buffer increments likely
  192. * to be far larger than the number of entries in the hashtable,
  193. * particularly given that the number of distinct profile buffer
  194. * positions to which hits are accounted during short intervals (e.g.
  195. * several seconds) is usually very small. Exclusion from buffer
  196. * flipping is provided by interrupt disablement (note that for
  197. * SCHED_PROFILING or SLEEP_PROFILING profile_hit() may be called from
  198. * process context).
  199. * The hash function is meant to be lightweight as opposed to strong,
  200. * and was vaguely inspired by ppc64 firmware-supported inverted
  201. * pagetable hash functions, but uses a full hashtable full of finite
  202. * collision chains, not just pairs of them.
  203. *
  204. * -- nyc
  205. */
  206. static void __profile_flip_buffers(void *unused)
  207. {
  208. int cpu = smp_processor_id();
  209. per_cpu(cpu_profile_flip, cpu) = !per_cpu(cpu_profile_flip, cpu);
  210. }
  211. static void profile_flip_buffers(void)
  212. {
  213. int i, j, cpu;
  214. mutex_lock(&profile_flip_mutex);
  215. j = per_cpu(cpu_profile_flip, get_cpu());
  216. put_cpu();
  217. on_each_cpu(__profile_flip_buffers, NULL, 1);
  218. for_each_online_cpu(cpu) {
  219. struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[j];
  220. for (i = 0; i < NR_PROFILE_HIT; ++i) {
  221. if (!hits[i].hits) {
  222. if (hits[i].pc)
  223. hits[i].pc = 0;
  224. continue;
  225. }
  226. atomic_add(hits[i].hits, &prof_buffer[hits[i].pc]);
  227. hits[i].hits = hits[i].pc = 0;
  228. }
  229. }
  230. mutex_unlock(&profile_flip_mutex);
  231. }
  232. static void profile_discard_flip_buffers(void)
  233. {
  234. int i, cpu;
  235. mutex_lock(&profile_flip_mutex);
  236. i = per_cpu(cpu_profile_flip, get_cpu());
  237. put_cpu();
  238. on_each_cpu(__profile_flip_buffers, NULL, 1);
  239. for_each_online_cpu(cpu) {
  240. struct profile_hit *hits = per_cpu(cpu_profile_hits, cpu)[i];
  241. memset(hits, 0, NR_PROFILE_HIT*sizeof(struct profile_hit));
  242. }
  243. mutex_unlock(&profile_flip_mutex);
  244. }
  245. static void do_profile_hits(int type, void *__pc, unsigned int nr_hits)
  246. {
  247. unsigned long primary, secondary, flags, pc = (unsigned long)__pc;
  248. int i, j, cpu;
  249. struct profile_hit *hits;
  250. pc = min((pc - (unsigned long)_stext) >> prof_shift, prof_len - 1);
  251. i = primary = (pc & (NR_PROFILE_GRP - 1)) << PROFILE_GRPSHIFT;
  252. secondary = (~(pc << 1) & (NR_PROFILE_GRP - 1)) << PROFILE_GRPSHIFT;
  253. cpu = get_cpu();
  254. hits = per_cpu(cpu_profile_hits, cpu)[per_cpu(cpu_profile_flip, cpu)];
  255. if (!hits) {
  256. put_cpu();
  257. return;
  258. }
  259. /*
  260. * We buffer the global profiler buffer into a per-CPU
  261. * queue and thus reduce the number of global (and possibly
  262. * NUMA-alien) accesses. The write-queue is self-coalescing:
  263. */
  264. local_irq_save(flags);
  265. do {
  266. for (j = 0; j < PROFILE_GRPSZ; ++j) {
  267. if (hits[i + j].pc == pc) {
  268. hits[i + j].hits += nr_hits;
  269. goto out;
  270. } else if (!hits[i + j].hits) {
  271. hits[i + j].pc = pc;
  272. hits[i + j].hits = nr_hits;
  273. goto out;
  274. }
  275. }
  276. i = (i + secondary) & (NR_PROFILE_HIT - 1);
  277. } while (i != primary);
  278. /*
  279. * Add the current hit(s) and flush the write-queue out
  280. * to the global buffer:
  281. */
  282. atomic_add(nr_hits, &prof_buffer[pc]);
  283. for (i = 0; i < NR_PROFILE_HIT; ++i) {
  284. atomic_add(hits[i].hits, &prof_buffer[hits[i].pc]);
  285. hits[i].pc = hits[i].hits = 0;
  286. }
  287. out:
  288. local_irq_restore(flags);
  289. put_cpu();
  290. }
  291. static int profile_cpu_callback(struct notifier_block *info,
  292. unsigned long action, void *__cpu)
  293. {
  294. int node, cpu = (unsigned long)__cpu;
  295. struct page *page;
  296. switch (action) {
  297. case CPU_UP_PREPARE:
  298. case CPU_UP_PREPARE_FROZEN:
  299. node = cpu_to_mem(cpu);
  300. per_cpu(cpu_profile_flip, cpu) = 0;
  301. if (!per_cpu(cpu_profile_hits, cpu)[1]) {
  302. page = __alloc_pages_node(node,
  303. GFP_KERNEL | __GFP_ZERO,
  304. 0);
  305. if (!page)
  306. return notifier_from_errno(-ENOMEM);
  307. per_cpu(cpu_profile_hits, cpu)[1] = page_address(page);
  308. }
  309. if (!per_cpu(cpu_profile_hits, cpu)[0]) {
  310. page = __alloc_pages_node(node,
  311. GFP_KERNEL | __GFP_ZERO,
  312. 0);
  313. if (!page)
  314. goto out_free;
  315. per_cpu(cpu_profile_hits, cpu)[0] = page_address(page);
  316. }
  317. break;
  318. out_free:
  319. page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[1]);
  320. per_cpu(cpu_profile_hits, cpu)[1] = NULL;
  321. __free_page(page);
  322. return notifier_from_errno(-ENOMEM);
  323. case CPU_ONLINE:
  324. case CPU_ONLINE_FROZEN:
  325. if (prof_cpu_mask != NULL)
  326. cpumask_set_cpu(cpu, prof_cpu_mask);
  327. break;
  328. case CPU_UP_CANCELED:
  329. case CPU_UP_CANCELED_FROZEN:
  330. case CPU_DEAD:
  331. case CPU_DEAD_FROZEN:
  332. if (prof_cpu_mask != NULL)
  333. cpumask_clear_cpu(cpu, prof_cpu_mask);
  334. if (per_cpu(cpu_profile_hits, cpu)[0]) {
  335. page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[0]);
  336. per_cpu(cpu_profile_hits, cpu)[0] = NULL;
  337. __free_page(page);
  338. }
  339. if (per_cpu(cpu_profile_hits, cpu)[1]) {
  340. page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[1]);
  341. per_cpu(cpu_profile_hits, cpu)[1] = NULL;
  342. __free_page(page);
  343. }
  344. break;
  345. }
  346. return NOTIFY_OK;
  347. }
  348. #else /* !CONFIG_SMP */
  349. #define profile_flip_buffers() do { } while (0)
  350. #define profile_discard_flip_buffers() do { } while (0)
  351. #define profile_cpu_callback NULL
  352. static void do_profile_hits(int type, void *__pc, unsigned int nr_hits)
  353. {
  354. unsigned long pc;
  355. pc = ((unsigned long)__pc - (unsigned long)_stext) >> prof_shift;
  356. atomic_add(nr_hits, &prof_buffer[min(pc, prof_len - 1)]);
  357. }
  358. #endif /* !CONFIG_SMP */
  359. void profile_hits(int type, void *__pc, unsigned int nr_hits)
  360. {
  361. if (prof_on != type || !prof_buffer)
  362. return;
  363. do_profile_hits(type, __pc, nr_hits);
  364. }
  365. EXPORT_SYMBOL_GPL(profile_hits);
  366. void profile_tick(int type)
  367. {
  368. struct pt_regs *regs = get_irq_regs();
  369. if (!user_mode(regs) && prof_cpu_mask != NULL &&
  370. cpumask_test_cpu(smp_processor_id(), prof_cpu_mask))
  371. profile_hit(type, (void *)profile_pc(regs));
  372. }
  373. #ifdef CONFIG_PROC_FS
  374. #include <linux/proc_fs.h>
  375. #include <linux/seq_file.h>
  376. #include <asm/uaccess.h>
  377. static int prof_cpu_mask_proc_show(struct seq_file *m, void *v)
  378. {
  379. seq_printf(m, "%*pb\n", cpumask_pr_args(prof_cpu_mask));
  380. return 0;
  381. }
  382. static int prof_cpu_mask_proc_open(struct inode *inode, struct file *file)
  383. {
  384. return single_open(file, prof_cpu_mask_proc_show, NULL);
  385. }
  386. static ssize_t prof_cpu_mask_proc_write(struct file *file,
  387. const char __user *buffer, size_t count, loff_t *pos)
  388. {
  389. cpumask_var_t new_value;
  390. int err;
  391. if (!alloc_cpumask_var(&new_value, GFP_KERNEL))
  392. return -ENOMEM;
  393. err = cpumask_parse_user(buffer, count, new_value);
  394. if (!err) {
  395. cpumask_copy(prof_cpu_mask, new_value);
  396. err = count;
  397. }
  398. free_cpumask_var(new_value);
  399. return err;
  400. }
  401. static const struct file_operations prof_cpu_mask_proc_fops = {
  402. .open = prof_cpu_mask_proc_open,
  403. .read = seq_read,
  404. .llseek = seq_lseek,
  405. .release = single_release,
  406. .write = prof_cpu_mask_proc_write,
  407. };
  408. void create_prof_cpu_mask(void)
  409. {
  410. /* create /proc/irq/prof_cpu_mask */
  411. proc_create("irq/prof_cpu_mask", 0600, NULL, &prof_cpu_mask_proc_fops);
  412. }
  413. /*
  414. * This function accesses profiling information. The returned data is
  415. * binary: the sampling step and the actual contents of the profile
  416. * buffer. Use of the program readprofile is recommended in order to
  417. * get meaningful info out of these data.
  418. */
  419. static ssize_t
  420. read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos)
  421. {
  422. unsigned long p = *ppos;
  423. ssize_t read;
  424. char *pnt;
  425. unsigned int sample_step = 1 << prof_shift;
  426. profile_flip_buffers();
  427. if (p >= (prof_len+1)*sizeof(unsigned int))
  428. return 0;
  429. if (count > (prof_len+1)*sizeof(unsigned int) - p)
  430. count = (prof_len+1)*sizeof(unsigned int) - p;
  431. read = 0;
  432. while (p < sizeof(unsigned int) && count > 0) {
  433. if (put_user(*((char *)(&sample_step)+p), buf))
  434. return -EFAULT;
  435. buf++; p++; count--; read++;
  436. }
  437. pnt = (char *)prof_buffer + p - sizeof(atomic_t);
  438. if (copy_to_user(buf, (void *)pnt, count))
  439. return -EFAULT;
  440. read += count;
  441. *ppos += read;
  442. return read;
  443. }
  444. /*
  445. * Writing to /proc/profile resets the counters
  446. *
  447. * Writing a 'profiling multiplier' value into it also re-sets the profiling
  448. * interrupt frequency, on architectures that support this.
  449. */
  450. static ssize_t write_profile(struct file *file, const char __user *buf,
  451. size_t count, loff_t *ppos)
  452. {
  453. #ifdef CONFIG_SMP
  454. extern int setup_profiling_timer(unsigned int multiplier);
  455. if (count == sizeof(int)) {
  456. unsigned int multiplier;
  457. if (copy_from_user(&multiplier, buf, sizeof(int)))
  458. return -EFAULT;
  459. if (setup_profiling_timer(multiplier))
  460. return -EINVAL;
  461. }
  462. #endif
  463. profile_discard_flip_buffers();
  464. memset(prof_buffer, 0, prof_len * sizeof(atomic_t));
  465. return count;
  466. }
  467. static const struct file_operations proc_profile_operations = {
  468. .read = read_profile,
  469. .write = write_profile,
  470. .llseek = default_llseek,
  471. };
  472. #ifdef CONFIG_SMP
  473. static void profile_nop(void *unused)
  474. {
  475. }
  476. static int create_hash_tables(void)
  477. {
  478. int cpu;
  479. for_each_online_cpu(cpu) {
  480. int node = cpu_to_mem(cpu);
  481. struct page *page;
  482. page = __alloc_pages_node(node,
  483. GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE,
  484. 0);
  485. if (!page)
  486. goto out_cleanup;
  487. per_cpu(cpu_profile_hits, cpu)[1]
  488. = (struct profile_hit *)page_address(page);
  489. page = __alloc_pages_node(node,
  490. GFP_KERNEL | __GFP_ZERO | __GFP_THISNODE,
  491. 0);
  492. if (!page)
  493. goto out_cleanup;
  494. per_cpu(cpu_profile_hits, cpu)[0]
  495. = (struct profile_hit *)page_address(page);
  496. }
  497. return 0;
  498. out_cleanup:
  499. prof_on = 0;
  500. smp_mb();
  501. on_each_cpu(profile_nop, NULL, 1);
  502. for_each_online_cpu(cpu) {
  503. struct page *page;
  504. if (per_cpu(cpu_profile_hits, cpu)[0]) {
  505. page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[0]);
  506. per_cpu(cpu_profile_hits, cpu)[0] = NULL;
  507. __free_page(page);
  508. }
  509. if (per_cpu(cpu_profile_hits, cpu)[1]) {
  510. page = virt_to_page(per_cpu(cpu_profile_hits, cpu)[1]);
  511. per_cpu(cpu_profile_hits, cpu)[1] = NULL;
  512. __free_page(page);
  513. }
  514. }
  515. return -1;
  516. }
  517. #else
  518. #define create_hash_tables() ({ 0; })
  519. #endif
  520. int __ref create_proc_profile(void) /* false positive from hotcpu_notifier */
  521. {
  522. struct proc_dir_entry *entry;
  523. int err = 0;
  524. if (!prof_on)
  525. return 0;
  526. cpu_notifier_register_begin();
  527. if (create_hash_tables()) {
  528. err = -ENOMEM;
  529. goto out;
  530. }
  531. entry = proc_create("profile", S_IWUSR | S_IRUGO,
  532. NULL, &proc_profile_operations);
  533. if (!entry)
  534. goto out;
  535. proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));
  536. __hotcpu_notifier(profile_cpu_callback, 0);
  537. out:
  538. cpu_notifier_register_done();
  539. return err;
  540. }
  541. subsys_initcall(create_proc_profile);
  542. #endif /* CONFIG_PROC_FS */