From patchwork Mon Mar 13 22:14:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Till Smejkal X-Patchwork-Id: 738519 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vhydp0XCvz9s7M for ; Tue, 14 Mar 2017 13:01:33 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Yr0k+jqx"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=googlemail.com header.i=@googlemail.com header.b="Sbc5FX0f"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=daFd/amS/8FVmhxBAMU6t6gsuvECmiipQzIaSKdZNPo=; b=Yr0k+jqxk/WF2BZTji4bvCagrc xgm8GUOJLcjSFw3z7B8wm15cB3VNF8OtQDEWtYrGQ5eAR2ERpBBZ/icT7a11yBX6ICGXKYnwrqNQx 894h/JMJh+fDq2cTxD5z3W9D+4q0UHOyTgu88+3SgS2Qjy1xe8l68E664PyE1kvjMkfY0k0Za9CiH rNh3dTv90bAuACXwFPQRRuVXSIBul1MefKalSzCu/3I+uc3sow0AJHeu/GI8w3a0cn9Z9Omh/kw24 E5fZwZnbiSnRaSXOC/G5dqd+Ht6vRR+7LeZWsJSLkYrpiBvmamnbbWFDVn557zxUho286KMMjstMW 6AtMklzw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cnbmG-00069s-8p; Tue, 14 Mar 2017 02:01:32 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cnYEv-0001eR-KA; Mon, 13 Mar 2017 22:14:55 +0000 Received: by mail-wm0-x242.google.com with SMTP id z63so12127070wmg.2; Mon, 13 Mar 2017 15:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MuWNNuk3vxLpp54L6i+g8NdgOGb/dhWpwMswypTTuV0=; b=Sbc5FX0fwRxSmjxoI2AYNY6jCdAlnKBBPQIIh7vJluPM2Z7sK4GhVIGpo9pUxLeZt0 OVKcYUC6U+H2P6UbB5ANhubIcMw3ArLged7kMbVeNjh+WDxAgwUPJfGwwWXl3Ikmdk4R kTg2mxRBFdRwY3dIYJLpWQof2BSOkNj27QvdCo12cFVyynWAXKqduDbfj+bx8xRNLkvy 29Z7+X9HETkiZZrcW0x1bXRyXT+rctMYlunEj6i9JmqizEad4uSemTvMH7aZ2s4JsFPj bDb6Hb5+4sWXl/kZY6rR3pBmdrg6Fv43BPkDaMJ/plzzzwtA0HqA+eJKX1m3NsBmB+Ix HqZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MuWNNuk3vxLpp54L6i+g8NdgOGb/dhWpwMswypTTuV0=; b=iZRbQJqQ2sTihL/APhFVMK756mdoKlntVGmBtVubQp7V7ebN6MSTXladkTw9dg39Sa kSAJEruze6rjzapdFDSFBUiq1e+W0ucRtJiOqiBgGAZ4cY6ROeIg+71PcgQKYlf00E+F E3B+9VM0X3tuInIgi781rVFAMtfzbXnbVpc/I/+Ct2TbRLPU61UTA6Z9yx1k4CzXFijE Oo6Jx2fOoT6Mdcx1KNUApVtBraQ0ExrAF9Rz5DreC08imn0VyianmT6DNWloRoJZuD9+ blRpmFf5PsHhmHLMyRU+j9uuol4Nw2Fv03bYISsQ9iwrn0+FSPryGvAskb3h2ZvvruzJ FeOw== X-Gm-Message-State: AFeK/H1mlxt/W6k0RsyLf06LeEAL0MJM84/gXS3SoUZAREOaNzcr762agDC0eFs6qmOg+Q== X-Received: by 10.28.69.202 with SMTP id l71mr12714512wmi.68.1489443270117; Mon, 13 Mar 2017 15:14:30 -0700 (PDT) Received: from localhost (login1.zih.tu-dresden.de. [141.76.16.140]) by smtp.googlemail.com with ESMTPSA id z88sm26694011wrb.26.2017.03.13.15.14.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Mar 2017 15:14:29 -0700 (PDT) From: Till Smejkal X-Google-Original-From: Till Smejkal To: Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Steven Miao , Richard Kuo , Tony Luck , Fenghua Yu , James Hogan , Ralf Baechle , "James E.J. Bottomley" , Helge Deller , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Martin Schwidefsky , Heiko Carstens , Yoshinori Sato , Rich Felker , "David S. Miller" , Chris Metcalf , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Andy Lutomirski , Chris Zankel , Max Filippov , Arnd Bergmann , Greg Kroah-Hartman , Laurent Pinchart , Mauro Carvalho Chehab , Pawel Osciak , Marek Szyprowski , Kyungmin Park , David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , Cyrille Pitchen , Felipe Balbi , Alexander Viro , Benjamin LaHaise , Nadia Yvette Chambers , Jeff Layton , "J. Bruce Fields" , Peter Zijlstra , Hugh Dickins , Arnaldo Carvalho de Melo , Alexander Shishkin , Jaroslav Kysela , Takashi Iwai Subject: [RFC PATCH 03/13] mm: Rename 'unmap_region' and add mm_struct argument Date: Mon, 13 Mar 2017 15:14:05 -0700 Message-Id: <20170313221415.9375-4-till.smejkal@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170313221415.9375-1-till.smejkal@gmail.com> References: <20170313221415.9375-1-till.smejkal@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170313_151453_833683_8B76681C X-CRM114-Status: GOOD ( 17.68 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (till.smejkal[at]googlemail.com) -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_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Mailman-Approved-At: Mon, 13 Mar 2017 19:01:29 -0700 X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-mips@linux-mips.org, alsa-devel@alsa-project.org, linux-ia64@vger.kernel.org, linux-aio@kvack.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-sh@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-media@vger.kernel.org, linux-xtensa@linux-xtensa.org, adi-buildroot-devel@lists.sourceforge.net, linux-metag@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-api@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-fsdevel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Rename the 'unmap_region' function to 'munmap_region' so that it uses the same naming pattern as the do_mmap <-> mmap_region couple. In addition also make the new 'munmap_region' function publicly available to all other kernel sources. In addition, also add to the function the mm_struct it should operate on as additional argument. Before, the function simply used the memory map of the current task. However, with the introduction of first class virtual address spaces, munmap_region need also be able to operate on other memory maps than just the current task's one. Accordingly, add a new argument to the function so that one can define explicitly which memory map should be used. Signed-off-by: Till Smejkal --- include/linux/mm.h | 4 ++++ mm/mmap.c | 14 +++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index fb11be77545f..71a90604d21f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2023,6 +2023,10 @@ extern unsigned long do_mmap(struct mm_struct *mm, struct file *file, unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, vm_flags_t vm_flags, unsigned long pgoff, unsigned long *populate); + +extern void munmap_region(struct mm_struct *mm, struct vm_area_struct *vma, + struct vm_area_struct *prev, unsigned long start, + unsigned long end); extern int do_munmap(struct mm_struct *, unsigned long, size_t); static inline unsigned long diff --git a/mm/mmap.c b/mm/mmap.c index 70028bf7b58d..ea79bc4da5b7 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -70,10 +70,6 @@ int mmap_rnd_compat_bits __read_mostly = CONFIG_ARCH_MMAP_RND_COMPAT_BITS; static bool ignore_rlimit_data; core_param(ignore_rlimit_data, ignore_rlimit_data, bool, 0644); -static void unmap_region(struct mm_struct *mm, - struct vm_area_struct *vma, struct vm_area_struct *prev, - unsigned long start, unsigned long end); - /* description of effects of mapping type and prot in current implementation. * this is due to the limited x86 page protection hardware. The expected * behavior is in parens: @@ -1731,7 +1727,7 @@ unsigned long mmap_region(struct mm_struct *mm, struct file *file, fput(file); /* Undo any partial mapping done by a device driver. */ - unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end); + munmap_region(mm, vma, prev, vma->vm_start, vma->vm_end); charged = 0; if (vm_flags & VM_SHARED) mapping_unmap_writable(file->f_mapping); @@ -2447,9 +2443,9 @@ static void remove_vma_list(struct mm_struct *mm, struct vm_area_struct *vma) * * Called with the mm semaphore held. */ -static void unmap_region(struct mm_struct *mm, - struct vm_area_struct *vma, struct vm_area_struct *prev, - unsigned long start, unsigned long end) +void munmap_region(struct mm_struct *mm, struct vm_area_struct *vma, + struct vm_area_struct *prev, unsigned long start, + unsigned long end) { struct vm_area_struct *next = prev ? prev->vm_next : mm->mmap; struct mmu_gather tlb; @@ -2654,7 +2650,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len) * Remove the vma's, and unmap the actual pages */ detach_vmas_to_be_unmapped(mm, vma, prev, end); - unmap_region(mm, vma, prev, start, end); + munmap_region(mm, vma, prev, start, end); arch_unmap(mm, vma, start, end);