linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.cz>
To: Hillf Danton <dhillf@gmail.com>
Cc: Mel Gorman <mgorman@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux-MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [patch v2] hugetlb: correct page offset index for sharing pmd
Date: Mon, 6 Aug 2012 15:24:10 +0200	[thread overview]
Message-ID: <20120806132410.GA6150@dhcp22.suse.cz> (raw)
In-Reply-To: <CAJd=RBC9HhKh5Q0-yXi3W0x3guXJPFz4BNsniyOFmp0TjBdFqg@mail.gmail.com>

On Sat 04-08-12 14:08:31, Hillf Danton wrote:
> The computation of page offset index is incorrect to be used in scanning
> prio tree, as huge page offset is required, and is fixed with well
> defined routine.
> 
> Changes from v1
> 	o s/linear_page_index/linear_hugepage_index/ for clearer code
> 	o hp_idx variable added for less change
> 
> 
> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> ---
> 
> --- a/arch/x86/mm/hugetlbpage.c	Fri Aug  3 20:34:58 2012
> +++ b/arch/x86/mm/hugetlbpage.c	Fri Aug  3 20:40:16 2012
> @@ -62,6 +62,7 @@ static void huge_pmd_share(struct mm_str
>  {
>  	struct vm_area_struct *vma = find_vma(mm, addr);
>  	struct address_space *mapping = vma->vm_file->f_mapping;
> +	pgoff_t hp_idx;
>  	pgoff_t idx = ((addr - vma->vm_start) >> PAGE_SHIFT) +
>  			vma->vm_pgoff;

So we have two indexes now. That is just plain ugly!

>  	struct prio_tree_iter iter;
> @@ -72,8 +73,10 @@ static void huge_pmd_share(struct mm_str
>  	if (!vma_shareable(vma, addr))
>  		return;
> 
> +	hp_idx = linear_hugepage_index(vma, addr);
> +
>  	mutex_lock(&mapping->i_mmap_mutex);
> -	vma_prio_tree_foreach(svma, &iter, &mapping->i_mmap, idx, idx) {
> +	vma_prio_tree_foreach(svma, &iter, &mapping->i_mmap, hp_idx, hp_idx) {
>  		if (svma == vma)
>  			continue;
> 
> --

-- 
Michal Hocko
SUSE Labs

--
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>

  reply	other threads:[~2012-08-06 13:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-04  6:08 [patch v2] hugetlb: correct page offset index for sharing pmd Hillf Danton
2012-08-06 13:24 ` Michal Hocko [this message]
2012-08-06 13:37   ` Hillf Danton
2012-08-06 15:54     ` Michal Hocko
2012-08-07 12:41       ` Hillf Danton
2012-08-15 23:03     ` Andrew Morton
2012-08-16 12:40       ` Hillf Danton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120806132410.GA6150@dhcp22.suse.cz \
    --to=mhocko@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=dhillf@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).