From patchwork Fri Dec 27 18:00:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 3412311 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 67E4C9F2A9 for ; Fri, 27 Dec 2013 18:00:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3BCA32015A for ; Fri, 27 Dec 2013 18:00:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 81F032011E for ; Fri, 27 Dec 2013 18:00:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754047Ab3L0SAV (ORCPT ); Fri, 27 Dec 2013 13:00:21 -0500 Received: from mga02.intel.com ([134.134.136.20]:57555 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753716Ab3L0SAV (ORCPT ); Fri, 27 Dec 2013 13:00:21 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 27 Dec 2013 10:00:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,561,1384329600"; d="scan'208";a="458488717" Received: from unknown (HELO rizzo.int.wil.cx) ([10.255.12.21]) by orsmga002.jf.intel.com with ESMTP; 27 Dec 2013 10:00:19 -0800 Received: by rizzo.int.wil.cx (Postfix, from userid 1000) id AB382172477; Fri, 27 Dec 2013 13:00:18 -0500 (EST) Date: Fri, 27 Dec 2013 13:00:18 -0500 From: Matthew Wilcox To: linux-mm@kvack.org Cc: "David S. Miller" , sparclinux@vger.kernel.org, linux-parisc@vger.kernel.org, linux-mips@linux-mips.org Subject: [PATCH] remap_file_pages needs to check for cache coherency Message-ID: <20131227180018.GC4945@linux.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It seems to me that while (for example) on SPARC, it's not possible to create a non-coherent mapping with mmap(), after we've done an mmap, we can then use remap_file_pages() to create a mapping that no longer aliases in the D-cache. I have only compile-tested this patch. I don't have any SPARC hardware, and my PA-RISC hardware hasn't been turned on in six years ... I noticed this while wandering around looking at some other stuff. --- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/mm/fremap.c b/mm/fremap.c index 5bff081..01fc2e7 100644 --- a/mm/fremap.c +++ b/mm/fremap.c @@ -19,6 +19,7 @@ #include #include +#include #include #include "internal.h" @@ -177,6 +178,13 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, if (start < vma->vm_start || start + size > vma->vm_end) goto out; +#ifdef __ARCH_FORCE_SHMLBA + /* Is the mapping cache-coherent? */ + if ((pgoff ^ linear_page_index(vma, start)) & + ((SHMLBA-1) >> PAGE_SHIFT)) + goto out; +#endif + /* Must set VM_NONLINEAR before any pages are populated. */ if (!(vma->vm_flags & VM_NONLINEAR)) { /*