vmstat.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. /*
  2. * linux/mm/vmstat.c
  3. *
  4. * Manages VM statistics
  5. * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
  6. *
  7. * zoned VM statistics
  8. * Copyright (C) 2006 Silicon Graphics, Inc.,
  9. * Christoph Lameter <christoph@lameter.com>
  10. */
  11. #include <linux/config.h>
  12. #include <linux/mm.h>
  13. #include <linux/module.h>
  14. #include <linux/cpu.h>
  15. void __get_zone_counts(unsigned long *active, unsigned long *inactive,
  16. unsigned long *free, struct pglist_data *pgdat)
  17. {
  18. struct zone *zones = pgdat->node_zones;
  19. int i;
  20. *active = 0;
  21. *inactive = 0;
  22. *free = 0;
  23. for (i = 0; i < MAX_NR_ZONES; i++) {
  24. *active += zones[i].nr_active;
  25. *inactive += zones[i].nr_inactive;
  26. *free += zones[i].free_pages;
  27. }
  28. }
  29. void get_zone_counts(unsigned long *active,
  30. unsigned long *inactive, unsigned long *free)
  31. {
  32. struct pglist_data *pgdat;
  33. *active = 0;
  34. *inactive = 0;
  35. *free = 0;
  36. for_each_online_pgdat(pgdat) {
  37. unsigned long l, m, n;
  38. __get_zone_counts(&l, &m, &n, pgdat);
  39. *active += l;
  40. *inactive += m;
  41. *free += n;
  42. }
  43. }
  44. #ifdef CONFIG_VM_EVENT_COUNTERS
  45. DEFINE_PER_CPU(struct vm_event_state, vm_event_states) = {{0}};
  46. EXPORT_PER_CPU_SYMBOL(vm_event_states);
  47. static void sum_vm_events(unsigned long *ret, cpumask_t *cpumask)
  48. {
  49. int cpu = 0;
  50. int i;
  51. memset(ret, 0, NR_VM_EVENT_ITEMS * sizeof(unsigned long));
  52. cpu = first_cpu(*cpumask);
  53. while (cpu < NR_CPUS) {
  54. struct vm_event_state *this = &per_cpu(vm_event_states, cpu);
  55. cpu = next_cpu(cpu, *cpumask);
  56. if (cpu < NR_CPUS)
  57. prefetch(&per_cpu(vm_event_states, cpu));
  58. for (i = 0; i < NR_VM_EVENT_ITEMS; i++)
  59. ret[i] += this->event[i];
  60. }
  61. }
  62. /*
  63. * Accumulate the vm event counters across all CPUs.
  64. * The result is unavoidably approximate - it can change
  65. * during and after execution of this function.
  66. */
  67. void all_vm_events(unsigned long *ret)
  68. {
  69. sum_vm_events(ret, &cpu_online_map);
  70. }
  71. EXPORT_SYMBOL_GPL(all_vm_events);
  72. #ifdef CONFIG_HOTPLUG
  73. /*
  74. * Fold the foreign cpu events into our own.
  75. *
  76. * This is adding to the events on one processor
  77. * but keeps the global counts constant.
  78. */
  79. void vm_events_fold_cpu(int cpu)
  80. {
  81. struct vm_event_state *fold_state = &per_cpu(vm_event_states, cpu);
  82. int i;
  83. for (i = 0; i < NR_VM_EVENT_ITEMS; i++) {
  84. count_vm_events(i, fold_state->event[i]);
  85. fold_state->event[i] = 0;
  86. }
  87. }
  88. #endif /* CONFIG_HOTPLUG */
  89. #endif /* CONFIG_VM_EVENT_COUNTERS */
  90. /*
  91. * Manage combined zone based / global counters
  92. *
  93. * vm_stat contains the global counters
  94. */
  95. atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
  96. EXPORT_SYMBOL(vm_stat);
  97. #ifdef CONFIG_SMP
  98. static int calculate_threshold(struct zone *zone)
  99. {
  100. int threshold;
  101. int mem; /* memory in 128 MB units */
  102. /*
  103. * The threshold scales with the number of processors and the amount
  104. * of memory per zone. More memory means that we can defer updates for
  105. * longer, more processors could lead to more contention.
  106. * fls() is used to have a cheap way of logarithmic scaling.
  107. *
  108. * Some sample thresholds:
  109. *
  110. * Threshold Processors (fls) Zonesize fls(mem+1)
  111. * ------------------------------------------------------------------
  112. * 8 1 1 0.9-1 GB 4
  113. * 16 2 2 0.9-1 GB 4
  114. * 20 2 2 1-2 GB 5
  115. * 24 2 2 2-4 GB 6
  116. * 28 2 2 4-8 GB 7
  117. * 32 2 2 8-16 GB 8
  118. * 4 2 2 <128M 1
  119. * 30 4 3 2-4 GB 5
  120. * 48 4 3 8-16 GB 8
  121. * 32 8 4 1-2 GB 4
  122. * 32 8 4 0.9-1GB 4
  123. * 10 16 5 <128M 1
  124. * 40 16 5 900M 4
  125. * 70 64 7 2-4 GB 5
  126. * 84 64 7 4-8 GB 6
  127. * 108 512 9 4-8 GB 6
  128. * 125 1024 10 8-16 GB 8
  129. * 125 1024 10 16-32 GB 9
  130. */
  131. mem = zone->present_pages >> (27 - PAGE_SHIFT);
  132. threshold = 2 * fls(num_online_cpus()) * (1 + fls(mem));
  133. /*
  134. * Maximum threshold is 125
  135. */
  136. threshold = min(125, threshold);
  137. return threshold;
  138. }
  139. /*
  140. * Refresh the thresholds for each zone.
  141. */
  142. static void refresh_zone_stat_thresholds(void)
  143. {
  144. struct zone *zone;
  145. int cpu;
  146. int threshold;
  147. for_each_zone(zone) {
  148. if (!zone->present_pages)
  149. continue;
  150. threshold = calculate_threshold(zone);
  151. for_each_online_cpu(cpu)
  152. zone_pcp(zone, cpu)->stat_threshold = threshold;
  153. }
  154. }
  155. /*
  156. * For use when we know that interrupts are disabled.
  157. */
  158. void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item,
  159. int delta)
  160. {
  161. struct per_cpu_pageset *pcp = zone_pcp(zone, smp_processor_id());
  162. s8 *p = pcp->vm_stat_diff + item;
  163. long x;
  164. x = delta + *p;
  165. if (unlikely(x > pcp->stat_threshold || x < -pcp->stat_threshold)) {
  166. zone_page_state_add(x, zone, item);
  167. x = 0;
  168. }
  169. *p = x;
  170. }
  171. EXPORT_SYMBOL(__mod_zone_page_state);
  172. /*
  173. * For an unknown interrupt state
  174. */
  175. void mod_zone_page_state(struct zone *zone, enum zone_stat_item item,
  176. int delta)
  177. {
  178. unsigned long flags;
  179. local_irq_save(flags);
  180. __mod_zone_page_state(zone, item, delta);
  181. local_irq_restore(flags);
  182. }
  183. EXPORT_SYMBOL(mod_zone_page_state);
  184. /*
  185. * Optimized increment and decrement functions.
  186. *
  187. * These are only for a single page and therefore can take a struct page *
  188. * argument instead of struct zone *. This allows the inclusion of the code
  189. * generated for page_zone(page) into the optimized functions.
  190. *
  191. * No overflow check is necessary and therefore the differential can be
  192. * incremented or decremented in place which may allow the compilers to
  193. * generate better code.
  194. * The increment or decrement is known and therefore one boundary check can
  195. * be omitted.
  196. *
  197. * NOTE: These functions are very performance sensitive. Change only
  198. * with care.
  199. *
  200. * Some processors have inc/dec instructions that are atomic vs an interrupt.
  201. * However, the code must first determine the differential location in a zone
  202. * based on the processor number and then inc/dec the counter. There is no
  203. * guarantee without disabling preemption that the processor will not change
  204. * in between and therefore the atomicity vs. interrupt cannot be exploited
  205. * in a useful way here.
  206. */
  207. static void __inc_zone_state(struct zone *zone, enum zone_stat_item item)
  208. {
  209. struct per_cpu_pageset *pcp = zone_pcp(zone, smp_processor_id());
  210. s8 *p = pcp->vm_stat_diff + item;
  211. (*p)++;
  212. if (unlikely(*p > pcp->stat_threshold)) {
  213. int overstep = pcp->stat_threshold / 2;
  214. zone_page_state_add(*p + overstep, zone, item);
  215. *p = -overstep;
  216. }
  217. }
  218. void __inc_zone_page_state(struct page *page, enum zone_stat_item item)
  219. {
  220. __inc_zone_state(page_zone(page), item);
  221. }
  222. EXPORT_SYMBOL(__inc_zone_page_state);
  223. void __dec_zone_page_state(struct page *page, enum zone_stat_item item)
  224. {
  225. struct zone *zone = page_zone(page);
  226. struct per_cpu_pageset *pcp = zone_pcp(zone, smp_processor_id());
  227. s8 *p = pcp->vm_stat_diff + item;
  228. (*p)--;
  229. if (unlikely(*p < - pcp->stat_threshold)) {
  230. int overstep = pcp->stat_threshold / 2;
  231. zone_page_state_add(*p - overstep, zone, item);
  232. *p = overstep;
  233. }
  234. }
  235. EXPORT_SYMBOL(__dec_zone_page_state);
  236. void inc_zone_state(struct zone *zone, enum zone_stat_item item)
  237. {
  238. unsigned long flags;
  239. local_irq_save(flags);
  240. __inc_zone_state(zone, item);
  241. local_irq_restore(flags);
  242. }
  243. void inc_zone_page_state(struct page *page, enum zone_stat_item item)
  244. {
  245. unsigned long flags;
  246. struct zone *zone;
  247. zone = page_zone(page);
  248. local_irq_save(flags);
  249. __inc_zone_state(zone, item);
  250. local_irq_restore(flags);
  251. }
  252. EXPORT_SYMBOL(inc_zone_page_state);
  253. void dec_zone_page_state(struct page *page, enum zone_stat_item item)
  254. {
  255. unsigned long flags;
  256. local_irq_save(flags);
  257. __dec_zone_page_state(page, item);
  258. local_irq_restore(flags);
  259. }
  260. EXPORT_SYMBOL(dec_zone_page_state);
  261. /*
  262. * Update the zone counters for one cpu.
  263. */
  264. void refresh_cpu_vm_stats(int cpu)
  265. {
  266. struct zone *zone;
  267. int i;
  268. unsigned long flags;
  269. for_each_zone(zone) {
  270. struct per_cpu_pageset *pcp;
  271. if (!populated_zone(zone))
  272. continue;
  273. pcp = zone_pcp(zone, cpu);
  274. for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
  275. if (pcp->vm_stat_diff[i]) {
  276. local_irq_save(flags);
  277. zone_page_state_add(pcp->vm_stat_diff[i],
  278. zone, i);
  279. pcp->vm_stat_diff[i] = 0;
  280. local_irq_restore(flags);
  281. }
  282. }
  283. }
  284. static void __refresh_cpu_vm_stats(void *dummy)
  285. {
  286. refresh_cpu_vm_stats(smp_processor_id());
  287. }
  288. /*
  289. * Consolidate all counters.
  290. *
  291. * Note that the result is less inaccurate but still inaccurate
  292. * if concurrent processes are allowed to run.
  293. */
  294. void refresh_vm_stats(void)
  295. {
  296. on_each_cpu(__refresh_cpu_vm_stats, NULL, 0, 1);
  297. }
  298. EXPORT_SYMBOL(refresh_vm_stats);
  299. #endif
  300. #ifdef CONFIG_NUMA
  301. /*
  302. * zonelist = the list of zones passed to the allocator
  303. * z = the zone from which the allocation occurred.
  304. *
  305. * Must be called with interrupts disabled.
  306. */
  307. void zone_statistics(struct zonelist *zonelist, struct zone *z)
  308. {
  309. if (z->zone_pgdat == zonelist->zones[0]->zone_pgdat) {
  310. __inc_zone_state(z, NUMA_HIT);
  311. } else {
  312. __inc_zone_state(z, NUMA_MISS);
  313. __inc_zone_state(zonelist->zones[0], NUMA_FOREIGN);
  314. }
  315. if (z->node == numa_node_id())
  316. __inc_zone_state(z, NUMA_LOCAL);
  317. else
  318. __inc_zone_state(z, NUMA_OTHER);
  319. }
  320. #endif
  321. #ifdef CONFIG_PROC_FS
  322. #include <linux/seq_file.h>
  323. static void *frag_start(struct seq_file *m, loff_t *pos)
  324. {
  325. pg_data_t *pgdat;
  326. loff_t node = *pos;
  327. for (pgdat = first_online_pgdat();
  328. pgdat && node;
  329. pgdat = next_online_pgdat(pgdat))
  330. --node;
  331. return pgdat;
  332. }
  333. static void *frag_next(struct seq_file *m, void *arg, loff_t *pos)
  334. {
  335. pg_data_t *pgdat = (pg_data_t *)arg;
  336. (*pos)++;
  337. return next_online_pgdat(pgdat);
  338. }
  339. static void frag_stop(struct seq_file *m, void *arg)
  340. {
  341. }
  342. /*
  343. * This walks the free areas for each zone.
  344. */
  345. static int frag_show(struct seq_file *m, void *arg)
  346. {
  347. pg_data_t *pgdat = (pg_data_t *)arg;
  348. struct zone *zone;
  349. struct zone *node_zones = pgdat->node_zones;
  350. unsigned long flags;
  351. int order;
  352. for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) {
  353. if (!populated_zone(zone))
  354. continue;
  355. spin_lock_irqsave(&zone->lock, flags);
  356. seq_printf(m, "Node %d, zone %8s ", pgdat->node_id, zone->name);
  357. for (order = 0; order < MAX_ORDER; ++order)
  358. seq_printf(m, "%6lu ", zone->free_area[order].nr_free);
  359. spin_unlock_irqrestore(&zone->lock, flags);
  360. seq_putc(m, '\n');
  361. }
  362. return 0;
  363. }
  364. struct seq_operations fragmentation_op = {
  365. .start = frag_start,
  366. .next = frag_next,
  367. .stop = frag_stop,
  368. .show = frag_show,
  369. };
  370. #ifdef CONFIG_ZONE_DMA32
  371. #define TEXT_FOR_DMA32(xx) xx "_dma32",
  372. #else
  373. #define TEXT_FOR_DMA32(xx)
  374. #endif
  375. #ifdef CONFIG_HIGHMEM
  376. #define TEXT_FOR_HIGHMEM(xx) xx "_high",
  377. #else
  378. #define TEXT_FOR_HIGHMEM(xx)
  379. #endif
  380. #define TEXTS_FOR_ZONES(xx) xx "_dma", TEXT_FOR_DMA32(xx) xx "_normal", \
  381. TEXT_FOR_HIGHMEM(xx)
  382. static char *vmstat_text[] = {
  383. /* Zoned VM counters */
  384. "nr_anon_pages",
  385. "nr_mapped",
  386. "nr_file_pages",
  387. "nr_slab_reclaimable",
  388. "nr_slab_unreclaimable",
  389. "nr_page_table_pages",
  390. "nr_dirty",
  391. "nr_writeback",
  392. "nr_unstable",
  393. "nr_bounce",
  394. "nr_vmscan_write",
  395. #ifdef CONFIG_NUMA
  396. "numa_hit",
  397. "numa_miss",
  398. "numa_foreign",
  399. "numa_interleave",
  400. "numa_local",
  401. "numa_other",
  402. #endif
  403. #ifdef CONFIG_VM_EVENT_COUNTERS
  404. "pgpgin",
  405. "pgpgout",
  406. "pswpin",
  407. "pswpout",
  408. TEXTS_FOR_ZONES("pgalloc")
  409. "pgfree",
  410. "pgactivate",
  411. "pgdeactivate",
  412. "pgfault",
  413. "pgmajfault",
  414. TEXTS_FOR_ZONES("pgrefill")
  415. TEXTS_FOR_ZONES("pgsteal")
  416. TEXTS_FOR_ZONES("pgscan_kswapd")
  417. TEXTS_FOR_ZONES("pgscan_direct")
  418. "pginodesteal",
  419. "slabs_scanned",
  420. "kswapd_steal",
  421. "kswapd_inodesteal",
  422. "pageoutrun",
  423. "allocstall",
  424. "pgrotated",
  425. #endif
  426. };
  427. /*
  428. * Output information about zones in @pgdat.
  429. */
  430. static int zoneinfo_show(struct seq_file *m, void *arg)
  431. {
  432. pg_data_t *pgdat = arg;
  433. struct zone *zone;
  434. struct zone *node_zones = pgdat->node_zones;
  435. unsigned long flags;
  436. for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; zone++) {
  437. int i;
  438. if (!populated_zone(zone))
  439. continue;
  440. spin_lock_irqsave(&zone->lock, flags);
  441. seq_printf(m, "Node %d, zone %8s", pgdat->node_id, zone->name);
  442. seq_printf(m,
  443. "\n pages free %lu"
  444. "\n min %lu"
  445. "\n low %lu"
  446. "\n high %lu"
  447. "\n active %lu"
  448. "\n inactive %lu"
  449. "\n scanned %lu (a: %lu i: %lu)"
  450. "\n spanned %lu"
  451. "\n present %lu",
  452. zone->free_pages,
  453. zone->pages_min,
  454. zone->pages_low,
  455. zone->pages_high,
  456. zone->nr_active,
  457. zone->nr_inactive,
  458. zone->pages_scanned,
  459. zone->nr_scan_active, zone->nr_scan_inactive,
  460. zone->spanned_pages,
  461. zone->present_pages);
  462. for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
  463. seq_printf(m, "\n %-12s %lu", vmstat_text[i],
  464. zone_page_state(zone, i));
  465. seq_printf(m,
  466. "\n protection: (%lu",
  467. zone->lowmem_reserve[0]);
  468. for (i = 1; i < ARRAY_SIZE(zone->lowmem_reserve); i++)
  469. seq_printf(m, ", %lu", zone->lowmem_reserve[i]);
  470. seq_printf(m,
  471. ")"
  472. "\n pagesets");
  473. for_each_online_cpu(i) {
  474. struct per_cpu_pageset *pageset;
  475. int j;
  476. pageset = zone_pcp(zone, i);
  477. for (j = 0; j < ARRAY_SIZE(pageset->pcp); j++) {
  478. if (pageset->pcp[j].count)
  479. break;
  480. }
  481. if (j == ARRAY_SIZE(pageset->pcp))
  482. continue;
  483. for (j = 0; j < ARRAY_SIZE(pageset->pcp); j++) {
  484. seq_printf(m,
  485. "\n cpu: %i pcp: %i"
  486. "\n count: %i"
  487. "\n high: %i"
  488. "\n batch: %i",
  489. i, j,
  490. pageset->pcp[j].count,
  491. pageset->pcp[j].high,
  492. pageset->pcp[j].batch);
  493. }
  494. #ifdef CONFIG_SMP
  495. seq_printf(m, "\n vm stats threshold: %d",
  496. pageset->stat_threshold);
  497. #endif
  498. }
  499. seq_printf(m,
  500. "\n all_unreclaimable: %u"
  501. "\n prev_priority: %i"
  502. "\n temp_priority: %i"
  503. "\n start_pfn: %lu",
  504. zone->all_unreclaimable,
  505. zone->prev_priority,
  506. zone->temp_priority,
  507. zone->zone_start_pfn);
  508. spin_unlock_irqrestore(&zone->lock, flags);
  509. seq_putc(m, '\n');
  510. }
  511. return 0;
  512. }
  513. struct seq_operations zoneinfo_op = {
  514. .start = frag_start, /* iterate over all zones. The same as in
  515. * fragmentation. */
  516. .next = frag_next,
  517. .stop = frag_stop,
  518. .show = zoneinfo_show,
  519. };
  520. static void *vmstat_start(struct seq_file *m, loff_t *pos)
  521. {
  522. unsigned long *v;
  523. #ifdef CONFIG_VM_EVENT_COUNTERS
  524. unsigned long *e;
  525. #endif
  526. int i;
  527. if (*pos >= ARRAY_SIZE(vmstat_text))
  528. return NULL;
  529. #ifdef CONFIG_VM_EVENT_COUNTERS
  530. v = kmalloc(NR_VM_ZONE_STAT_ITEMS * sizeof(unsigned long)
  531. + sizeof(struct vm_event_state), GFP_KERNEL);
  532. #else
  533. v = kmalloc(NR_VM_ZONE_STAT_ITEMS * sizeof(unsigned long),
  534. GFP_KERNEL);
  535. #endif
  536. m->private = v;
  537. if (!v)
  538. return ERR_PTR(-ENOMEM);
  539. for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
  540. v[i] = global_page_state(i);
  541. #ifdef CONFIG_VM_EVENT_COUNTERS
  542. e = v + NR_VM_ZONE_STAT_ITEMS;
  543. all_vm_events(e);
  544. e[PGPGIN] /= 2; /* sectors -> kbytes */
  545. e[PGPGOUT] /= 2;
  546. #endif
  547. return v + *pos;
  548. }
  549. static void *vmstat_next(struct seq_file *m, void *arg, loff_t *pos)
  550. {
  551. (*pos)++;
  552. if (*pos >= ARRAY_SIZE(vmstat_text))
  553. return NULL;
  554. return (unsigned long *)m->private + *pos;
  555. }
  556. static int vmstat_show(struct seq_file *m, void *arg)
  557. {
  558. unsigned long *l = arg;
  559. unsigned long off = l - (unsigned long *)m->private;
  560. seq_printf(m, "%s %lu\n", vmstat_text[off], *l);
  561. return 0;
  562. }
  563. static void vmstat_stop(struct seq_file *m, void *arg)
  564. {
  565. kfree(m->private);
  566. m->private = NULL;
  567. }
  568. struct seq_operations vmstat_op = {
  569. .start = vmstat_start,
  570. .next = vmstat_next,
  571. .stop = vmstat_stop,
  572. .show = vmstat_show,
  573. };
  574. #endif /* CONFIG_PROC_FS */
  575. #ifdef CONFIG_SMP
  576. /*
  577. * Use the cpu notifier to insure that the thresholds are recalculated
  578. * when necessary.
  579. */
  580. static int __cpuinit vmstat_cpuup_callback(struct notifier_block *nfb,
  581. unsigned long action,
  582. void *hcpu)
  583. {
  584. switch (action) {
  585. case CPU_UP_PREPARE:
  586. case CPU_UP_CANCELED:
  587. case CPU_DEAD:
  588. refresh_zone_stat_thresholds();
  589. break;
  590. default:
  591. break;
  592. }
  593. return NOTIFY_OK;
  594. }
  595. static struct notifier_block __cpuinitdata vmstat_notifier =
  596. { &vmstat_cpuup_callback, NULL, 0 };
  597. int __init setup_vmstat(void)
  598. {
  599. refresh_zone_stat_thresholds();
  600. register_cpu_notifier(&vmstat_notifier);
  601. return 0;
  602. }
  603. module_init(setup_vmstat)
  604. #endif