linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave@sr71.net>
To: dave@sr71.net
Cc: kirill.shutemov@linux.intel.com, akpm@linux-foundation.org,
	n-horiguchi@ah.jp.nec.com, mike.kravetz@oracle.com,
	hillf.zj@alibaba-inc.com, rientjes@google.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	dave.hansen@linux.intel.com
Subject: [PATCH] mm, hugetlbfs: Fix new warning in fault-time huge page allocation
Date: Wed, 21 Oct 2015 14:56:58 -0700	[thread overview]
Message-ID: <20151021215658.ABDE5545@viggo.jf.intel.com> (raw)


From: Dave Hansen <dave.hansen@linux.intel.com>

Kirill reported that he hit:
>> +	if (vma || addr) {
>> +		WARN_ON_ONCE(!addr || addr == -1);
>
> Trinity triggered the WARN for me:

This was just a dumb mistake. I put the WARN_ON() in and planned to
have addr=0 mean "use nid". But, I realized pretty quickly that addr=0
_is_ a valid place to fault. So I made it addr=-1 in
__alloc_buddy_huge_page_no_mpol(), but I did not fix up the WARN_ON().

So hitting the warning in this case was harmless.  But, fix up the
warning condition.

Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: David Rientjes <rientjes@google.com>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>

---

 b/mm/hugetlb.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff -puN mm/hugetlb.c~hugetlbfs-fix-warn mm/hugetlb.c
--- a/mm/hugetlb.c~hugetlbfs-fix-warn	2015-10-21 14:40:15.809961389 -0700
+++ b/mm/hugetlb.c	2015-10-21 14:40:15.814961616 -0700
@@ -1520,8 +1520,14 @@ static struct page *__alloc_buddy_huge_p
 	if (hstate_is_gigantic(h))
 		return NULL;
 
-	if (vma || addr) {
-		VM_WARN_ON_ONCE(!addr || addr == -1);
+	/*
+	 * Make sure that anyone specifying 'nid' is not also
+	 * specifying a VMA.  This makes sure the caller is
+	 * picking _one_ of the modes with which we can call this
+	 * function, not both.
+	 */
+	if (vma || (addr != -1)) {
+		VM_WARN_ON_ONCE(addr == -1);
 		VM_WARN_ON_ONCE(nid != NUMA_NO_NODE);
 	}
 	/*
_

--
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:[~2015-10-21 21:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20151021215658.ABDE5545@viggo.jf.intel.com \
    --to=dave@sr71.net \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=hillf.zj@alibaba-inc.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=n-horiguchi@ah.jp.nec.com \
    --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