Commit a854c11b authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] 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.
parent ab35295d
...@@ -149,12 +149,12 @@ struct pte_chain; ...@@ -149,12 +149,12 @@ struct pte_chain;
* TODO: make this structure smaller, it could be as small as 32 bytes. * TODO: make this structure smaller, it could be as small as 32 bytes.
*/ */
struct page { 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 list_head list; /* ->mapping has some page lists. */
struct address_space *mapping; /* The inode (or ...) we belong to. */ struct address_space *mapping; /* The inode (or ...) we belong to. */
unsigned long index; /* Our offset within mapping. */ 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; struct list_head lru; /* Pageout list, eg. active_list;
protected by pagemap_lru_lock !! */ protected by pagemap_lru_lock !! */
union { union {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment