]> Git Repo - linux.git/commitdiff
mm: rearrange vm_area_struct for fewer cache misses
authorRik van Riel <[email protected]>
Wed, 12 Dec 2012 00:01:44 +0000 (16:01 -0800)
committerLinus Torvalds <[email protected]>
Wed, 12 Dec 2012 01:22:25 +0000 (17:22 -0800)
The kernel walks the VMA rbtree in various places, including the page
fault path.  However, the vm_rb node spanned two cache lines, on 64 bit
systems with 64 byte cache lines (most x86 systems).

Rearrange vm_area_struct a little, so all the information we need to do a
VMA tree walk is in the first cache line.

[[email protected]: checkpatch fixes]
Signed-off-by: Michel Lespinasse <[email protected]>
Signed-off-by: Rik van Riel <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Russell King <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Paul Mundt <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/mm_types.h

index 94fa52b28ee87ae9e0970aa861f1ad4f570baf6d..7ade2731b5d6d87fc0bde9a551bc15b71d449300 100644 (file)
@@ -224,7 +224,8 @@ struct vm_region {
  * library, the executable area etc).
  */
 struct vm_area_struct {
-       struct mm_struct * vm_mm;       /* The address space we belong to. */
+       /* The first cache line has the info for VMA tree walking. */
+
        unsigned long vm_start;         /* Our start address within vm_mm. */
        unsigned long vm_end;           /* The first byte after our end address
                                           within vm_mm. */
@@ -232,9 +233,6 @@ struct vm_area_struct {
        /* linked list of VM areas per task, sorted by address */
        struct vm_area_struct *vm_next, *vm_prev;
 
-       pgprot_t vm_page_prot;          /* Access permissions of this VMA. */
-       unsigned long vm_flags;         /* Flags, see mm.h. */
-
        struct rb_node vm_rb;
 
        /*
@@ -245,6 +243,12 @@ struct vm_area_struct {
         */
        unsigned long rb_subtree_gap;
 
+       /* Second cache line starts here. */
+
+       struct mm_struct *vm_mm;        /* The address space we belong to. */
+       pgprot_t vm_page_prot;          /* Access permissions of this VMA. */
+       unsigned long vm_flags;         /* Flags, see mm.h. */
+
        /*
         * For areas with an address space and backing store,
         * linkage into the address_space->i_mmap interval tree, or
This page took 0.046147 seconds and 4 git commands to generate.