Skip to contentSkip to conversation

optimise struct page layout

PATCH In review Andrew Morton 1 participant 1 message Jul 28, 2002 MM core

lore
Share & tools
lore
#0 lore raw

PATCH 6/13 optimise struct page layout

Reorganise the members of struct page.

- Place ->flags at the start so the compiler can generate indirect addressing rather than indirect+indexed for this commonly-accessed field. Shrinks the kernel by ~100 bytes.

- Keep ->count with ->flags so they have the best chance of being in the same cacheline.

 mm.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~page-reorg +3 -3
@@ -149,12 +149,12 @@ struct pte_chain;
  * TODO: make this structure smaller, it could be as small as 32 bytes.
  */
 struct page {
+	unsigned long flags;		/* atomic flags, some possibly
+					   updated asynchronously */
+	atomic_t count;			/* Usage count, see below. */
 	struct list_head list;		/* ->mapping has some page lists. */
 	struct address_space *mapping;	/* The inode (or ...) we belong to. */
 	unsigned long index;		/* Our offset within mapping. */
-	atomic_t count;			/* Usage count, see below. */
-	unsigned long flags;		/* atomic flags, some possibly
-					   updated asynchronously */
 	struct list_head lru;		/* Pageout list, eg. active_list;
 					   protected by pagemap_lru_lock !! */
 	union {

.