linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Chao Yang <chayang@redhat.com>,
	linux-mm@kvack.org, akpm@linux-foundation.org,
	aarcange@redhat.com, mgorman@suse.de,
	Veaceslav Falico <vfalico@redhat.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	David Rientjes <rientjes@google.com>,
	Michel Lespinasse <walken@google.com>,
	Michal Hocko <mhocko@suse.cz>
Subject: [PATCH] mm,numa,THP: initialize hstate for THP page size
Date: Wed, 18 Dec 2013 17:03:14 -0500	[thread overview]
Message-ID: <20131218170314.1e57bea7@cuia.bos.redhat.com> (raw)

When hugetlbfs is started with a non-default page size, it is
possible that no hstate is initialized for the page sized used
by transparent huge pages.

This causes copy_huge_page to crash on a null pointer. Make
sure we always have an hpage initialized for the page sized
used by THP.

Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Chao Yang <chayang@redhat.com>
---
 mm/huge_memory.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 5749bcf..583e9d3 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -624,6 +624,13 @@ static int __init hugepage_init(void)
 		return -EINVAL;
 	}
 
+	/*
+	 * Make sure an hstate is initialized for our page size,
+	 * even if hugetlbfs is using a non-default page size.
+	 */
+	if (!size_to_hstate(PMD_PAGE_SIZE))
+		hugetlb_add_hstate(HUGETLB_PAGE_ORDER);
+
 	err = hugepage_init_sysfs(&hugepage_kobj);
 	if (err)
 		return err;


-- 
All Rights Reversed

--
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>

             reply	other threads:[~2013-12-18 22:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18 22:03 Rik van Riel [this message]
2013-12-18 22:08 ` [PATCH] mm,numa,THP: initialize hstate for THP page size Andrew Morton
2013-12-18 22:20   ` Rik van Riel
2013-12-19 10:22     ` Michal Hocko
2013-12-19 15:18       ` Rik van Riel

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=20131218170314.1e57bea7@cuia.bos.redhat.com \
    --to=riel@redhat.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=chayang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=rientjes@google.com \
    --cc=vfalico@redhat.com \
    --cc=walken@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;
as well as URLs for NNTP newsgroup(s).