Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp6853102imm; Wed, 27 Jun 2018 14:46:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLR28vfn/JsnVDbojZV8PR8p1iwpXODlePmtsyWrbi757yYVtp30yGvscutSXCeDu9ozgph X-Received: by 2002:a17:902:3081:: with SMTP id v1-v6mr7996815plb.266.1530136017354; Wed, 27 Jun 2018 14:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530136017; cv=none; d=google.com; s=arc-20160816; b=mlA3bh9D/mpY97lUXzypR7VA+V3gB5op1nHtSrZxnw2s0LSz8tMKEmsm7+14OsJMw7 J1rAQp98bmlFC6LmFgxMHAa9fVCYfutYw93QBElS6npwX/zE35tbITYSCF3g/gNHpYyP xorO7E/Ud7HqD3OwXhImkW7vBSqSxHL1XTlWrph3v6x+G1RIj4EneUhMGPkD31IPjBML AqTwWB9tu+7Gegwad3h13ZVU71+mBCMGyMkIArAAWl8iEi36a93z0O7r+WCp/qzyedSe ak0FhrFgoYATpg1aq8TueeavJB700GRU/BicydWLduJVpyKNU71kNiKMMEhcq7rwIgf0 yqaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:message-id:date :mime-version:dkim-signature:arc-authentication-results; bh=urO4q+tiItkRCEIpbjrzywMw7hfVdQdAHx4bAgIywCI=; b=AQlJXtCbrSRAqdQ8cL2gDu7qtaY+CekNmDLI9zqqrmqPlbX82maE/F8r9w+5ll2B9q VGBboD1gOVhq7fuRmHZdocFozs8w5RX6VjaCYAwgy6cZrgJkfxMbs7Cp2RwmYZKZH89v QuJbVcCi2kpa35MjHvi4zXIVV6UpKAKGHelJmXl/XHxx66Z+S+PDnw8QiLbCL8/fe5H0 l40hZ9yxsRBB/e5GP4AQ+dtM8s+6LDe+ss8b6P6yrKJ+CiCrOuRu1oUr1FmMbv32hvHQ 93AjVIxDRu3E0WDiCcHS9AWA3Zr4y87RJXgPd08MIbM27bptiewvYfgfVM/qGb+sGL2F zEQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IypmtCXU; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r9-v6si4319538pgf.664.2018.06.27.14.46.43; Wed, 27 Jun 2018 14:46:57 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=IypmtCXU; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755044AbeF0Vo4 (ORCPT + 99 others); Wed, 27 Jun 2018 17:44:56 -0400 Received: from mail-io0-f202.google.com ([209.85.223.202]:46430 "EHLO mail-io0-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751986AbeF0Voz (ORCPT ); Wed, 27 Jun 2018 17:44:55 -0400 Received: by mail-io0-f202.google.com with SMTP id d189-v6so2670733iog.13 for ; Wed, 27 Jun 2018 14:44:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:message-id:subject:from:to:cc; bh=urO4q+tiItkRCEIpbjrzywMw7hfVdQdAHx4bAgIywCI=; b=IypmtCXUgTyUTwhxq3vPhsCw7J4mbo4XNYAExZZ5j871dFf16lpu3bx50u5UqP+hyW ViAPGVokcEbA/hw191bM4cBt5HKEGLiqsyR26AURN1ONJU11cPODD8kFf7EtAyYZcPra 4ZMeyBKY6ZMnpWuwem7cIDG3FpWtZE+QDlTFYZb0kvQJ4ZazlY0unxhP1yysIxHkfLND 0zZw4C2j0vQHjzHxL7AUqqrZIJwexKq/lUXWMjuT+Qb0fIBMVa0QPIiepaLSDW6ObcxG a11vh4ylrfPOKWt+N5lscp0heDlEzga0P2VShXw5ikAMlFKzHRufujqD6JQtWUiqItA1 M1BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=urO4q+tiItkRCEIpbjrzywMw7hfVdQdAHx4bAgIywCI=; b=N5zYWdrvbjgvEsMBHBcQO7drYOxMjQZERzX5UoWV/FuhhE8z085cNO1gptH0NPFlFh jiRx+W0uonUxXGF7TEYJ4g+Z7TWRU0eQzndiVexSeLj0fX5Dws6M7rg8Y4NgTR2U8tEu brtttDKnIuixR/KYtGbEGezFpOeJwT3o3MT6ak31oze1VStpBNJeOxCvuJabFC8UOxKG lkj7ALkbeHCQkCLW0vpRja2AGmJgQzJNsyPJzJbG1F9T/Yvxe06/cvXGKODXmZSfgcF+ MFVcL6rVK+b2riRgLtvpYttR+yFT/5GTetKrn2rVHYzIQV8CHNP3lY0QKzzPPZSNwwnt 3v9Q== X-Gm-Message-State: APt69E3w8PAbhs5fpD95gUunO1K+XtB82J/r+rEiaNRxO7qtWOpXifCd uiEDfqQ78rpB8wbmG1F6PD5tsJcZMYKqQ319OdnlDg== MIME-Version: 1.0 X-Received: by 2002:a24:324d:: with SMTP id j74-v6mr3101177ita.26.1530135894703; Wed, 27 Jun 2018 14:44:54 -0700 (PDT) Date: Wed, 27 Jun 2018 14:44:47 -0700 Message-Id: <20180627214447.260804-1-cannonmatthews@google.com> X-Mailer: git-send-email 2.18.0.rc2.346.g013aa6912e-goog Subject: [PATCH] mm: hugetlb: yield when prepping struct pages From: Cannon Matthews To: Andrew Morton , Mike Kravetz , Nadia Yvette Chambers Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, andreslc@google.com, pfeiner@google.com, gthelen@google.com, Cannon Matthews 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 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. This should also apply to reserving the same amount of memory as 2M pages, as the same number of struct pages are affected in either case. 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. Signed-off-by: Cannon Matthews --- mm/hugetlb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a963f2034dfc..d38273c32d3b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2169,6 +2169,7 @@ static void __init gather_bootmem_prealloc(void) */ if (hstate_is_gigantic(h)) adjust_managed_page_count(page, 1 << h->order); + cond_resched(); } } -- 2.18.0.rc2.346.g013aa6912e-goog