Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A28EC433F5 for ; Sat, 20 Nov 2021 16:53:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237798AbhKTQ4y (ORCPT ); Sat, 20 Nov 2021 11:56:54 -0500 Received: from sonic313-19.consmr.mail.gq1.yahoo.com ([98.137.65.82]:42661 "EHLO sonic313-19.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237787AbhKTQ4w (ORCPT ); Sat, 20 Nov 2021 11:56:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s2048; t=1637427229; bh=TfoAxPbVKq3zi4ZOFlupwW3LmX5ZEGSByQNRZE7lVEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=am3+4RQLcmR5Gf4mg/PhWbDNq2yIzWVbmom3oVsOsBJAVakIBwAXOqUskPiW+4rBE20ADCJlAorvH3D3oo1M1VdF0GlW7RnANrxrDw+uIaUPnp4v+5Y09Hpd82gaF50yM+UeR1TSdJlI4UxD9rBeBPeCwC7WVmUk540RfD7TdbiwnN2zlVg7i3Py8BlwQfNc1aS7EQaneJKIpa/dek6XWncsqVqdLUPVNdV0J2bbqbCXeRo+NbvTxB8ovf9AM0G2fiN68QIU/9W98V48IeX+wnrkEaA99jekasnoOYxSxPsystVbpBalo6l7K68qbRkEBCUtbz2LgYvd3iBr4eXosQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1637427229; bh=EaWA+RVHuaO6L/Bpvd9UKJ5L9Qd2Bx3pYfWduCZYvHV=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=seLD4luJ/rxpL+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K2XE8X3eQkJLdR1N4N3_JuanS4JHV93VtqtyjPSl227hEmWCDM4GskA1o5qT_3LemOmFUtwZuamv luXOXpWao6Kc8b84ORNioP5oqno9Md8JtbuBz3v2V5TiyCnUemPa1Z4DafYwpHP3NHh_x1aMmMNw a4UOgWWLMMA9DIabfj62puPzmFDkoftZcIuDy7_CoOwt.nulVHvrruxVEcYp4lGJzuMw4..Z3_1K wEJm5C0SUgd4ZkHi0hPVlivU8mycBdwqp47MNszQ2vBzT_b.rtdH9hPc1GMOm4h5OO03ZDI7RDub JkSSnRdkZilDPCrOU_dvspumP4zmwr1aLw8X0DeQzLspvo9ra9KjdYJ.j2ccw561geDNLrGVozeg WCTMbchqeLGw0T8wIFTSAMbuy3i_LGy_jrVilfk4bksYhD2EUjjEO5qRXKU.QCOcKcJnmwuBfN9. 6d7XgENCp30XpqaNnMoNqHkdeoUlEgzD8azaEYM6Bw8QtFu54ihCht2FbQjhihswLmM5fJjfCdW1 7XN.p8RI- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.gq1.yahoo.com with HTTP; Sat, 20 Nov 2021 16:53:49 +0000 Received: by kubenode520.mail-prod1.omega.bf1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 1fe9458f13b759c836a26a4b522c3af1; Sat, 20 Nov 2021 16:53:43 +0000 (UTC) From: "Alex Xu (Hello71)" To: Michael Forney , Masahiro Yamada , Michal Marek , Nick Desaulniers , Nick Terrell , Ingo Molnar , Sedat Dilek , Kees Cook , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: "Alex Xu (Hello71)" Subject: [PATCH 2/2] kbuild: pass --stream-size --no-content-size to zstd Date: Sat, 20 Nov 2021 11:53:49 -0500 Message-Id: <20211120165349.99908-2-alex_y_xu@yahoo.ca> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211120165349.99908-1-alex_y_xu@yahoo.ca> References: <20211120165349.99908-1-alex_y_xu@yahoo.ca> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Otherwise, it allocates 2 GB of memory at once. Even though the majority of this memory is never touched, the default heuristic overcommit refuses this request if less than 2 GB of RAM+swap is currently available. This results in "zstd: error 11 : Allocation error : not enough memory" and the kernel failing to build. When the size is specified, zstd will reduce the memory request appropriately. For typical kernel sizes of ~32 MB, the largest mmap request will be reduced to 512 MB, which will succeed on all but the smallest devices. For inputs around this size, --stream-size --no-content-size may slightly decrease the compressed size, or slightly increase it: https://github.com/facebook/zstd/issues/2848. Signed-off-by: Alex Xu (Hello71) --- scripts/Makefile.lib | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index ca901814986a..13d756fbcdc7 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -468,10 +468,10 @@ quiet_cmd_xzmisc = XZMISC $@ # be used because it would require zstd to allocate a 128 MB buffer. quiet_cmd_zstd = ZSTD $@ - cmd_zstd = { cat $(real-prereqs) | $(ZSTD) -19; $(size_append); } > $@ + cmd_zstd = { cat $(real-prereqs) | $(ZSTD) --stream-size=$(total_size) --no-content-size -19; $(size_append); } > $@ quiet_cmd_zstd22 = ZSTD22 $@ - cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) -22 --ultra; $(size_append); } > $@ + cmd_zstd22 = { cat $(real-prereqs) | $(ZSTD) --stream-size=$(total_size) --no-content-size -22 --ultra; $(size_append); } > $@ # ASM offsets # --------------------------------------------------------------------------- -- 2.34.0