Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1323069

Re: [PATCH] mm: Use linear_page_index() in do_fault()

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From "Kirill A. Shutemov" <kirill@shutemov.name>
Newsgroups linux.kernel
Subject Re: [PATCH] mm: Use linear_page_index() in do_fault()
Date Mon, 01 Feb 2016 14:10:02 +0100
Message-ID <qXmoW-3eN-27@gated-at.bofh.it> (permalink)
References <qWZ90-38Q-1@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=ewJS/vjqyMmi3ks4jpoeG4MOorQfAwgPN4hnk9wMUws=; b=H3tPrKw473NdwJ56OfilaxMIW/RspxtW74QrqUHlRJ1LkfgwoSwXrS2DAT1BRXJz0y aKRW2hDB036PZ+31sgUZarFL5nza3mfdzMPld3hSneSzZRiwDveWHkydpvIIahcQlUes WaZqhRQoiVlckUuZmhxFzejk5LE1oniD0xQXf9VMWqJAV+Tz6kogy5WfGgJGDR8nY8TB qEynjkeNNuo20MImmPq0nmnGLCT1z4zfdX5FGD/clVZQZyl2RhhbN4oZsdqy+DUQt7/T wJm6LmKjQif1sfopzOQL4cLV1F2eMmRWnKoJBa3Cq0U7nYe+SaYUhcoXzVrtcDm8Ce4v qpLA==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=ewJS/vjqyMmi3ks4jpoeG4MOorQfAwgPN4hnk9wMUws=; b=EmB9S60yMHSpL2vxi86l0WnAtiqKV5jgnn12AE7o4MqygVyn3m+3LYwFWeUy/AfBhs WfWJ2DYmFA25qWjmib4/x37t1ql9unrlR4cps3Ym8Jwo48s3YFPRtsDM+zvCQGgNHdqh 9PuopJuob66JI0fLf5sBYbxsJC8tmslJLjwFGUeZLrptYv3Hd7OJs3zzH0rPDmQJDumU p7PYQ71uBwLF4uEEA/WFtxbO8Fku/S47Zi8xt2iRLLMXoRmYpGfPOsctPAzecB/rdVzf GqKABANEU4Xy6kED9m18XVSwn2J1iRb5GIjfusA/m4WFYOT6ItJIJBYhJ/OZrxzcRfjI GzoA==
X-Gm-Message-State AG10YOTBpL593SbZP0WQRI0MorEipdXDT44nL7TQ6sbYJpqNHHeb7TeheELCbcyYaV2s3Q==
X-Received by 10.194.19.138 with SMTP id f10mr22141038wje.108.1454332000557; Mon, 01 Feb 2016 05:06:40 -0800 (PST)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.23.1 (2014-03-12)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 40
Organization linux.* mail to news gateway
X-Original-Cc Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, willy@linux.intel.com
X-Original-Date Mon, 1 Feb 2016 15:06:38 +0200
X-Original-Message-ID <20160201130638.GB29337@node.shutemov.name>
X-Original-References <1454242401-17005-1-git-send-email-matthew.r.wilcox@intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1323069

Show key headers only | View raw


On Sun, Jan 31, 2016 at 11:13:21PM +1100, Matthew Wilcox wrote:
> do_fault assumes that PAGE_SIZE is the same as PAGE_CACHE_SIZE.
> Use linear_page_index() to calculate pgoff in the correct units.
> 
> Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

'linear' part of helper name is not relevant any more since we've dropped
non-linear mappings. Probably, we should rename helpers.

> ---
>  mm/memory.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 554816b..5224c06 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3161,8 +3161,7 @@ static int do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
>  		unsigned long address, pte_t *page_table, pmd_t *pmd,
>  		unsigned int flags, pte_t orig_pte)
>  {
> -	pgoff_t pgoff = (((address & PAGE_MASK)
> -			- vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
> +	pgoff_t pgoff = linear_page_index(vma, address);
>  
>  	pte_unmap(page_table);
>  	/* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */
> -- 
> 2.7.0.rc3
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
 Kirill A. Shutemov

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm: Use linear_page_index() in do_fault() Matthew Wilcox <matthew.r.wilcox@intel.com> - 2016-01-31 13:20 +0100
  Re: [PATCH] mm: Use linear_page_index() in do_fault() "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-02-01 14:10 +0100
    Re: [PATCH] mm: Use linear_page_index() in do_fault() Matthew Wilcox <willy@linux.intel.com> - 2016-02-01 21:50 +0100

csiph-web