From: "Huang\, Ying" <ying.huang@intel.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Huang, Ying" <ying.huang@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Andrea Arcangeli <aarcange@redhat.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Nadia Yvette Chambers <nyc@holomorphy.com>,
Michal Hocko <mhocko@suse.com>, Jan Kara <jack@suse.cz>,
Hugh Dickins <hughd@google.com>, Minchan Kim <minchan@kernel.org>,
Shaohua Li <shli@fb.com>
Subject: Re: [PATCH -mm] mm: Clear to access sub-page last when clearing huge page
Date: Wed, 09 Aug 2017 07:06:48 +0800 [thread overview]
Message-ID: <87y3qt64mv.fsf@yhuang-mobile.sh.intel.com> (raw)
In-Reply-To: <20170808121220.GA31390@bombadil.infradead.org> (Matthew Wilcox's message of "Tue, 8 Aug 2017 05:12:20 -0700")
Matthew Wilcox <willy@infradead.org> writes:
> On Mon, Aug 07, 2017 at 03:21:31PM +0800, Huang, Ying wrote:
>> @@ -2509,7 +2509,8 @@ enum mf_action_page_type {
>> #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS)
>> extern void clear_huge_page(struct page *page,
>> unsigned long addr,
>> - unsigned int pages_per_huge_page);
>> + unsigned int pages_per_huge_page,
>> + unsigned long addr_hint);
>
> I don't really like adding the extra argument to this function ...
>
>> +++ b/mm/huge_memory.c
>> @@ -549,7 +549,8 @@ static int __do_huge_pmd_anonymous_page(struct vm_fault *vmf, struct page *page,
>> struct vm_area_struct *vma = vmf->vma;
>> struct mem_cgroup *memcg;
>> pgtable_t pgtable;
>> - unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
>> + unsigned long address = vmf->address;
>> + unsigned long haddr = address & HPAGE_PMD_MASK;
>>
>> VM_BUG_ON_PAGE(!PageCompound(page), page);
>>
>> @@ -566,7 +567,7 @@ static int __do_huge_pmd_anonymous_page(struct vm_fault *vmf, struct page *page,
>> return VM_FAULT_OOM;
>> }
>>
>> - clear_huge_page(page, haddr, HPAGE_PMD_NR);
>> + clear_huge_page(page, haddr, HPAGE_PMD_NR, address);
>> /*
>> * The memory barrier inside __SetPageUptodate makes sure that
>> * clear_huge_page writes become visible before the set_pmd_at()
>
> How about calling:
>
> - clear_huge_page(page, haddr, HPAGE_PMD_NR);
> + clear_huge_page(page, address, HPAGE_PMD_NR);
>
>> +++ b/mm/memory.c
>> @@ -4363,10 +4363,10 @@ static void clear_gigantic_page(struct page *page,
>> clear_user_highpage(p, addr + i * PAGE_SIZE);
>> }
>> }
>> -void clear_huge_page(struct page *page,
>> - unsigned long addr, unsigned int pages_per_huge_page)
>> +void clear_huge_page(struct page *page, unsigned long addr,
>> + unsigned int pages_per_huge_page, unsigned long addr_hint)
>> {
>> - int i;
>> + int i, n, base, l;
>>
>> if (unlikely(pages_per_huge_page > MAX_ORDER_NR_PAGES)) {
>> clear_gigantic_page(page, addr, pages_per_huge_page);
>
> ... and doing this:
>
> void clear_huge_page(struct page *page,
> - unsigned long addr, unsigned int pages_per_huge_page)
> + unsigned long addr_hint, unsigned int pages_per_huge_page)
> {
> - int i;
> + int i, n, base, l;
> + unsigned long addr = addr_hint &
> + (1UL << (pages_per_huge_page + PAGE_SHIFT));
>
>> @@ -4374,9 +4374,31 @@ void clear_huge_page(struct page *page,
>> }
>>
>> might_sleep();
>> - for (i = 0; i < pages_per_huge_page; i++) {
>> + VM_BUG_ON(clamp(addr_hint, addr, addr +
>> + (pages_per_huge_page << PAGE_SHIFT)) != addr_hint);
>
> ... then you can ditch this check
Yes. This looks good for me. If there is no objection, I will go this
way in the next version.
Best Regards,
Huang, Ying
--
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:[~2017-08-08 23:06 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 7:21 Huang, Ying
2017-08-07 9:55 ` Jan Kara
2017-08-07 10:00 ` Huang, Ying
2017-08-07 10:16 ` Kirill A. Shutemov
2017-08-07 22:51 ` Huang, Ying
2017-08-08 7:40 ` Huang, Ying
2017-08-07 18:46 ` Christopher Lameter
2017-08-07 23:05 ` Huang, Ying
2017-08-08 6:26 ` Huang, Ying
2017-08-08 4:07 ` Mike Kravetz
2017-08-08 4:24 ` Huang, Ying
2017-08-08 12:12 ` Matthew Wilcox
2017-08-08 23:06 ` Huang, Ying [this message]
2017-08-09 21:25 ` Andrew Morton
2017-08-10 0:58 ` Huang, Ying
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=87y3qt64mv.fsf@yhuang-mobile.sh.intel.com \
--to=ying.huang@intel.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=nyc@holomorphy.com \
--cc=shli@fb.com \
--cc=willy@infradead.org \
/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