[PATCH] mm: slab less atomics
authorNick Piggin <npiggin@suse.de>
Wed, 22 Mar 2006 08:08:02 +0000 (00:08 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 22 Mar 2006 15:53:57 +0000 (07:53 -0800)
Atomic operation removal from slab

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/page-flags.h
mm/slab.c

index 76c7ffdd0424b27ffa6fea071d7b8567f765af3c..8cef69d462f2dee81e076b57ffc3a651138d92a0 100644 (file)
@@ -250,10 +250,8 @@ extern void __mod_page_state_offset(unsigned long offset, unsigned long delta);
 #define __ClearPageActive(page)        __clear_bit(PG_active, &(page)->flags)
 
 #define PageSlab(page)         test_bit(PG_slab, &(page)->flags)
-#define SetPageSlab(page)      set_bit(PG_slab, &(page)->flags)
-#define ClearPageSlab(page)    clear_bit(PG_slab, &(page)->flags)
-#define TestClearPageSlab(page)        test_and_clear_bit(PG_slab, &(page)->flags)
-#define TestSetPageSlab(page)  test_and_set_bit(PG_slab, &(page)->flags)
+#define __SetPageSlab(page)    __set_bit(PG_slab, &(page)->flags)
+#define __ClearPageSlab(page)  __clear_bit(PG_slab, &(page)->flags)
 
 #ifdef CONFIG_HIGHMEM
 #define PageHighMem(page)      is_highmem(page_zone(page))
index d0bd7f07ab041d3d7da06c5cec610035c3058b33..5988adf010c56aa6b4dc8247dd3f8002d3cb4718 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1402,7 +1402,7 @@ static void *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, int nodeid)
                atomic_add(i, &slab_reclaim_pages);
        add_page_state(nr_slab, i);
        while (i--) {
-               SetPageSlab(page);
+               __SetPageSlab(page);
                page++;
        }
        return addr;
@@ -1418,8 +1418,8 @@ static void kmem_freepages(struct kmem_cache *cachep, void *addr)
        const unsigned long nr_freed = i;
 
        while (i--) {
-               if (!TestClearPageSlab(page))
-                       BUG();
+               BUG_ON(!PageSlab(page));
+               __ClearPageSlab(page);
                page++;
        }
        sub_page_state(nr_slab, nr_freed);