Skip to content

Commit

Permalink
SLUB: Do our own flags based on PG_active and PG_error
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed May 17, 2007
1 parent eefaca9 commit 5577bd8
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,42 +99,42 @@
* the fast path and disables lockless freelists.
*/

#define FROZEN (1 << PG_active)

#ifdef CONFIG_SLUB_DEBUG
#define SLABDEBUG (1 << PG_error)
#else
#define SLABDEBUG 0
#endif

static inline int SlabFrozen(struct page *page)
{
return PageActive(page);
return page->flags & FROZEN;
}

static inline void SetSlabFrozen(struct page *page)
{
SetPageActive(page);
page->flags |= FROZEN;
}

static inline void ClearSlabFrozen(struct page *page)
{
ClearPageActive(page);
page->flags &= ~FROZEN;
}

static inline int SlabDebug(struct page *page)
{
#ifdef CONFIG_SLUB_DEBUG
return PageError(page);
#else
return 0;
#endif
return page->flags & SLABDEBUG;
}

static inline void SetSlabDebug(struct page *page)
{
#ifdef CONFIG_SLUB_DEBUG
SetPageError(page);
#endif
page->flags |= SLABDEBUG;
}

static inline void ClearSlabDebug(struct page *page)
{
#ifdef CONFIG_SLUB_DEBUG
ClearPageError(page);
#endif
page->flags &= ~SLABDEBUG;
}

/*
Expand Down

0 comments on commit 5577bd8

Please sign in to comment.