Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

SLUB: Do our own flags based on PG_active and PG_error

The atomicity when handling flags in SLUB is not necessary since both flags
used by SLUB are not updated in a racy way. Flag updates are either done
during slab creation or destruction or under slab_lock. Some of these flags
do not have the non atomic variants that we need. So define our own.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Christoph Lameter and committed by
Linus Torvalds
5577bd8a eefaca9c

+14 -14
+14 -14
mm/slub.c
··· 99 99 * the fast path and disables lockless freelists. 100 100 */ 101 101 102 + #define FROZEN (1 << PG_active) 103 + 104 + #ifdef CONFIG_SLUB_DEBUG 105 + #define SLABDEBUG (1 << PG_error) 106 + #else 107 + #define SLABDEBUG 0 108 + #endif 109 + 102 110 static inline int SlabFrozen(struct page *page) 103 111 { 104 - return PageActive(page); 112 + return page->flags & FROZEN; 105 113 } 106 114 107 115 static inline void SetSlabFrozen(struct page *page) 108 116 { 109 - SetPageActive(page); 117 + page->flags |= FROZEN; 110 118 } 111 119 112 120 static inline void ClearSlabFrozen(struct page *page) 113 121 { 114 - ClearPageActive(page); 122 + page->flags &= ~FROZEN; 115 123 } 116 124 117 125 static inline int SlabDebug(struct page *page) 118 126 { 119 - #ifdef CONFIG_SLUB_DEBUG 120 - return PageError(page); 121 - #else 122 - return 0; 123 - #endif 127 + return page->flags & SLABDEBUG; 124 128 } 125 129 126 130 static inline void SetSlabDebug(struct page *page) 127 131 { 128 - #ifdef CONFIG_SLUB_DEBUG 129 - SetPageError(page); 130 - #endif 132 + page->flags |= SLABDEBUG; 131 133 } 132 134 133 135 static inline void ClearSlabDebug(struct page *page) 134 136 { 135 - #ifdef CONFIG_SLUB_DEBUG 136 - ClearPageError(page); 137 - #endif 137 + page->flags &= ~SLABDEBUG; 138 138 } 139 139 140 140 /*