From: Hillf Danton <dhillf@gmail.com>
To: Michal Hocko <mhocko@suse.cz>
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 21:37:45 +0800 [thread overview]
Message-ID: <CAJd=RBCuvpG49JcTUY+qw-tTdH_vFLgOfJDE3sW97+M04TR+hg@mail.gmail.com> (raw)
In-Reply-To: <20120806132410.GA6150@dhcp22.suse.cz>
On Mon, Aug 6, 2012 at 9:24 PM, Michal Hocko <mhocko@suse.cz> wrote:
> 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!
>
Two indexes result in less code change here and no change
in page_table_shareable. Plus linear_hugepage_index tells
clearly readers that hp_idx and idx are different.
Anyway I have no strong opinion to keep
page_table_shareable unchanged, but prefer less changes.
Thanks,
Hillf
>> 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>
next prev parent reply other threads:[~2012-08-06 13:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-04 6:08 Hillf Danton
2012-08-06 13:24 ` Michal Hocko
2012-08-06 13:37 ` Hillf Danton [this message]
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='CAJd=RBCuvpG49JcTUY+qw-tTdH_vFLgOfJDE3sW97+M04TR+hg@mail.gmail.com' \
--to=dhillf@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
/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