From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>,
Michal Hocko <mhocko@suse.cz>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Hugh Dickins <hughd@google.com>,
Davidlohr Bueso <davidlohr.bueso@hp.com>,
David Gibson <david@gibson.dropbear.id.au>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Wanpeng Li <liwanp@linux.vnet.ibm.com>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Hillf Danton <dhillf@gmail.com>
Subject: Re: [PATCH] mm, hugetlb: correct missing private flag clearing
Date: Tue, 1 Oct 2013 10:16:30 +0900 [thread overview]
Message-ID: <20131001011630.GA21009@lge.com> (raw)
In-Reply-To: <20130930143514.63fc5b2b4316caed33e1c1b1@linux-foundation.org>
On Mon, Sep 30, 2013 at 02:35:14PM -0700, Andrew Morton wrote:
> On Mon, 30 Sep 2013 16:59:44 +0900 Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
>
> > We should clear the page's private flag when returing the page to
> > the page allocator or the hugepage pool. This patch fixes it.
> >
> > Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > ---
> > Hello, Andrew.
> >
> > I sent the new version of commit ('07443a8') before you did pull request,
> > but it isn't included. It may be losted :)
> > So I send this fix. IMO, this is good for v3.12.
> >
> > Thanks.
> >
> > diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> > index b49579c..691f226 100644
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -653,6 +653,7 @@ static void free_huge_page(struct page *page)
> > BUG_ON(page_count(page));
> > BUG_ON(page_mapcount(page));
> > restore_reserve = PagePrivate(page);
> > + ClearPagePrivate(page);
> >
>
> You describe it as a fix, but what does it fix? IOW, what are the
> user-visible effects of the change?
>
> update_and_free_page() already clears PG_private, but afaict the bit
> remains unaltered if free_huge_page() takes the enqueue_huge_page()
> route.
Yes, you are right.
I attach another version having more explanation.
Please refer this and merge it.
Thanks.
------------------------->8---------------------------------
>From 9d2ead1800de6e1192824e11dafe68bed7b78cce Mon Sep 17 00:00:00 2001
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Date: Mon, 30 Sep 2013 11:51:54 +0900
Subject: [PATCH] mm, hugetlb: correct missing private flag clearing
We should clear the page's private flag when returing the page to
the hugepage pool. Otherwise, marked hugepage can be allocated to
the user who tries to allocate the non-reserved hugepage. If this user
fail to map this hugepage, he would try to return the page to the
hugepage pool. Since this page has a private flag, resv_huge_pages would
mistakenly increase. This patch fixes this situation.
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index b49579c..691f226 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -653,6 +653,7 @@ static void free_huge_page(struct page *page)
BUG_ON(page_count(page));
BUG_ON(page_mapcount(page));
restore_reserve = PagePrivate(page);
+ ClearPagePrivate(page);
spin_lock(&hugetlb_lock);
hugetlb_cgroup_uncharge_page(hstate_index(h),
--
1.7.9.5
prev parent reply other threads:[~2013-10-01 1:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 7:59 [PATCH] mm, hugetlb: correct missing private flag clearing Joonsoo Kim
2013-09-30 21:35 ` Andrew Morton
2013-10-01 1:16 ` Joonsoo Kim [this message]
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=20131001011630.GA21009@lge.com \
--to=iamjoonsoo.kim@lge.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=davidlohr.bueso@hp.com \
--cc=dhillf@gmail.com \
--cc=hughd@google.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liwanp@linux.vnet.ibm.com \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=riel@redhat.com \
/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