linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ezequiel Garcia <elezegarcia@gmail.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Tim Bird <tim.bird@am.sony.com>,
	Ezequiel Garcia <elezegarcia@gmail.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>, Matt Mackall <mpm@selenic.com>
Subject: [PATCH 1/2] mm/slob: Mark zone page state to get slab usage at /proc/meminfo
Date: Mon, 22 Oct 2012 09:03:54 -0300	[thread overview]
Message-ID: <1350907434-2202-1-git-send-email-elezegarcia@gmail.com> (raw)

On page allocations, SLAB and SLUB modify zone page state counters
NR_SLAB_UNRECLAIMABLE or NR_SLAB_RECLAIMABLE.
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@linux-foundation.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
---
 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);
 		__SetPageSlab(sp);
 
+		/* 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)
 			clear_slob_page_free(sp);
 		spin_unlock_irqrestore(&slob_lock, flags);
 		__ClearPageSlab(sp);
+
+		dec_zone_page_state(sp, NR_SLAB_UNRECLAIMABLE);
+
 		reset_page_mapcount(sp);
 		slob_free_pages(b, 0);
 		return;
-- 
1.7.8.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2012-10-22 12:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 12:03 Ezequiel Garcia [this message]
2012-10-22 14:41 ` [PATCH 1/2] mm/slob: Mark zone page state to get slab usage at /proc/meminfo Christoph Lameter
2012-10-22 14:50   ` Ezequiel Garcia
2012-10-22 17:14   ` Ezequiel Garcia
2012-10-23 18:15     ` Christoph Lameter
2012-10-23 18:43       ` Ezequiel Garcia
2012-10-23 20:31         ` Christoph Lameter
2012-10-23 21:01           ` Tim Bird
2012-10-23 21:34             ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1350907434-2202-1-git-send-email-elezegarcia@gmail.com \
    --to=elezegarcia@gmail.com \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    --cc=penberg@kernel.org \
    --cc=tim.bird@am.sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).