[PATCH 1/2] mm/slob: Mark zone page state to get slab usage at /proc/meminfo

From: Ezequiel Garcia
Date: Mon Oct 22 2012 - 08:04:13 EST

On page allocations, SLAB and SLUB modify zone page state counters
This allows to obtain slab usage information at /proc/meminfo.

Without this patch, /proc/meminfo will show zero Slab usage for SLOB.

Since SLOB discards SLAB_RECLAIM_ACCOUNT flag, we always use
NR_SLAB_UNRECLAIMABLE zone state item.

Cc: Christoph Lameter <cl@xxxxxxxxxxxxxxxxxxxx>
Cc: Pekka Enberg <penberg@xxxxxxxxxx>
Cc: Matt Mackall <mpm@xxxxxxxxxxx>
Signed-off-by: Ezequiel Garcia <elezegarcia@xxxxxxxxx>
mm/slob.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/mm/slob.c b/mm/slob.c
index fffbc82..a65e802 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -320,6 +320,9 @@ static void *slob_alloc(size_t size, gfp_t gfp, int align, int node)
sp = virt_to_page(b);

+ /* Slob allocations are never flagged reclaimable */
+ inc_zone_page_state(sp, NR_SLAB_UNRECLAIMABLE);
spin_lock_irqsave(&slob_lock, flags);
sp->units = SLOB_UNITS(PAGE_SIZE);
sp->freelist = b;
@@ -361,6 +364,9 @@ static void slob_free(void *block, int size)
spin_unlock_irqrestore(&slob_lock, flags);
+ dec_zone_page_state(sp, NR_SLAB_UNRECLAIMABLE);
slob_free_pages(b, 0);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/