diff options
| author | Andrew Morton <akpm@digeo.com> | 2002-09-17 06:36:15 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-09-17 06:36:15 -0700 |
| commit | 6b27052e83de6ca55c64571852588c2cd59e401a (patch) | |
| tree | 6dce6ee536ee8c4350fc3a10ecdee77cc6b1bc39 | |
| parent | 1b4623d6a346e8cac9089f9242e12565fde59eff (diff) | |
[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.
| -rw-r--r-- | fs/proc/proc_misc.c | 2 | ||||
| -rw-r--r-- | include/linux/page-flags.h | 1 | ||||
| -rw-r--r-- | mm/page_alloc.c | 1 | ||||
| -rw-r--r-- | mm/slab.c | 2 |
4 files changed, 6 insertions, 0 deletions
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index e2e4c62c2810..cb4a7bb6df98 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c @@ -171,6 +171,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, "Dirty: %8lu kB\n" "Writeback: %8lu kB\n" "Mapped: %8lu kB\n" + "Slab: %8lu kB\n" "Committed_AS: %8u kB\n" "PageTables: %8lu kB\n" "ReverseMaps: %8lu\n", @@ -191,6 +192,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, K(ps.nr_dirty), K(ps.nr_writeback), K(ps.nr_mapped), + K(ps.nr_slab), K(committed), K(ps.nr_page_table_pages), ps.nr_reverse_maps diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6475e261f609..5a4208b4651f 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -79,6 +79,7 @@ extern struct page_state { unsigned long nr_page_table_pages; unsigned long nr_reverse_maps; unsigned long nr_mapped; + unsigned long nr_slab; } ____cacheline_aligned_in_smp page_states[NR_CPUS]; extern void get_page_state(struct page_state *ret); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a54548bbf27b..a806031113fc 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -563,6 +563,7 @@ void get_page_state(struct page_state *ret) ret->nr_page_table_pages += ps->nr_page_table_pages; ret->nr_reverse_maps += ps->nr_reverse_maps; ret->nr_mapped += ps->nr_mapped; + ret->nr_slab += ps->nr_slab; } } diff --git a/mm/slab.c b/mm/slab.c index da75d9e11523..dd5466085362 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -545,6 +545,7 @@ static inline void kmem_freepages (kmem_cache_t *cachep, void *addr) */ while (i--) { ClearPageSlab(page); + dec_page_state(nr_slab); page++; } free_pages((unsigned long)addr, cachep->gfporder); @@ -1203,6 +1204,7 @@ static int kmem_cache_grow (kmem_cache_t * cachep, int flags) SET_PAGE_CACHE(page, cachep); SET_PAGE_SLAB(page, slabp); SetPageSlab(page); + inc_page_state(nr_slab); page++; } while (--i); |
