linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nr_slab accounting fix
@ 2003-11-29 14:03 Manfred Spraul
  0 siblings, 0 replies; only message in thread
From: Manfred Spraul @ 2003-11-29 14:03 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 263 bytes --]

Hi Andrew,

if alloc_slabmgmt fails, then kmem_freepages() calls sub_page_state(), 
altough nr_slab was not yet increased. The attached patch fixes that by 
moving the inc_page_state into kmem_getpages().
Could you add it to your next -mm kernel?

--
    Manfred

[-- Attachment #2: patch-slab-counter --]
[-- Type: text/plain, Size: 1003 bytes --]

// $Header$
// Kernel Version:
//  VERSION = 2
//  PATCHLEVEL = 6
//  SUBLEVEL = 0
//  EXTRAVERSION = -test11
--- 2.6/mm/slab.c	2003-11-29 09:46:35.000000000 +0100
+++ build-2.6/mm/slab.c	2003-11-29 14:50:06.000000000 +0100
@@ -812,6 +812,7 @@
 		int i = (1 << cachep->gfporder);
 		struct page *page = virt_to_page(addr);
 
+		add_page_state(nr_slab, i);
 		while (i--) {
 			SetPageSlab(page);
 			page++;
@@ -1608,7 +1609,6 @@
 	do {
 		SET_PAGE_CACHE(page, cachep);
 		SET_PAGE_SLAB(page, slabp);
-		inc_page_state(nr_slab);
 		page++;
 	} while (--i);
 
--- 2.6/include/linux/page-flags.h	2003-10-25 20:44:06.000000000 +0200
+++ build-2.6/include/linux/page-flags.h	2003-11-29 14:45:57.000000000 +0100
@@ -133,6 +133,7 @@
 
 #define inc_page_state(member)	mod_page_state(member, 1UL)
 #define dec_page_state(member)	mod_page_state(member, 0UL - 1)
+#define add_page_state(member,delta) mod_page_state(member, (delta))
 #define sub_page_state(member,delta) mod_page_state(member, 0UL - (delta))
 
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-11-29 14:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-29 14:03 [PATCH] nr_slab accounting fix Manfred Spraul

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).