From patchwork Mon Apr 15 12:48:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Bin X-Patchwork-Id: 2447701 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 647A13FD8C for ; Tue, 16 Apr 2013 06:32:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 65F16E6394 for ; Mon, 15 Apr 2013 23:32:22 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [119.145.14.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 15BCBE6097 for ; Mon, 15 Apr 2013 05:58:15 -0700 (PDT) Received: from 172.24.2.119 (EHLO szxeml214-edg.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BAB39224; Mon, 15 Apr 2013 20:50:31 +0800 (CST) Received: from SZXEML458-HUB.china.huawei.com (10.82.67.201) by szxeml214-edg.china.huawei.com (172.24.2.29) with Microsoft SMTP Server (TLS) id 14.1.323.7; Mon, 15 Apr 2013 20:50:12 +0800 Received: from localhost (10.135.74.57) by SZXEML458-HUB.china.huawei.com (10.82.67.201) with Microsoft SMTP Server id 14.1.323.7; Mon, 15 Apr 2013 20:50:04 +0800 From: Libin To: Arnd Bergmann , Greg Kroah-Hartman , David Airlie , Bjorn Helgaas , "Hans J. Koch" , Petr Vandrovec , Andrew Morton Subject: [PATCH 1/6] mm: use vma_pages() to replace (vm_end - vm_start) >> PAGE_SHIFT Date: Mon, 15 Apr 2013 20:48:53 +0800 Message-ID: <1366030138-71292-1-git-send-email-huawei.libin@huawei.com> X-Mailer: git-send-email 1.8.1.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.135.74.57] X-CFilter-Loop: Reflected X-Mailman-Approved-At: Mon, 15 Apr 2013 23:26:57 -0700 Cc: Thomas Hellstrom , linux-pci@vger.kernel.org, Jiri Kosina , guohanjun@huawei.com, Hugh Dickins , Rik van Riel , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Konstantin Khlebnikov , Al Viro , Nadia Yvette Chambers , David Rientjes , wangyijing@huawei.com, Dave Airlie , Michel Lespinasse , Mel Gorman X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org (*->vm_end - *->vm_start) >> PAGE_SHIFT operation is implemented as a inline funcion vma_pages() in linux/mm.h, so using it. Signed-off-by: Libin Reviewed-by: Michel Lespinasse --- mm/memory.c | 2 +- mm/mmap.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 13cbc42..8b8ae1c 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2866,7 +2866,7 @@ static inline void unmap_mapping_range_tree(struct rb_root *root, details->first_index, details->last_index) { vba = vma->vm_pgoff; - vea = vba + ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) - 1; + vea = vba + vma_pages(vma) - 1; /* Assume for now that PAGE_CACHE_SHIFT == PAGE_SHIFT */ zba = details->first_index; if (zba < vba) diff --git a/mm/mmap.c b/mm/mmap.c index 0db0de1..118bfcb 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -919,7 +919,7 @@ can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags, if (is_mergeable_vma(vma, file, vm_flags) && is_mergeable_anon_vma(anon_vma, vma->anon_vma, vma)) { pgoff_t vm_pglen; - vm_pglen = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; + vm_pglen = vma_pages(vma); if (vma->vm_pgoff + vm_pglen == vm_pgoff) return 1; }