diff options
author | Cannon Matthews <[email protected]> | 2018-07-03 17:02:43 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2018-07-03 17:32:19 -0700 |
commit | 520495fe96d74e05db585fc748351e0504d8f40d (patch) | |
tree | c0e3a926ecefc43e56bfc0b8d71e86e01f78f5c9 | |
parent | 1e2c043628c7736dd56536d16c0ce009bc834ae7 (diff) |
mm: hugetlb: yield when prepping struct pages
When booting with very large numbers of gigantic (i.e. 1G) pages, the
operations in the loop of gather_bootmem_prealloc, and specifically
prep_compound_gigantic_page, takes a very long time, and can cause a
softlockup if enough pages are requested at boot.
For example booting with 3844 1G pages requires prepping
(set_compound_head, init the count) over 1 billion 4K tail pages, which
takes considerable time.
Add a cond_resched() to the outer loop in gather_bootmem_prealloc() to
prevent this lockup.
Tested: Booted with softlockup_panic=1 hugepagesz=1G hugepages=3844 and
no softlockup is reported, and the hugepages are reported as
successfully setup.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Cannon Matthews <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Andres Lagar-Cavilla <[email protected]>
Cc: Peter Feiner <[email protected]>
Cc: Greg Thelen <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/hugetlb.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 3612fbb32e9d..039ddbc574e9 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2163,6 +2163,7 @@ static void __init gather_bootmem_prealloc(void) */ if (hstate_is_gigantic(h)) adjust_managed_page_count(page, 1 << h->order); + cond_resched(); } } |