From patchwork Mon Nov 5 22:47:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 197353 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DDAC72C0079 for ; Tue, 6 Nov 2012 09:52:36 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933360Ab2KEWwC (ORCPT ); Mon, 5 Nov 2012 17:52:02 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:62839 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752913Ab2KEWri (ORCPT ); Mon, 5 Nov 2012 17:47:38 -0500 Received: by mail-pa0-f46.google.com with SMTP id hz1so4267306pad.19 for ; Mon, 05 Nov 2012 14:47:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=MmZBvAZ8R6CEAUMH2jIGq9KZ0gS9h9ZgLFITMeaJ3lI=; b=knaWkilGY9qla69FBMidzUkpi8P8gOP7wiFkSK0gfFWK+C/yM85qYLkJqe0ys8PG7u I+Mk1o0B/jH0/AT4HKYkN12ZtO75eYAEX8OPOlwOoYtBvZwkCQrHDV4yRtlAUvDu40s2 9WB2gQVSYQfc17xbKKgc5dWRkhwKHgwzuWEB6KRAGgExsK/cHMnK+4estLn7bE37PLsq 6/t6D2O/iKZ/7E/emJnj09ZRNL9xu6LCx9jYGHL3ibVDv0nfoGkVfa0H2CTb4ift4NGC o3x5YDQQOmchJ/72FyH2e6X5VNl9Eac+KovaZQR/DI1QCeVq5m+A8g76PfigE0dP7oJz 0ucQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=MmZBvAZ8R6CEAUMH2jIGq9KZ0gS9h9ZgLFITMeaJ3lI=; b=WAfwwvJwMhhASUut8KnoXR8rC0W1TcLkmSBImNwGVCoGNFSao2tEdPuWD+bOlk5ay/ G848gGkGVJ4aeQioiObHwYDFi2tCy9NLsrhCWAIw7l1c6uNmAqFljzSBdxDO4zTo0bi1 X0AuEjiF3V9TM6Hk7bMa9TqkzbHhhq1NcS9puAAv5JxdJsx852jWpyLAq/HTsrY4lxly 7v87hyAGIxZlDoXabPaRfQWicu+1tRES/HXn5lzIhq3VoxyLeKpoDpqJlpadBDn1DsVK 0JQneeFEPXbDmfaEeNq6266uuU6kVE2PkmOaypV1ON4Fbi5Y9KwHBamhl2Dgz2lP+Up4 UF9w== Received: by 10.68.234.229 with SMTP id uh5mr34387780pbc.123.1352155658296; Mon, 05 Nov 2012 14:47:38 -0800 (PST) Received: from studio.mtv.corp.google.com (studio.mtv.corp.google.com [172.17.131.106]) by mx.google.com with ESMTPS id jx4sm11201653pbc.27.2012.11.05.14.47.36 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Nov 2012 14:47:37 -0800 (PST) From: Michel Lespinasse To: Andrew Morton , Rik van Riel , Hugh Dickins , linux-kernel@vger.kernel.org, Russell King , Ralf Baechle , Paul Mundt , "David S. Miller" , Chris Metcalf , x86@kernel.org, William Irwin Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, Rik van Riel Subject: [PATCH 04/16] mm: rearrange vm_area_struct for fewer cache misses Date: Mon, 5 Nov 2012 14:47:01 -0800 Message-Id: <1352155633-8648-5-git-send-email-walken@google.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1352155633-8648-1-git-send-email-walken@google.com> References: <1352155633-8648-1-git-send-email-walken@google.com> X-Gm-Message-State: ALoCoQlq2XvEflndq+UHRfTyzVJ2D5Oyqb8j8ZIEv6fOpJAXYEorwtNiAnbmST6+Y8sQdgs/3PJkhpxJNd21dYYUqzXNl+PNj5pKAZOoZwu8pK350FBdGXAprwxdo8sVYV8AIH9cqEwat+iJ9iZ2cRJ0epU9+VvQQAWNpVLh1mdDgOqxoCZx3dOK5JTBhgwqxiD3zt7Nbvb8tjiVM1ulGTdEUT/ISPCkeg== Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org From: Rik van Riel 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. Signed-off-by: Michel Lespinasse Signed-off-by: Rik van Riel --- include/linux/mm_types.h | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 94fa52b28ee8..528da4abf8ee 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -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