Cannon Matthews 520495fe96 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/20180627214447.260804-1-cannonmatthews@google.com
Signed-off-by: Cannon Matthews <cannonmatthews@google.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Andres Lagar-Cavilla <andreslc@google.com>
Cc: Peter Feiner <pfeiner@google.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-07-03 17:32:19 -07:00
..
2018-06-07 17:34:36 -07:00
2018-06-08 17:21:52 -07:00
2018-06-05 13:24:20 -07:00
2018-06-08 17:21:52 -07:00
2017-11-15 18:21:05 -08:00
2018-04-11 10:28:39 -07:00
2018-06-07 17:34:35 -07:00
2018-06-15 07:55:25 +09:00
2018-06-07 17:34:35 -07:00
2018-04-11 10:28:32 -07:00
2018-06-07 17:34:36 -07:00
2018-06-07 17:34:36 -07:00
2018-06-15 07:55:25 +09:00
2018-06-07 17:34:36 -07:00
2018-04-20 17:18:35 -07:00
2018-04-27 17:13:20 -06:00
2018-06-15 07:55:25 +09:00
2018-06-12 16:19:22 -07:00
2018-04-11 10:28:39 -07:00
2018-06-07 17:34:36 -07:00
2018-04-11 10:28:39 -07:00
2018-05-11 17:28:45 -07:00
2018-02-06 18:32:48 -08:00
2018-06-15 07:55:25 +09:00