From patchwork Mon Nov 5 22:47:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michel Lespinasse X-Patchwork-Id: 1700861 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 8C518DF2AB for ; Mon, 5 Nov 2012 22:52:50 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TVVTb-0000fZ-9e; Mon, 05 Nov 2012 22:49:03 +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 1TVVSJ-0000IS-Qk for linux-arm-kernel@lists.infradead.org; Mon, 05 Nov 2012 22:47:47 +0000 Received: by mail-pa0-f49.google.com with SMTP id bi5so3945675pad.36 for ; Mon, 05 Nov 2012 14:47:43 -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=EWmXgsnc9fQxBkhaU80PXECEJTZenWmKG/K/XM0LGgs=; b=GuZt5XWNiFx5hgiLEw9nu1n+JYgn2MJdx4q1AihE4XF8KPWFf4UeQg0UC8O+2qAAi5 mDG0ZfnA9bHSShZ+gvgxgi7X7lbhqoEINHpkenuyCpZnLWqkJlB3+LG+XCvmXlGyrSlT SDi5ADsdxpjpd4vhSJHr58tytohB5DvoFYiiawSBwoPJOZ9HydALbR2XFTe2aXE2wmaH r7GmE5bokGilDzITWsyF+aqPI3MJIGX/OzP+rpkgD8mwalHRpA0RhoBmHwoxMRuN89fJ CzHcP/3gT+QIiE2ffAh5hJ59Po2dNXI7bgFTc5ve0jaPtTCzdGnJXSn5dJw57/Hkc/aV q2Xg== 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=EWmXgsnc9fQxBkhaU80PXECEJTZenWmKG/K/XM0LGgs=; b=c0QFh1pQoVKp2bZ52AhwbVX1gVwMxgJNL7wOzSbPMW62/3+WLJkYMEcpyB8nd1j19Q gU6gmG27zeS2v5poRteH3nJ6y16+Zl6+2zFrF0Hw01rh2y08Kn0TkKNoitdnE5sN+Zyw VyFYYghuORjSwad85xfGCUMsojLl16rNgKlRhtDAzJnK2FNXzjQAWszPXoCIMizLlzfu TRFM2MYnyyM5gRGwvhb2MyjacsqMkTTi7tFHGTilEFPDoVSfvT9UqyLODVZUbdd9/5e6 t9r9e+TvospPNmGJ76ue3YBSziIeQ9cBQboo3fCPadl7rtL4XUzIlKV1jWkNYwqHkWcX tV5w== Received: by 10.68.238.199 with SMTP id vm7mr21793278pbc.105.1352155663495; Mon, 05 Nov 2012 14:47:43 -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.41 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Nov 2012 14:47:42 -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 07/16] mm: fix cache coloring on x86_64 architecture Date: Mon, 5 Nov 2012 14:47:04 -0800 Message-Id: <1352155633-8648-8-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: ALoCoQnyMULxsj8TIrdKiLSDq6FdbeZ3vLXTaT7QYGxAz+/rftz2sOGvWZrQ3BoOc0hq7XmXu/1Yo8eWMkiKFE5xsQJdzaDAjHyFDDDvOkfN/PWKt1ZN0TYx/YVxi7y5/g8ohUH7X/A+iidKEwmPxaYH+S/oStTxmIYjjsO3sYWSfAl9SVIL10sImrtEIDhpon3b9LAwocs9eNqyB6S7/T6hRze3wL5uzw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121105_174745_798533_DF744BA8 X-CRM114-Status: GOOD ( 13.88 ) 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: sparclinux@vger.kernel.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.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 Fix the x86-64 cache alignment code to take pgoff into account. Use the x86 and MIPS cache alignment code as the basis for a generic cache alignment function. The old x86 code will always align the mmap to aliasing boundaries, even if the program mmaps the file with a non-zero pgoff. If program A mmaps the file with pgoff 0, and program B mmaps the file with pgoff 1. The old code would align the mmaps, resulting in misaligned pages: A: 0123 B: 123 After this patch, they are aligned so the pages line up: A: 0123 B: 123 Signed-off-by: Michel Lespinasse Proposed-by: Rik van Riel --- arch/x86/kernel/sys_x86_64.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c index f00d006d60fd..97ef74b88e0f 100644 --- a/arch/x86/kernel/sys_x86_64.c +++ b/arch/x86/kernel/sys_x86_64.c @@ -136,7 +136,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, info.low_limit = begin; info.high_limit = end; info.align_mask = filp ? get_align_mask() : 0; - info.align_offset = 0; + info.align_offset = pgoff << PAGE_SHIFT; return vm_unmapped_area(&info); } @@ -175,7 +175,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0, info.low_limit = PAGE_SIZE; info.high_limit = mm->mmap_base; info.align_mask = filp ? get_align_mask() : 0; - info.align_offset = 0; + info.align_offset = pgoff << PAGE_SHIFT; addr = vm_unmapped_area(&info); if (!(addr & ~PAGE_MASK)) return addr;