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: 1700761 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 579F43FCA5 for ; Mon, 5 Nov 2012 22:51:27 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TVVTK-0000Wy-Hf; Mon, 05 Nov 2012 22:48:46 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TVVSE-0000IS-LF for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2012 22:47:41 +0000 Received: by mail-pa0-f49.google.com with SMTP id bi5so3945675pad.36 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=SiSxXXRMH8pjMfa4Rqp68JJOoZt0tbTyBIwUpx1/Mayvmflh4LMNNN2gDytDUBeql1 NTP4lua3di1xBGRCe5Lx+Nd04rXOJmKTH/xOXRwTbGoDTdq2xcp/8ySQlxilvYfXUQKQ 1uffe4R2ipeaPbmGwmjgpC3aLr7rnyaOnCAllHluykv4gcMdzFgUj2mxfd4eZsGKMgLr lTnTp2UXE4zx8KfvwOKPH9huH8w5n8OfMPfL4ZYakbqEropFjTKl4A4feopJUQ4DcJYN EoHLwq8Ut+vboL7MqvDS+NwIMcjM7Ziak3RLkqMhlK4I54/DbzdEgdzUFeADGZAgLKc6 eFHw== 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 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: ALoCoQnuddN9TtGLchyJX123KP8lKokHdKSvzj/EA/T8+7nmaEPiB491SScNp8hvFAPi5+XCPrurhMypdQPz5+SUVPpittZPW4vWeziyXUHe2IpAqodfao+qgL9KHVYkEhHZNQ/jVvnlJEEVg3WzNg5bZJPHjHvj+aawD9FA04MJvTChf+wVf05J2BL5ytv/0Ln+jKTy6BJ0RerJyC3RVKd60i3YH0eCAw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121105_174740_012744_ECF1F7C5 X-CRM114-Status: GOOD ( 12.77 ) X-Spam-Score: -0.4 (/) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-0.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.220.49 listed in list.dnswl.org] 3.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: linux-mips@linux-mips.org, Rik van Riel , linux-sh@vger.kernel.org, linux-mm@kvack.org, sparclinux@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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