Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1200329imm; Wed, 11 Jul 2018 19:59:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeErkM5pAy3DPNwq22YLYRKeh+Pg3wT5WeJsSMCna7NMCfIE2ynvYnhJfZsmteG14RgXvom X-Received: by 2002:a62:23d1:: with SMTP id q78-v6mr456494pfj.179.1531364371878; Wed, 11 Jul 2018 19:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531364371; cv=none; d=google.com; s=arc-20160816; b=QT022ebmyoHxyHXN7PMJ32CuIthbEKKTWYQLURHpHS67oGKIdSBADoLZ7A9PJb/Ve3 wlytMbEq44eP9zVdzntSRQKdiTu1dD5q3JAGh6ZzwfXoTqz5D/2O+8hJcU5NH3fk3DO4 X9Uu08gY9YdlvIJnIizxnmTxsKc4WDSldR4IU+UTnXXjwzKl+2jn8BvVwKRBnCEHX2vT rus4qyVQTos1+GvzbnBRu/Wf4/1EwwIwIqRwOFIy86IQvDVXHsysnpcoIPwoQQHH1863 2eu8hq5UhyLI/s9Wz1p87iF0eLEkgiIY75s9W7svm78T+HQGJlCpHjpQnDnGBSqDs2wX 48jg== 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=nDBKPbf91Tai637uASRS6DK2AOgRvueX30bPuoQVNRQ=; b=me6WgvuxdA8ERm6UJb1yxwJIduffDxNwudUTH2wClHFJQ3hZ3oWnZGSi0p5InZzygH l0TIFRxsbHa4o61gZuHv8h99vxchvwpahDOyK+Dw32N8At8U/CBv682SEn/n0FnPM+b4 0fpEiWBOB9i9qZhhHw8YU8ChA1T5a7PtraDP+Dh01YSxp1ab7S4bJ9dzjFlXnNdGcdCE Tr8qokSgLuWNZorVuDhicvAbJCNVc8c25u8tybz0pUNJJOH/P2T4Mqw38Bf3DzH4qKgt RFyZE+HsVQg36QUDTWUYNwr074EBU4kZJ1jK4g9KyIkEsAUjksQWkOW3GnmB+lrsIIol YAgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QWTrTVAm; 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 s2-v6si20125206plr.393.2018.07.11.19.59.16; Wed, 11 Jul 2018 19:59:31 -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=QWTrTVAm; 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 S2389743AbeGKVjg (ORCPT + 99 others); Wed, 11 Jul 2018 17:39:36 -0400 Received: from mail-yb0-f201.google.com ([209.85.213.201]:54677 "EHLO mail-yb0-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387551AbeGKVjg (ORCPT ); Wed, 11 Jul 2018 17:39:36 -0400 Received: by mail-yb0-f201.google.com with SMTP id a12-v6so7433385ybe.21 for ; Wed, 11 Jul 2018 14:33:18 -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=nDBKPbf91Tai637uASRS6DK2AOgRvueX30bPuoQVNRQ=; b=QWTrTVAmvfyfiuhv/Q5L8n6X4LMq3CvOK285YTQzlG3supwHfL4zLVorNxYoxO1qM5 7pD3PautBCA/U+wQHj53is1vKifAB2CfnXg2+p7+JqfPSMMxyWQbRP4/agOFGV/PZRua 9RTEzQgj4Ol5Ky6lP1n0iIWvQ5BJskpany4tabwPXITQ/BOyfBqnjonS2l+2pvqDv2xJ UlNAqEBLmCS4hmSuBLK1NlcBUDEcn+dPdoLwV91pFF6FGzo/dOt2KkVJ5wTtM3ugej4O 13tdLUpHlF70haqhzEa0QYb5n7dFziCwOb92cV+ebJTly/qExlygTsVm6xs9Ml+2sGSh RaAg== 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=nDBKPbf91Tai637uASRS6DK2AOgRvueX30bPuoQVNRQ=; b=lNJKY4P8rHUHhbIRDdA9n9utvZiQ+qOUQ7i0XWnDLbz4/Za/qDHR+gt9YU5Wy8ciZJ feRBUNHqrDR38Z3lJJajxTuv5EIt/F0m+MJMwZ/MUJOnlD3iHNG3cWI+hDFSBXWtJ36B J//hQWmn0kV2rJ479mwixeRFvK+3OsvTWDExgPTUCoiJLSXYLElzW2ySpFEy3wq2NcyK X85UrVs0iFdwTtzwLMuXWhWQyM9ipsgy+GQfaNnWdZUby5fflSaRKm72rScLhAbhg/jp TocgaBpxrmPaWkeC06S9g93ZoV9/mglr7Opy8vd2FL4163pVEbfDFTmz8YpnKY5seyW2 +6Ng== X-Gm-Message-State: AOUpUlEXLxHZv/akr/EEAnWrZZHCxyUkhEeUqYfUbU0eROSUnW4E5dwt DKE9m6KAW+8SB6o/lguAfMrKYMZpKxcOhoddX1h1BA== MIME-Version: 1.0 X-Received: by 2002:a25:c04b:: with SMTP id c72-v6mr130155ybf.51.1531344798000; Wed, 11 Jul 2018 14:33:18 -0700 (PDT) Date: Wed, 11 Jul 2018 14:33:13 -0700 Message-Id: <20180711213313.92481-1-cannonmatthews@google.com> X-Mailer: git-send-email 2.18.0.203.gfac676dfb9-goog Subject: [PATCH v2] mm: hugetlb: don't zero 1GiB bootmem 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, dmatlack@google.com, gthelen@google.com, mhocko@kernel.org, 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 using 1GiB pages during early boot, use the new memblock_virt_alloc_try_nid_raw() function to allocate memory without zeroing it. Zeroing out hundreds or thousands of GiB in a single core memset() call is very slow, and can make early boot last upwards of 20-30 minutes on multi TiB machines. The memory does not need to be zero'd as the hugetlb pages are always zero'd on page fault. Tested: Booted with ~3800 1G pages, and it booted successfully in roughly the same amount of time as with 0, as opposed to the 25+ minutes it would take before. Signed-off-by: Cannon Matthews --- v2: removed the memset of the huge_bootmem_page area and added INIT_LIST_HEAD instead. mm/hugetlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 3612fbb32e9d..488330f23f04 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2101,7 +2101,7 @@ int __alloc_bootmem_huge_page(struct hstate *h) for_each_node_mask_to_alloc(h, nr_nodes, node, &node_states[N_MEMORY]) { void *addr; - addr = memblock_virt_alloc_try_nid_nopanic( + addr = memblock_virt_alloc_try_nid_raw( huge_page_size(h), huge_page_size(h), 0, BOOTMEM_ALLOC_ACCESSIBLE, node); if (addr) { @@ -2119,6 +2119,7 @@ int __alloc_bootmem_huge_page(struct hstate *h) found: BUG_ON(!IS_ALIGNED(virt_to_phys(m), huge_page_size(h))); /* Put them into a private list first because mem_map is not up yet */ + INIT_LIST_HEAD(&m->list); list_add(&m->list, &huge_boot_pages); m->hstate = h; return 1; -- 2.18.0.203.gfac676dfb9-goog