~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/lib/show_mem.c

Version: ~ [ linux-5.5 ] ~ [ linux-5.4.15 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.98 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.167 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.211 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.211 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.81 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Generic show_mem() implementation
  3  *
  4  * Copyright (C) 2008 Johannes Weiner <hannes@saeurebad.de>
  5  * All code subject to the GPL version 2.
  6  */
  7 
  8 #include <linux/mm.h>
  9 #include <linux/nmi.h>
 10 #include <linux/quicklist.h>
 11 
 12 void show_mem(unsigned int filter)
 13 {
 14         pg_data_t *pgdat;
 15         unsigned long total = 0, reserved = 0, shared = 0,
 16                 nonshared = 0, highmem = 0;
 17 
 18         printk("Mem-Info:\n");
 19         show_free_areas(filter);
 20 
 21         for_each_online_pgdat(pgdat) {
 22                 unsigned long i, flags;
 23 
 24                 pgdat_resize_lock(pgdat, &flags);
 25                 for (i = 0; i < pgdat->node_spanned_pages; i++) {
 26                         struct page *page;
 27                         unsigned long pfn = pgdat->node_start_pfn + i;
 28 
 29                         if (unlikely(!(i % MAX_ORDER_NR_PAGES)))
 30                                 touch_nmi_watchdog();
 31 
 32                         if (!pfn_valid(pfn))
 33                                 continue;
 34 
 35                         page = pfn_to_page(pfn);
 36 
 37                         if (PageHighMem(page))
 38                                 highmem++;
 39 
 40                         if (PageReserved(page))
 41                                 reserved++;
 42                         else if (page_count(page) == 1)
 43                                 nonshared++;
 44                         else if (page_count(page) > 1)
 45                                 shared += page_count(page) - 1;
 46 
 47                         total++;
 48                 }
 49                 pgdat_resize_unlock(pgdat, &flags);
 50         }
 51 
 52         printk("%lu pages RAM\n", total);
 53 #ifdef CONFIG_HIGHMEM
 54         printk("%lu pages HighMem\n", highmem);
 55 #endif
 56         printk("%lu pages reserved\n", reserved);
 57         printk("%lu pages shared\n", shared);
 58         printk("%lu pages non-shared\n", nonshared);
 59 #ifdef CONFIG_QUICKLIST
 60         printk("%lu pages in pagetable cache\n",
 61                 quicklist_total_size());
 62 #endif
 63 }
 64 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp