Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2009609imm; Tue, 10 Jul 2018 11:31:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf0+JzSvzXNEiEy81wmiqZ8zY7M+9mmzMUoNAbTqfPhcPULzSg67HGSpUYo8+5awYkA7J3x X-Received: by 2002:a65:57c9:: with SMTP id q9-v6mr24131132pgr.128.1531247503366; Tue, 10 Jul 2018 11:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531247503; cv=none; d=google.com; s=arc-20160816; b=c3v/z/IIcwt9cRlHRulVPZ46tQDHPxgSCSFGIV9gz/vNRZ1J923/j6/e1SZYy1ABwT YQ7znm3OP2yB7RZjJQdO8DGwzhma1nf3vZLqEa7fQxj0sUI3n8RFHngYPkhynEJAg2vZ 4U/EMKUkS/HuPqUqdD/3ypfRjXL+4yAOWUpnSg5yIhALQKKbWr2DMiIYNLOi6jOd3XFn dFY067q1eSo1g46zgsPBY+32jAqTo1JJ8T8WplHJ7BPId93JOq80CJyZ+YFxVYeVfOjj C0INj83TGcBnB8V90djcHLpWGbilg4ePgNTksHvwihE4K0hrRGjGz5nZTdcHzvz+Cxgz waWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bApL84Gi0wxwsksCTLcn7eVCfY1dppT2KMMaUwoAEyw=; b=nw6PWH/zYdOqHlmKFEbVujMy7p9DBKRd3eeZnV9xfbVaku0GA4/PykDi7Ca1Vga847 dokYx72lPc9x6GlQ9/RAGCXySikDVt97Dm2lEFPqfOhbY/XdBIuxVFAAF2+5HlT3qPbP jHKk2eMIddJtC9lh/ouHJssIahB2w5/jI5nd7tDHxpLT4m0HekYetEC9DgJlTB3bJxg9 WSIyXRvXAbHnpSe1qTo2RF2tUczJ2c3qi4RNHu74Lz8lxv0PLKZEvBsTMtmc9PN0Xavq bGA+tK8lsn/V+MDcGYEpVYmZVUNAS21MyiGcYVb1vvTNd3vBKrZMIu+peCh+XatGPuMA oJxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si17795466pgc.122.2018.07.10.11.31.27; Tue, 10 Jul 2018 11:31:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387875AbeGJS3w (ORCPT + 99 others); Tue, 10 Jul 2018 14:29:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45444 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732917AbeGJS3w (ORCPT ); Tue, 10 Jul 2018 14:29:52 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 26107EC6; Tue, 10 Jul 2018 18:29:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cannon Matthews , Andrew Morton , Mike Kravetz , Michal Hocko , Andres Lagar-Cavilla , Peter Feiner , Greg Thelen , Linus Torvalds Subject: [PATCH 4.9 19/52] mm: hugetlb: yield when prepping struct pages Date: Tue, 10 Jul 2018 20:24:47 +0200 Message-Id: <20180710182451.317666681@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710182449.285532226@linuxfoundation.org> References: <20180710182449.285532226@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Cannon Matthews commit 520495fe96d74e05db585fc748351e0504d8f40d upstream. 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 Reviewed-by: Andrew Morton Reviewed-by: Mike Kravetz Acked-by: Michal Hocko Cc: Andres Lagar-Cavilla Cc: Peter Feiner Cc: Greg Thelen Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2171,6 +2171,7 @@ static void __init gather_bootmem_preall */ if (hstate_is_gigantic(h)) adjust_managed_page_count(page, 1 << h->order); + cond_resched(); } }