Skip to content

Commit 5577bd8

Browse files
Christoph LameterLinus Torvalds
authored andcommitted
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>
1 parent eefaca9 commit 5577bd8

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎mm/slub.c‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -99,42 +99,42 @@
9999
* the fast path and disables lockless freelists.
100100
*/
101101

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+
102110
static inline int SlabFrozen(struct page *page)
103111
{
104-
return PageActive(page);
112+
return page->flags & FROZEN;
105113
}
106114

107115
static inline void SetSlabFrozen(struct page *page)
108116
{
109-
SetPageActive(page);
117+
page->flags |= FROZEN;
110118
}
111119

112120
static inline void ClearSlabFrozen(struct page *page)
113121
{
114-
ClearPageActive(page);
122+
page->flags &= ~FROZEN;
115123
}
116124

117125
static inline int SlabDebug(struct page *page)
118126
{
119-
#ifdef CONFIG_SLUB_DEBUG
120-
return PageError(page);
121-
#else
122-
return 0;
123-
#endif
127+
return page->flags & SLABDEBUG;
124128
}
125129

126130
static inline void SetSlabDebug(struct page *page)
127131
{
128-
#ifdef CONFIG_SLUB_DEBUG
129-
SetPageError(page);
130-
#endif
132+
page->flags |= SLABDEBUG;
131133
}
132134

133135
static inline void ClearSlabDebug(struct page *page)
134136
{
135-
#ifdef CONFIG_SLUB_DEBUG
136-
ClearPageError(page);
137-
#endif
137+
page->flags &= ~SLABDEBUG;
138138
}
139139

140140
/*

0 commit comments

Comments
 (0)