Commit 6b27052e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Add /proc/meminfo:Slab

Display the total slab memory in /proc/meminfo.  Handy while we play
with the slab pruning code.

This info is also available via /proc/slabinfo, but I think this
convenience is worth the extra few lines.
parent 1b4623d6
...@@ -171,6 +171,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, ...@@ -171,6 +171,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
"Dirty: %8lu kB\n" "Dirty: %8lu kB\n"
"Writeback: %8lu kB\n" "Writeback: %8lu kB\n"
"Mapped: %8lu kB\n" "Mapped: %8lu kB\n"
"Slab: %8lu kB\n"
"Committed_AS: %8u kB\n" "Committed_AS: %8u kB\n"
"PageTables: %8lu kB\n" "PageTables: %8lu kB\n"
"ReverseMaps: %8lu\n", "ReverseMaps: %8lu\n",
...@@ -191,6 +192,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, ...@@ -191,6 +192,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
K(ps.nr_dirty), K(ps.nr_dirty),
K(ps.nr_writeback), K(ps.nr_writeback),
K(ps.nr_mapped), K(ps.nr_mapped),
K(ps.nr_slab),
K(committed), K(committed),
K(ps.nr_page_table_pages), K(ps.nr_page_table_pages),
ps.nr_reverse_maps ps.nr_reverse_maps
......
...@@ -79,6 +79,7 @@ extern struct page_state { ...@@ -79,6 +79,7 @@ extern struct page_state {
unsigned long nr_page_table_pages; unsigned long nr_page_table_pages;
unsigned long nr_reverse_maps; unsigned long nr_reverse_maps;
unsigned long nr_mapped; unsigned long nr_mapped;
unsigned long nr_slab;
} ____cacheline_aligned_in_smp page_states[NR_CPUS]; } ____cacheline_aligned_in_smp page_states[NR_CPUS];
extern void get_page_state(struct page_state *ret); extern void get_page_state(struct page_state *ret);
......
...@@ -563,6 +563,7 @@ void get_page_state(struct page_state *ret) ...@@ -563,6 +563,7 @@ void get_page_state(struct page_state *ret)
ret->nr_page_table_pages += ps->nr_page_table_pages; ret->nr_page_table_pages += ps->nr_page_table_pages;
ret->nr_reverse_maps += ps->nr_reverse_maps; ret->nr_reverse_maps += ps->nr_reverse_maps;
ret->nr_mapped += ps->nr_mapped; ret->nr_mapped += ps->nr_mapped;
ret->nr_slab += ps->nr_slab;
} }
} }
......
...@@ -545,6 +545,7 @@ static inline void kmem_freepages (kmem_cache_t *cachep, void *addr) ...@@ -545,6 +545,7 @@ static inline void kmem_freepages (kmem_cache_t *cachep, void *addr)
*/ */
while (i--) { while (i--) {
ClearPageSlab(page); ClearPageSlab(page);
dec_page_state(nr_slab);
page++; page++;
} }
free_pages((unsigned long)addr, cachep->gfporder); free_pages((unsigned long)addr, cachep->gfporder);
...@@ -1203,6 +1204,7 @@ static int kmem_cache_grow (kmem_cache_t * cachep, int flags) ...@@ -1203,6 +1204,7 @@ static int kmem_cache_grow (kmem_cache_t * cachep, int flags)
SET_PAGE_CACHE(page, cachep); SET_PAGE_CACHE(page, cachep);
SET_PAGE_SLAB(page, slabp); SET_PAGE_SLAB(page, slabp);
SetPageSlab(page); SetPageSlab(page);
inc_page_state(nr_slab);
page++; page++;
} while (--i); } while (--i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment