From: Dave Hansen <dave.hansen@linux.intel.com>
To: Rui Teng <rui.teng@linux.vnet.ibm.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>,
Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
Michal Hocko <mhocko@suse.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Vlastimil Babka <vbabka@suse.cz>,
Mike Kravetz <mike.kravetz@oracle.com>,
"Aneesh Kumar K . V" <aneesh.kumar@linux.vnet.ibm.com>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Santhosh G <santhog4@in.ibm.com>"Kirill A. Shutemov"
<kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH] memory-hotplug: Fix bad area access on dissolve_free_huge_pages()
Date: Tue, 13 Sep 2016 10:32:17 -0700 [thread overview]
Message-ID: <57D83821.4090804@linux.intel.com> (raw)
In-Reply-To: <1473755948-13215-1-git-send-email-rui.teng@linux.vnet.ibm.com>
On 09/13/2016 01:39 AM, Rui Teng wrote:
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 87e11d8..64b5f81 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1442,7 +1442,7 @@ static int free_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed,
> static void dissolve_free_huge_page(struct page *page)
> {
> spin_lock(&hugetlb_lock);
> - if (PageHuge(page) && !page_count(page)) {
> + if (PageHuge(page) && !page_count(page) && PageHead(page)) {
> struct hstate *h = page_hstate(page);
> int nid = page_to_nid(page);
> list_del(&page->lru);
This is goofy. What is calling dissolve_free_huge_page() on a tail page?
Hmm:
> for (pfn = start_pfn; pfn < end_pfn; pfn += 1 << minimum_order)
> dissolve_free_huge_page(pfn_to_page(pfn));
So, skip through the area being offlined at the smallest huge page size,
and try to dissolve a huge page in each place one might appear. But,
after we dissolve a 16GB huge page, we continue looking through the
remaining 15.98GB tail area for huge pages in the area we just
dissolved. The tail pages are still PageHuge() (how??), and we call
page_hstate() on the tail page whose head was just dissolved.
Note, even with the fix, this taking a (global) spinlock 1023 more times
that it doesn't have to.
This seems inefficient, and fails to fully explain what is going on, and
how tail pages still _look_ like PageHuge(), which seems pretty wrong.
I guess the patch _works_. But, sheesh, it leaves a lot of room for
improvement.
--
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:[~2016-09-13 17:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 8:39 Rui Teng
2016-09-13 17:32 ` Dave Hansen [this message]
2016-09-14 16:33 ` Rui Teng
2016-09-14 16:37 ` Dave Hansen
2016-09-16 13:58 ` Rui Teng
2016-09-16 16:25 ` Dave Hansen
2016-09-20 14:45 ` Rui Teng
2016-09-20 14:53 ` Dave Hansen
2016-09-20 15:52 ` Rui Teng
2016-09-20 17:43 ` Dave Hansen
2016-09-21 12:05 ` Michal Hocko
2016-09-21 16:04 ` Dave Hansen
2016-09-21 16:27 ` Michal Hocko
2016-09-21 16:32 ` Dave Hansen
2016-09-21 16:52 ` Michal Hocko
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=57D83821.4090804@linux.intel.com \
--to=dave.hansen@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=n-horiguchi@ah.jp.nec.com \
--cc=paul.gortmaker@windriver.com \
--cc=rui.teng@linux.vnet.ibm.com \
--cc=santhog4@in.ibm.com \
--cc=vbabka@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