All of lore.kernel.org
 help / color / mirror / Atom feed
From: gerald.schaefer@de.ibm.com (Gerald Schaefer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] mm: hugetlb: support gigantic surplus pages
Date: Tue, 8 Nov 2016 20:27:42 +0100	[thread overview]
Message-ID: <20161108202742.57ed120d@thinkpad> (raw)
In-Reply-To: <20161108091725.GA18678@sha-win-210.asiapac.arm.com>

On Tue, 8 Nov 2016 17:17:28 +0800
Huang Shijie <shijie.huang@arm.com> wrote:

> > I will look at the lockdep issue.
> I tested the new patch (will be sent out later) on the arm64 platform,
> and I did not meet the lockdep issue when I enabled the lockdep.
> The following is my config:
> 
> 	CONFIG_LOCKD=y
> 	CONFIG_LOCKD_V4=y
> 	CONFIG_LOCKUP_DETECTOR=y
>         # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
> 	CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
> 	CONFIG_DEBUG_SPINLOCK=y
> 	CONFIG_DEBUG_LOCK_ALLOC=y
> 	CONFIG_PROVE_LOCKING=y
> 	CONFIG_LOCKDEP=y
> 	CONFIG_LOCK_STAT=y
> 	CONFIG_DEBUG_LOCKDEP=y
> 	CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
> 	
> So do I miss something? 

Those options should be OK. Meanwhile I looked into this a little more,
and the problematic line/lock is spin_lock_irqsave(&z->lock, flags) at
the top of alloc_gigantic_page(). From the lockdep trace we see that
it is triggered by an mmap(), and then hugetlb_acct_memory() ->
__alloc_huge_page() -> alloc_gigantic_page().

However, in between those functions (inside gather_surplus_pages())
a NUMA_NO_NODE node id comes into play. And this finally results in
alloc_gigantic_page() being called with NUMA_NO_NODE as nid (which is
-1), and NODE_DATA(nid)->node_zones will then reach into Nirvana.

So, I guess the problem is a missing NUMA_NO_NODE check in
alloc_gigantic_page(), similar to the one in
__hugetlb_alloc_buddy_huge_page(). And somehow this was not a problem
before the gigantic surplus change.

WARNING: multiple messages have this Message-ID (diff)
From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
To: Huang Shijie <shijie.huang@arm.com>
Cc: akpm@linux-foundation.org, catalin.marinas@arm.com,
	n-horiguchi@ah.jp.nec.com, mhocko@suse.com,
	kirill.shutemov@linux.intel.com, aneesh.kumar@linux.vnet.ibm.com,
	mike.kravetz@oracle.com, linux-mm@kvack.org, will.deacon@arm.com,
	steve.capper@arm.com, kaly.xin@arm.com, nd@arm.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/2] mm: hugetlb: support gigantic surplus pages
Date: Tue, 8 Nov 2016 20:27:42 +0100	[thread overview]
Message-ID: <20161108202742.57ed120d@thinkpad> (raw)
In-Reply-To: <20161108091725.GA18678@sha-win-210.asiapac.arm.com>

On Tue, 8 Nov 2016 17:17:28 +0800
Huang Shijie <shijie.huang@arm.com> wrote:

> > I will look at the lockdep issue.
> I tested the new patch (will be sent out later) on the arm64 platform,
> and I did not meet the lockdep issue when I enabled the lockdep.
> The following is my config:
> 
> 	CONFIG_LOCKD=y
> 	CONFIG_LOCKD_V4=y
> 	CONFIG_LOCKUP_DETECTOR=y
>         # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
> 	CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
> 	CONFIG_DEBUG_SPINLOCK=y
> 	CONFIG_DEBUG_LOCK_ALLOC=y
> 	CONFIG_PROVE_LOCKING=y
> 	CONFIG_LOCKDEP=y
> 	CONFIG_LOCK_STAT=y
> 	CONFIG_DEBUG_LOCKDEP=y
> 	CONFIG_DEBUG_LOCKING_API_SELFTESTS=y
> 	
> So do I miss something? 

Those options should be OK. Meanwhile I looked into this a little more,
and the problematic line/lock is spin_lock_irqsave(&z->lock, flags) at
the top of alloc_gigantic_page(). From the lockdep trace we see that
it is triggered by an mmap(), and then hugetlb_acct_memory() ->
__alloc_huge_page() -> alloc_gigantic_page().

However, in between those functions (inside gather_surplus_pages())
a NUMA_NO_NODE node id comes into play. And this finally results in
alloc_gigantic_page() being called with NUMA_NO_NODE as nid (which is
-1), and NODE_DATA(nid)->node_zones will then reach into Nirvana.

So, I guess the problem is a missing NUMA_NO_NODE check in
alloc_gigantic_page(), similar to the one in
__hugetlb_alloc_buddy_huge_page(). And somehow this was not a problem
before the gigantic surplus change.

--
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:[~2016-11-08 19:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03  2:51 [PATCH 0/2] mm: fix the "counter.sh" failure for libhugetlbfs Huang Shijie
2016-11-03  2:51 ` Huang Shijie
2016-11-03  2:51 ` [PATCH 1/2] mm: hugetlb: rename some allocation functions Huang Shijie
2016-11-03  2:51   ` Huang Shijie
2016-11-04  3:11   ` [PATCH] " Huang Shijie
2016-11-04  3:11     ` Huang Shijie
2016-11-03  2:51 ` [PATCH 2/2] mm: hugetlb: support gigantic surplus pages Huang Shijie
2016-11-03  2:51   ` Huang Shijie
2016-11-03  3:13   ` kbuild test robot
2016-11-03  3:13     ` kbuild test robot
2016-11-07 15:25   ` Gerald Schaefer
2016-11-07 15:25     ` Gerald Schaefer
2016-11-08  2:19     ` Huang Shijie
2016-11-08  2:19       ` Huang Shijie
2016-11-08  7:08       ` Huang Shijie
2016-11-08  7:08         ` Huang Shijie
2016-11-08  9:17         ` Huang Shijie
2016-11-08  9:17           ` Huang Shijie
2016-11-08 19:27           ` Gerald Schaefer [this message]
2016-11-08 19:27             ` Gerald Schaefer
2016-11-09  7:12             ` Huang Shijie
2016-11-09  7:12               ` Huang Shijie
2016-11-09  7:08   ` [PATCH v2 " Huang Shijie
2016-11-09  7:08     ` Huang Shijie
2016-11-09 15:55     ` Gerald Schaefer
2016-11-09 15:55       ` Gerald Schaefer
2016-11-10  7:03       ` Huang Shijie
2016-11-10  7:03         ` Huang Shijie
2016-11-03 17:22 ` [PATCH 0/2] mm: fix the "counter.sh" failure for libhugetlbfs Randy Dunlap
2016-11-03 17:22   ` Randy Dunlap
2016-11-04  1:59   ` Huang Shijie
2016-11-04  1:59     ` Huang Shijie

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=20161108202742.57ed120d@thinkpad \
    --to=gerald.schaefer@de.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.