From patchwork Wed Jul 11 21:33:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cannon Matthews X-Patchwork-Id: 10520613 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 563DF605DC for ; Wed, 11 Jul 2018 21:33:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44224297CC for ; Wed, 11 Jul 2018 21:33:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37C1829872; Wed, 11 Jul 2018 21:33:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0879D297CC for ; Wed, 11 Jul 2018 21:33:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DB22D6B0003; Wed, 11 Jul 2018 17:33:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D62256B0006; Wed, 11 Jul 2018 17:33:19 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C777B6B0007; Wed, 11 Jul 2018 17:33:19 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-yw0-f198.google.com (mail-yw0-f198.google.com [209.85.161.198]) by kanga.kvack.org (Postfix) with ESMTP id 9C4796B0003 for ; Wed, 11 Jul 2018 17:33:19 -0400 (EDT) Received: by mail-yw0-f198.google.com with SMTP id q141-v6so13140163ywg.5 for ; Wed, 11 Jul 2018 14:33:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:mime-version:date:message-id :subject:from:to:cc; bh=nDBKPbf91Tai637uASRS6DK2AOgRvueX30bPuoQVNRQ=; b=fyGtPw8rFuDQgEDoXfZXwpDnZCMtHvaprCecVxWejH3X0e3CpqWS25SxsEjSOHM1i0 ++fg+nVebAVa6uW0DiTmyPDcC1dRztlGu9+6YAWewTREVqt4D42ZXngnmkEr4ChWXXI+ n64olVcq+WxkiyIydpZzULQ/0C3rA/qwEIhWEZtSNPqmykZxUSv/tXx7kej0RHJ0YphJ Swd0/i8kW0Ali+NqkAPEDfEXt9LOiNu4FGW83cMP5Xvn2HFnN3f831BwvrBbmoclqC9y B941VEuNFnl1UgQZsUXl5MPoLjO2zSxtT48KlUiYKN/6UuEwwtyQJmPxO0IUqFMWi5Kf EUjA== X-Gm-Message-State: AOUpUlHI+UkbZQXyTXwb46qD0ecSPDgdCk3TuWUyh1PJubY+pgP/9Dbh rI2JF0YKOZdErfTcWtBDYo18/zmX8DNU8wIgxJAGcZhNcg9BmF2A4TEwGfg0u602fdECVk0ws/Q iA8t9qqwjDBU+Gr8BpDHrvCfMd0Vm8GhsxpGkTwBoApT9E4VatWZxINo6JCNO0awLxMtiV0IBDX hn31lKeX5X5eBAJ6fV1/g2plbMf10JiZ7/7/lnUalUy7Lqw0v4/IbQ5OLg8hlKx1OqfMACJglG0 l0stskGvc71Hdo8mxCFVJAbOW0/pCsL01OJ/bSXIEv1jDkgUL8VcDnu6w8zBPD7cvH059sW59OE E4rkX4IJ0nwrMnTOtv64cGTUZDLBnt1IUxMNcP36HUZIIMDaski6z81dpBcIyO4uoKSa+BydP6j F X-Received: by 2002:a0d:d0c1:: with SMTP id s184-v6mr175675ywd.258.1531344799331; Wed, 11 Jul 2018 14:33:19 -0700 (PDT) X-Received: by 2002:a0d:d0c1:: with SMTP id s184-v6mr175648ywd.258.1531344798318; Wed, 11 Jul 2018 14:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531344798; cv=none; d=google.com; s=arc-20160816; b=L6OXZBxefik8euda6NGb87JZuNdWvGZoz0OQJOY8w8imCiiiwa0B1oAZnBGwLaNE5w uP6owIlanlkSmPBfCUSma8zR/VKtQmkYTRErkfZ2RrmYgazcWq7s5p6xceAhW0hx7QVf 3VT93H8P009ybHBc5aGgETKMa/GNs5Qr1muVaeHNRCoWUA7cHxq1smPE5weQCEg+LBNH QxsV2uIx0rxi/4TaQs6NuGjEyAdfGIwg5kIRXa5AH4KHV/vHlfmvCdSJqXYA2CxAieqo NN2mxPoujhPcYYN+Dt7ip6IP7CCI+cDhg9ST6f8V9BRePdLqdSbhvFlYxAXMz1Y3QPG2 iv8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:date:mime-version:dkim-signature :arc-authentication-results; bh=nDBKPbf91Tai637uASRS6DK2AOgRvueX30bPuoQVNRQ=; b=G6NCFDSM+wyuQFeAimK5/yYg3ZnsVzJTcf0uMwi+3+8KboYjs85AyPVqMBBzynTSD6 yv43ofTZMnQ+cffDKx69J+OWLlqhBRraHFz0rxBziOtwf/ZA/FHH2zikRJ6o17ShhyxI xWiBon38mdi6XuFWB/brDzf+VIeQx19J2UdOKfGQSH/SGCr+RVwq7r2579jnIrbeHeyn Wqr+pt3CbOkQXhywZzH+FPhnetfwOgkPmjrYFIOL90cA3HUqf0UFIA/JXc7nVDINFUvI zojz8YYPIJYgT6XdlW+J/AIpM70SlL16RuLTHVOaiEar0mxy7vW1NZcDSSCmoXNOjVjr qFoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QWTrTVAm; spf=pass (google.com: domain of 3nndgww4kcicnlyyzyxl44sp73rzzrwp.nzxwty58-xxv6lnv.z2r@flex--cannonmatthews.bounces.google.com designates 209.85.220.73 as permitted sender) smtp.mailfrom=3nndGWw4KCIcnlyyzyxl44sp73rzzrwp.nzxwty58-xxv6lnv.z2r@flex--cannonmatthews.bounces.google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f73.google.com (mail-sor-f73.google.com. [209.85.220.73]) by mx.google.com with SMTPS id d62-v6sor3842970ybd.208.2018.07.11.14.33.18 for (Google Transport Security); Wed, 11 Jul 2018 14:33:18 -0700 (PDT) Received-SPF: pass (google.com: domain of 3nndgww4kcicnlyyzyxl44sp73rzzrwp.nzxwty58-xxv6lnv.z2r@flex--cannonmatthews.bounces.google.com designates 209.85.220.73 as permitted sender) client-ip=209.85.220.73; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QWTrTVAm; spf=pass (google.com: domain of 3nndgww4kcicnlyyzyxl44sp73rzzrwp.nzxwty58-xxv6lnv.z2r@flex--cannonmatthews.bounces.google.com designates 209.85.220.73 as permitted sender) smtp.mailfrom=3nndGWw4KCIcnlyyzyxl44sp73rzzrwp.nzxwty58-xxv6lnv.z2r@flex--cannonmatthews.bounces.google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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-Smtp-Source: AAOMgpcSWnlt0E9gqUH99SLNsFfKaTe+AiJjILgsX/ADbqYoX4o2XfsThSMVPkyd+jBpo0EWHJKvfZKds2yyJ1i+Ax1Nwg== 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Mike Kravetz Acked-by: Michal Hocko --- 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(-) -- 2.18.0.203.gfac676dfb9-goog 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;