From: "Hillf Danton" <hillf.zj@alibaba-inc.com>
To: "'David Rientjes'" <rientjes@google.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"'Davidlohr Bueso'" <dave@stgolabs.net>,
"'Luiz Capitulino'" <lcapitulino@redhat.com>,
"'Joonsoo Kim'" <iamjoonsoo.kim@lge.com>,
"linux-kernel" <linux-kernel@vger.kernel.org>,
<linux-mm@kvack.org>, "Hillf Danton" <hillf.zj@alibaba-inc.com>
Subject: Re: [patch] mm, hugetlb: close race when setting PageTail for gigantic pages
Date: Wed, 25 Feb 2015 10:32:45 +0800 [thread overview]
Message-ID: <068c01d050a3$57c90eb0$075b2c10$@alibaba-inc.com> (raw)
> Now that gigantic pages are dynamically allocatable, care must be taken
> to ensure that p->first_page is valid before setting PageTail.
>
> If this isn't done, then it is possible to race and have compound_head()
> return NULL.
>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>
> mm/hugetlb.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -917,7 +917,6 @@ static void prep_compound_gigantic_page(struct page *page, unsigned long order)
> __SetPageHead(page);
> __ClearPageReserved(page);
> for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) {
> - __SetPageTail(p);
> /*
> * For gigantic hugepages allocated through bootmem at
> * boot, it's safer to be consistent with the not-gigantic
> @@ -933,6 +932,9 @@ static void prep_compound_gigantic_page(struct page *page, unsigned long order)
> __ClearPageReserved(p);
> set_page_count(p, 0);
> p->first_page = page;
> + /* Make sure p->first_page is always valid for PageTail() */
> + smp_wmb();
> + __SetPageTail(p);
> }
> }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next reply other threads:[~2015-02-25 2:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-25 2:32 Hillf Danton [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-02-25 0:16 David Rientjes
2015-02-25 2:20 ` Davidlohr Bueso
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='068c01d050a3$57c90eb0$075b2c10$@alibaba-inc.com' \
--to=hillf.zj@alibaba-inc.com \
--cc=akpm@linux-foundation.org \
--cc=dave@stgolabs.net \
--cc=iamjoonsoo.kim@lge.com \
--cc=lcapitulino@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.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
all inboxes | Powered by JetHome®