From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Mel Gorman <mel@csn.ul.ie>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andi Kleen <andi@firstfloor.org>,
Andrew Morton <akpm@linux-foundation.org>,
Wu Fengguang <fengguang.wu@intel.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Larry Woodman <lwoodman@redhat.com>,
Lee Schermerhorn <Lee.Schermerhorn@hp.com>
Subject: Re: [PATCH 1/7] hugetlb, rmap: add reverse mapping for hugepage
Date: Wed, 26 May 2010 15:51:56 +0900 [thread overview]
Message-ID: <20100526065156.GC7128@spritzerA.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20100525105957.GD29038@csn.ul.ie>
Hi, Mel.
Thank you for the review.
On Tue, May 25, 2010 at 11:59:57AM +0100, Mel Gorman wrote:
> ...
> I'd have preferred to see the whole series but still...
OK.
> > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> > index 78b4bc6..a574d09 100644
> > --- a/include/linux/hugetlb.h
> > +++ b/include/linux/hugetlb.h
> > @@ -14,11 +14,6 @@ struct user_struct;
> >
> > int PageHuge(struct page *page);
> >
> > -static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
> > -{
> > - return vma->vm_flags & VM_HUGETLB;
> > -}
> > -
> > void reset_vma_resv_huge_pages(struct vm_area_struct *vma);
> > int hugetlb_sysctl_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
> > int hugetlb_overcommit_handler(struct ctl_table *, int, void __user *, size_t *, loff_t *);
> > @@ -77,11 +72,6 @@ static inline int PageHuge(struct page *page)
> > return 0;
> > }
> >
> > -static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
> > -{
> > - return 0;
> > -}
> > -
>
> You collapse two functions into one here and move them to another
> header. Is there a reason why pagemap.h could not include hugetlb.h?
Yes, hugetlb.h includes pagemap.h through mempolicy.h.
I didn't make pagemap.h depend on hugetlb.h because it makes cyclic dependency
among pagemap.h, mempolicy.h and hugetlb.h.
> It adds another header dependency which is bad but moving hugetlb stuff
> into mm.h seems bad too.
I have another choice to move the definition of is_vm_hugetlb_page() into
mm/hugetlb.c and introduce declaration of this function to pagemap.h,
but this needed a bit ugly #ifdefs and I didn't like it.
If putting hugetlb code in mm.h is worse, I'll take the second choice
in the next post.
> > @@ -2268,6 +2277,50 @@ static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma,
> > return 1;
> > }
> >
> > +/*
> > + * The following three functions are counterparts of ones in mm/rmap.c.
> > + * Unlike them, these functions don't have accounting code nor lru code,
> > + * because we handle hugepages differently from common anonymous pages.
> > + */
> > +static void __hugepage_set_anon_rmap(struct page *page,
> > + struct vm_area_struct *vma, unsigned long address, int exclusive)
> > +{
> > + struct anon_vma *anon_vma = vma->anon_vma;
> > + BUG_ON(!anon_vma);
> > + if (!exclusive) {
> > + struct anon_vma_chain *avc;
> > + avc = list_entry(vma->anon_vma_chain.prev,
> > + struct anon_vma_chain, same_vma);
> > + anon_vma = avc->anon_vma;
> > + }
> > + anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
> > + page->mapping = (struct address_space *) anon_vma;
> > + page->index = linear_page_index(vma, address);
> > +}
> > +
> > +static void hugepage_add_anon_rmap(struct page *page,
> > + struct vm_area_struct *vma, unsigned long address)
> > +{
> > + struct anon_vma *anon_vma = vma->anon_vma;
> > + int first;
> > + BUG_ON(!anon_vma);
> > + BUG_ON(address < vma->vm_start || address >= vma->vm_end);
> > + first = atomic_inc_and_test(&page->_mapcount);
> > + if (first)
> > + __hugepage_set_anon_rmap(page, vma, address, 0);
> > +}
> > +
> > +void hugepage_add_new_anon_rmap(struct page *page,
> > + struct vm_area_struct *vma, unsigned long address)
> > +{
> > + BUG_ON(address < vma->vm_start || address >= vma->vm_end);
> > + atomic_set(&page->_mapcount, 0);
> > + __hugepage_set_anon_rmap(page, vma, address, 1);
> > +}
> > +
>
> Is it possible to move these to mm/rmap.c so all the anon rmap adding
> code is in the same place? In the event that __page_set_anon_rmap() is
> updated, there would be a greater chance the hugepage equivalent will be
> noticed and updated.
Sounds reasonable, I'll do it.
> I didn't spot anything particularly bad after this. If these minor issues
> could be addressed and the full series reposted, I'll test the hugetlb side
> of things further just to be sure.
OK, thanks you :)
Thanks,
Naoya Horiguchi
--
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:[~2010-05-26 6:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-13 7:55 [PATCH 0/7] HWPOISON for hugepage (v5) Naoya Horiguchi
2010-05-13 7:55 ` [PATCH 1/7] hugetlb, rmap: add reverse mapping for hugepage Naoya Horiguchi
2010-05-13 9:18 ` Andi Kleen
2010-05-17 4:53 ` Naoya Horiguchi
2010-05-13 15:27 ` Mel Gorman
2010-05-13 16:14 ` Andi Kleen
2010-05-14 7:46 ` Naoya Horiguchi
2010-05-14 9:54 ` Mel Gorman
2010-05-24 7:15 ` Naoya Horiguchi
2010-05-25 10:59 ` Mel Gorman
2010-05-26 6:51 ` Naoya Horiguchi [this message]
2010-05-26 9:03 ` Mel Gorman
2010-05-26 9:19 ` Andi Kleen
2010-05-26 9:44 ` Mel Gorman
2010-05-26 9:58 ` Andi Kleen
2010-05-13 7:55 ` [PATCH 2/7] HWPOISON, hugetlb: enable error handling path " Naoya Horiguchi
2010-05-13 7:55 ` [PATCH 3/7] HWPOISON, hugetlb: set/clear PG_hwpoison bits on hugepage Naoya Horiguchi
2010-05-13 7:55 ` [PATCH 4/7] HWPOISON, hugetlb: maintain mce_bad_pages in handling hugepage error Naoya Horiguchi
2010-05-13 7:55 ` [PATCH 5/7] HWPOISON, hugetlb: isolate corrupted hugepage Naoya Horiguchi
2010-05-13 7:55 ` [PATCH 6/7] HWPOISON, hugetlb: detect hwpoison in hugetlb code Naoya Horiguchi
2010-05-13 7:55 ` [PATCH 7/7] HWPOISON, hugetlb: support hwpoison injection for hugepage Naoya Horiguchi
2010-05-13 14:27 ` [PATCH 0/7] HWPOISON for hugepage (v5) Mel Gorman
2010-05-14 7:35 ` Naoya Horiguchi
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=20100526065156.GC7128@spritzerA.linux.bs1.fc.nec.co.jp \
--to=n-horiguchi@ah.jp.nec.com \
--cc=Lee.Schermerhorn@hp.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lwoodman@redhat.com \
--cc=mel@csn.ul.ie \
/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