linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Andrew Morton <akpm@digeo.com>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] nr_slab accounting fix
Date: Sat, 29 Nov 2003 15:03:06 +0100	[thread overview]
Message-ID: <3FC8A71A.6050101@colorfullife.com> (raw)

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

                 reply	other threads:[~2003-11-29 14:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3FC8A71A.6050101@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    /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).