Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp413429imm; Thu, 28 Jun 2018 23:23:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJPA+gWOCpuZlDfjEKLP91R7WA79hPgoqZ9gS3FvCNSZZwegdgXT8BXeFs6480CVwztoMpl X-Received: by 2002:a63:a745:: with SMTP id w5-v6mr11668636pgo.374.1530253438971; Thu, 28 Jun 2018 23:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530253438; cv=none; d=google.com; s=arc-20160816; b=LjQUYgkvPiEjIH6fvEmp7bw2zfD4OYHSYuZQRF3fN9hxFX6l1npY8joVbYeoAiORCV 3Sta5Oqm5LLje2h/8sT/DJya4fqXnqatn9k0+0QHBOs3YdhpxMwxPRbbGcG8i2+VQK8g gISgixbLm0+BW7wsIl9Gez6cwJI1NcShUkJoTFXHZkxt+RtRjKsuArlgy1l5OYU0jrkr cCrMmnxMtI+evpBE/wnEBdsgVrQLBIHinb59r55kDJIW3j232DFvOwIAU9YxpMHn/I+D HnSduEjI9LqWGpt5qnoWKS0L50qv+qgxOdG8sUk1xOyTyCgZcoKmEihrGUb4ge1XBC9g v0qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=0Wg6EPR8kROalNpK3m966bmvq/1vI0FypjbSKpnUJTM=; b=Jw6hxpM3uhiP5QQsVdhFjsvH+VEi5LwZScbcKc9rUb1r8Brl9yz5ID+iY72j8P79a+ tERKaZA/M14Vw+Dtazsz3kNK3sX+EO8wzFP5dLxsspDXKn8lU/fosstiMrFZjxYmmBS2 jGhleimKfNCSnuoRJVBPTwB2Nx6xbsmzTCOMVueaEggXG3GenYwE/fhiH8UmVqy4i1ym B/qLpoFpHLr5ZjOL2Rnw9tJRjtTBN4+aqTeJ3Azx65Gc5l/RAWXPuwNZesga8lm4L4/Y qjM0ngSiWvoVqDPpZhvQVLKo3c7MFKANvrgM92qyDEF75TPJapmiUI+9s1j50v3AaPiZ OHvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cH1g+vE8; 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 g4-v6si8763746pfm.365.2018.06.28.23.23.44; Thu, 28 Jun 2018 23:23:58 -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=cH1g+vE8; 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 S935268AbeF1WRA (ORCPT + 99 others); Thu, 28 Jun 2018 18:17:00 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:37487 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933153AbeF1WQ7 (ORCPT ); Thu, 28 Jun 2018 18:16:59 -0400 Received: by mail-wr0-f196.google.com with SMTP id k6-v6so6958011wrp.4 for ; Thu, 28 Jun 2018 15:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0Wg6EPR8kROalNpK3m966bmvq/1vI0FypjbSKpnUJTM=; b=cH1g+vE8/vgNi7ceSWtNDTspZ/uLCz5lmop8rE+O1D1ICUWCSA53rlDZBbaUWG7W7s q6fa1dI+PCwRmt6KdqvHokLFGRaYYhteJ7GYYhA+HVvVxmPzQVQcckKd/AB8azlp/k2a M8kh6cvjv5q0ETmE85HsmX8MM0Uufa1CHPG5YFgNvlSujGra+JDKYqwf05YFhQpwDgBG /tjRStqf+QQoDw/g2jwr8pgdSEW2Q8KXnw0cd49rdUEVMDm/RPtJM2WTXje38t2fuKA6 u4ZkuFKljH5j9paNk4qzrfxi4179iuabvFiNF4cW2zg2XsXIhtLzli3mf6TY7A2vVoAg hygQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0Wg6EPR8kROalNpK3m966bmvq/1vI0FypjbSKpnUJTM=; b=GQrN3wq2aK9F676pzg9l/Bk0TlDYPLEVN0y5T42VFJAsDDg5qsftar15PtNpwQg5Tj PIGWMkbu3+nCNKhfSxO5jKIYj2Lz862cKYRicTLnhbYlahelP4R3szGzGwph3v9ZA0rs EkzTIAydg2HyKZL4tHPA1gSfxfDIgWE/MzFeiIwBU5s7t8q9WLs3kkAwU9dLBzjtGYTE VnpHRfnxB7jLw7tENce2jRWpOkxygpl8RY8JKgK0YPbnSCDkUd1yHfh2pcmkpWCEkwkY 4Y3pjRdxoj5ZN2T0JdsuMAuvIH2J2+YRkkVjX6py1z5ptWNxDkrDlyJj/CIXNYzUi5Ba SDdw== X-Gm-Message-State: APt69E1b56ZovzLFNfupErlp7CX7P39UteKElNfftMvXcabbXEQrDfuW SsZAQWtyslBL0DKgSAs5Lpbbe9iSl9i52AIGaXniAA== X-Received: by 2002:adf:b310:: with SMTP id j16-v6mr9752001wrd.207.1530224217727; Thu, 28 Jun 2018 15:16:57 -0700 (PDT) MIME-Version: 1.0 References: <20180627214447.260804-1-cannonmatthews@google.com> <20180628112139.GC32348@dhcp22.suse.cz> In-Reply-To: <20180628112139.GC32348@dhcp22.suse.cz> From: Cannon Matthews Date: Thu, 28 Jun 2018 15:16:46 -0700 Message-ID: Subject: Re: [PATCH] mm: hugetlb: yield when prepping struct pages To: mhocko@kernel.org, mike.kravetz@oracle.com Cc: akpm@linux-foundation.org, nyc@holomorphy.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andres Lagar-Cavilla , Peter Feiner , Greg Thelen 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 Thanks for the quick turnaround. Good to know about the how the 2M code path differs, I have been trying to trace through some of this and it's easy to get lost between which applies to which size. Thanks! On Thu, Jun 28, 2018 at 12:03 PM Michal Hocko wrote: > > On Wed 27-06-18 14:44:47, Cannon Matthews wrote: > > 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 > > Acked-by: Michal Hocko > > Thanks! > > > --- > > 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 > > -- > Michal Hocko > SUSE Labs