From patchwork Fri Dec 9 04:45:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 5551 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0039823E03 for ; Fri, 9 Dec 2011 04:46:13 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id DD8F4A1801B for ; Fri, 9 Dec 2011 04:46:13 +0000 (UTC) Received: by mail-bw0-f52.google.com with SMTP id 17so3421035bke.11 for ; Thu, 08 Dec 2011 20:46:13 -0800 (PST) Received: by 10.204.156.141 with SMTP id x13mr2845245bkw.54.1323405973710; Thu, 08 Dec 2011 20:46:13 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.129.2 with SMTP id hg2cs107010bkc; Thu, 8 Dec 2011 20:46:13 -0800 (PST) Received: by 10.68.74.4 with SMTP id p4mr2471536pbv.123.1323405971418; Thu, 08 Dec 2011 20:46:11 -0800 (PST) Received: from e4.ny.us.ibm.com (e4.ny.us.ibm.com. [32.97.182.144]) by mx.google.com with ESMTPS id a5si10456460pbi.264.2011.12.08.20.46.10 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Dec 2011 20:46:11 -0800 (PST) Received-SPF: pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.144 as permitted sender) client-ip=32.97.182.144; Authentication-Results: mx.google.com; spf=pass (google.com: domain of jstultz@us.ibm.com designates 32.97.182.144 as permitted sender) smtp.mail=jstultz@us.ibm.com Received: from /spool/local by e4.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Dec 2011 23:46:07 -0500 Received: from d01relay07.pok.ibm.com (9.56.227.147) by e4.ny.us.ibm.com (192.168.1.104) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 8 Dec 2011 23:45:43 -0500 Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pB94jgSH3526794; Thu, 8 Dec 2011 23:45:42 -0500 Received: from d01av01.pok.ibm.com (loopback [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pB94jgdH025015; Thu, 8 Dec 2011 23:45:42 -0500 Received: from kernel.beaverton.ibm.com (kernel.beaverton.ibm.com [9.47.67.96]) by d01av01.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id pB94jg8U025000; Thu, 8 Dec 2011 23:45:42 -0500 Received: by kernel.beaverton.ibm.com (Postfix, from userid 1056) id 50D9D1E74FE; Thu, 8 Dec 2011 20:45:41 -0800 (PST) From: John Stultz To: Brian Swetland Cc: John Stultz , Brian Swetland , Colin Cross , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Dima Zavin , Robert Love , Greg KH Subject: [PATCH 3/9] ashmem: Avoid touching mm/shmem.c while we're in staging Date: Thu, 8 Dec 2011 20:45:02 -0800 Message-Id: <1323405908-26046-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.7.3.2.146.gca209 In-Reply-To: <1323405908-26046-1-git-send-email-john.stultz@linaro.org> References: <1323405908-26046-1-git-send-email-john.stultz@linaro.org> MIME-Version: 1.0 x-cbid: 11120904-3534-0000-0000-0000036D8ECD This patch cuts out the mm/shmem.c modifications from the original ashmem patch, because while we're in staging we shouldn't be modifiying anything outside of the staging dir. This patch likely needs the closest review to ensure the shmem_file_set() replacement code is correct. NOTE: This patch will be folded into the previous before pushing the patch queue to staging. CC: Brian Swetland CC: Colin Cross CC: Arve Hjønnevåg CC: Dima Zavin CC: Robert Love CC: Greg KH Signed-off-by: John Stultz --- drivers/staging/android/ashmem.c | 15 +++++++++------ include/linux/mm.h | 1 - mm/shmem.c | 16 ++++++---------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c index 34a5f8b..60b2431 100644 --- a/drivers/staging/android/ashmem.c +++ b/drivers/staging/android/ashmem.c @@ -247,13 +247,16 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) } get_file(asma->file); + /* + * XXX - Reworked to use shmem_zero_setup() instead of + * shmem_set_file while we're in staging. -jstultz + */ if (vma->vm_flags & VM_SHARED) - shmem_set_file(vma, asma->file); - else { - if (vma->vm_file) - fput(vma->vm_file); - vma->vm_file = asma->file; - } + shmem_zero_setup(vma); + + if (vma->vm_file) + fput(vma->vm_file); + vma->vm_file = asma->file; vma->vm_flags |= VM_CAN_NONLINEAR; out: diff --git a/include/linux/mm.h b/include/linux/mm.h index 87d41e7..3dc3a8c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -871,7 +871,6 @@ extern bool skip_free_areas_node(unsigned int flags, int nid); int shmem_lock(struct file *file, int lock, struct user_struct *user); struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); -void shmem_set_file(struct vm_area_struct *vma, struct file *file); int shmem_zero_setup(struct vm_area_struct *); extern int can_do_mlock(void); diff --git a/mm/shmem.c b/mm/shmem.c index 7adc113..1e4fdd7 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2526,15 +2526,6 @@ put_memory: } EXPORT_SYMBOL_GPL(shmem_file_setup); -void shmem_set_file(struct vm_area_struct *vma, struct file *file) -{ - if (vma->vm_file) - fput(vma->vm_file); - vma->vm_file = file; - vma->vm_ops = &shmem_vm_ops; - vma->vm_flags |= VM_CAN_NONLINEAR; -} - /** * shmem_zero_setup - setup a shared anonymous mapping * @vma: the vma to be mmapped is prepared by do_mmap_pgoff @@ -2548,7 +2539,12 @@ int shmem_zero_setup(struct vm_area_struct *vma) if (IS_ERR(file)) return PTR_ERR(file); - shmem_set_file(vma, file); + if (vma->vm_file) + fput(vma->vm_file); + vma->vm_file = file; + vma->vm_ops = &shmem_vm_ops; + vma->vm_flags |= VM_CAN_NONLINEAR; + return 0; }