Skip to content

Commit

Permalink
slob: record page flag overlays explicitly
Browse files Browse the repository at this point in the history
SLOB reuses two page bits for internal purposes, it overlays PG_active and
PG_private.  This is hidden away in slob.c.  Document these overlays
explicitly in the main page-flags enum along with all the others.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
awhitcroft authored and torvalds committed Jul 24, 2008
1 parent 8a38082 commit 9023cb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions include/linux/page-flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ enum pageflags {
PG_pinned = PG_owner_priv_1,
PG_savepinned = PG_dirty,

/* SLOB */
PG_slob_page = PG_active,
PG_slob_free = PG_private,

/* SLUB */
PG_slub_frozen = PG_active,
PG_slub_debug = PG_error,
Expand Down Expand Up @@ -173,6 +177,9 @@ PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
__SETPAGEFLAG(Private, private)

__PAGEFLAG(SlobPage, slob_page)
__PAGEFLAG(SlobFree, slob_free)

__PAGEFLAG(SlubFrozen, slub_frozen)
__PAGEFLAG(SlubDebug, slub_debug)

Expand Down
12 changes: 6 additions & 6 deletions mm/slob.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,37 +130,37 @@ static LIST_HEAD(free_slob_large);
*/
static inline int slob_page(struct slob_page *sp)
{
return test_bit(PG_active, &sp->flags);
return PageSlobPage((struct page *)sp);
}

static inline void set_slob_page(struct slob_page *sp)
{
__set_bit(PG_active, &sp->flags);
__SetPageSlobPage((struct page *)sp);
}

static inline void clear_slob_page(struct slob_page *sp)
{
__clear_bit(PG_active, &sp->flags);
__ClearPageSlobPage((struct page *)sp);
}

/*
* slob_page_free: true for pages on free_slob_pages list.
*/
static inline int slob_page_free(struct slob_page *sp)
{
return test_bit(PG_private, &sp->flags);
return PageSlobFree((struct page *)sp);
}

static void set_slob_page_free(struct slob_page *sp, struct list_head *list)
{
list_add(&sp->list, list);
__set_bit(PG_private, &sp->flags);
__SetPageSlobFree((struct page *)sp);
}

static inline void clear_slob_page_free(struct slob_page *sp)
{
list_del(&sp->list);
__clear_bit(PG_private, &sp->flags);
__ClearPageSlobFree((struct page *)sp);
}

#define SLOB_UNIT sizeof(slob_t)
Expand Down

0 comments on commit 9023cb7

Please sign in to comment.