Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3899638ybi; Mon, 3 Jun 2019 02:08:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqwELN7kS28hqHW36+PmYRnlyklphZ6UN6GXnqiP4wl3Q4dG2bZ/QJd3DkK+kQacXEBazaCy X-Received: by 2002:a63:1b07:: with SMTP id b7mr26454036pgb.289.1559552896836; Mon, 03 Jun 2019 02:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559552896; cv=none; d=google.com; s=arc-20160816; b=ihPCQ8+6CzjiYnQd3DHrRaYljhOIXXMkwG38QVjR/ZR5Vuzk2jRW/ARlwo6kdEfFgM 5ztLjICBTdz2bKRu7yW+trC/VFMDuVO2Q2PM/VGlo+yM4qf7PnXiNEvrclNF/9pE5UiB /jJFkeaVsarDLqpRtyNBIfq/4hapf5OeJZziIY1TV+RPpTIQ2ppBcOheZOuFn+6rOEbs /sXk+h+Dugya+LQIvFmfjxvwQQVDZrDUAtCCgnlseEN2A7mAEkUIQBPj4M8BNwPG9Ir/ g1r0/QhiBzbAAyb66r3+SGJip75NTL5FpryAoUmtr0lGwvIwwAtGWHlc83OSeAG68L0/ 7axg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=tZKqPAwV7Q+Pt/ObqE9NhR22cgjhADG2J0JuKnllm/4=; b=q54DoBXt9ssKf7SfGq+5K721JqpafC0M8MuHtCHBcYnD2gzd+9FqP8cyEtR3kM2aJA UcluPzs3yVcY2XttEjrs/X6w/saIBtOAmAfXoilCH7LUJ3PPvkRjJw3VoIhRDA397fsd HschYGXcsPyIRrLU/t1dV3cfZhn2L9CsqlC8jxfm7iMJM2ayCD3Z+GPN6xKQcjxRhzg0 zMVAj6d36IX9Rm4zL8Kk9b1rNdrC1oAjcoVSZLinDfCAXPGFRmmWI00t4xcaiKtLbshv oA7o9mFHqSJ5yYoVkdDcaaELtURrIwRMliFbsAhg6qw4tTHMw/9H2fO48V3KRSKvbvxp T6Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="nf/hqcm5"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c19si18603262pfn.0.2019.06.03.02.08.02; Mon, 03 Jun 2019 02:08:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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=@samsung.com header.s=mail20170921 header.b="nf/hqcm5"; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727360AbfFCJHZ (ORCPT + 99 others); Mon, 3 Jun 2019 05:07:25 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:16379 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727335AbfFCJHZ (ORCPT ); Mon, 3 Jun 2019 05:07:25 -0400 Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190603090722epoutp044dfef7cf01a280e99f49facd9c28973b~kpQw2IJuB0302903029epoutp04b for ; Mon, 3 Jun 2019 09:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190603090722epoutp044dfef7cf01a280e99f49facd9c28973b~kpQw2IJuB0302903029epoutp04b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1559552842; bh=tZKqPAwV7Q+Pt/ObqE9NhR22cgjhADG2J0JuKnllm/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nf/hqcm5xapxruxe6VhNYh+0cAG3CWKfgTbnlrAytVS+8zvQ6wKfKoQhXYbNpuP0Z kaunCiF0XQ92BRtEkp1908XmND+yAMLkuBL9E9Agwm0RkB8n9Ib2TWy51EK0oZI7Yr eXaAcUEXij0gfHEi8bGQVp5Ot/1h8uUxWw0wnzSo= Received: from epsmges5p1new.samsung.com (unknown [182.195.40.196]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20190603090719epcas5p34f05154c41832ca075be91f6e662a513~kpQuHuszH0762807628epcas5p3X; Mon, 3 Jun 2019 09:07:19 +0000 (GMT) Received: from epcas5p4.samsung.com ( [182.195.41.42]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 42.83.04071.743E4FC5; Mon, 3 Jun 2019 18:07:19 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20190603090240epcas5p17d0881686df3fa3042d0b2d659e925b3~kpMphMo7D1265112651epcas5p1X; Mon, 3 Jun 2019 09:02:40 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190603090240epsmtrp104223169b072e7ef55a5656a6773954f~kpMpgUfKJ1674016740epsmtrp1i; Mon, 3 Jun 2019 09:02:40 +0000 (GMT) X-AuditID: b6c32a49-59fff70000000fe7-7d-5cf4e347b4a7 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id A6.FB.03662.F22E4FC5; Mon, 3 Jun 2019 18:02:39 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.135]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190603090237epsmtip284b1974d2fb7a21167a243f80a56cb01~kpMncDTHl1692616926epsmtip2S; Mon, 3 Jun 2019 09:02:37 +0000 (GMT) From: Maninder Singh To: akpm@linux-foundation.org, herbert@gondor.apana.org.au, davem@davemloft.net, keescook@chromium.org, gustavo@embeddedor.com Cc: joe@perches.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, a.sahrawat@samsung.com, pankaj.m@samsung.com, v.narang@samsung.com, Maninder Singh Subject: [PATCH 3/4] zstd: move params structure to global variable to reduce stack usage Date: Mon, 3 Jun 2019 14:32:05 +0530 Message-Id: <1559552526-4317-4-git-send-email-maninder1.s@samsung.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1559552526-4317-1-git-send-email-maninder1.s@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA01SfUgTYRzm3Z3bTVwcU+ltldnREA11t9o6Qysq9PoCSULIgV36ota+2k3N IDSxVa5SyyinpfSJSyqHmZhWWlG5MCzyg8rCvrUozQQRottuUv89z4/n48fvfQlMWS1VEXlm O7KZOSMlDcZb70fHxKa8nzRoXGdppu82YuquN0mZumdlOHOzQ804RxcwtW/f48xTp4l5Ozwt YV6010mZ+/UOnBn+dlPCdD85C9aEsLUlfTjb0jgkYa91qdnWe2r28ZkZnJ1092Ps8RY3YH95 IlKJ7cbEXMRlI1skMmdZsvPMOUnUprTMdZk6vYaOpROYFVSkmTOhJGr95tTY5DyjsCgVWcAZ 84VRKsfzVPyqRJsl344icy28PYlC1myjldZa43jOxOebc+KyLKaVtEaj1QnKHcbctsrLQdZ7 wXtdR6dBCXhOlAM5AcnlsPVqM14OggkleRvA4XcTQCQTAjleKhXJFIAVntNBs5ZTtWMBSyeA d91NEpH8BvDHsc+YTyUl46C7vcOvCiNLhKyXVf5gjOwC8KPjAvCpQkkDnBrpl/kwTqpha7XX P1eQyfDw6zuBvgg41HtESCUIOZkCvXdTfDmQ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ikkEB6Yklqdmpq QWoRTJaJg1OqgVFNr3AGw0ymGbFVV8LS501i3fX/G/f8FfNVTgieqZ6gNtXhxLyTN2VSS0Kq 1Ri0ei5WO0SWRVX7FO2XuKyiv++6hybDJA+TtRKLjodK821alRBRH6N2+sz2A480Z6+ctGHL 74u3rDcyyxnfamxIFZ26yV6hakZEbbr+7hlntioJ9qw4sVQvJFeJpTgj0VCLuag4EQADeWDp WgIAAA== X-CMS-MailID: 20190603090240epcas5p17d0881686df3fa3042d0b2d659e925b3 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20190603090240epcas5p17d0881686df3fa3042d0b2d659e925b3 References: <1559552526-4317-1-git-send-email-maninder1.s@samsung.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org As params structure remains same for lifetime, just initialise it at init time and make it global variable. Signed-off-by: Maninder Singh Signed-off-by: Vaneet Narang --- crypto/zstd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crypto/zstd.c b/crypto/zstd.c index 4e9ff22..80a9e5c 100644 --- a/crypto/zstd.c +++ b/crypto/zstd.c @@ -32,6 +32,8 @@ struct zstd_ctx { void *dwksp; }; +static ZSTD_parameters params; + static ZSTD_parameters zstd_params(void) { return ZSTD_getParams(ZSTD_DEF_LEVEL, 0, 0); @@ -40,8 +42,10 @@ static ZSTD_parameters zstd_params(void) static int zstd_comp_init(struct zstd_ctx *ctx) { int ret = 0; - const ZSTD_parameters params = zstd_params(); - const size_t wksp_size = ZSTD_CCtxWorkspaceBound(params.cParams); + size_t wksp_size; + + params = zstd_params(); + wksp_size = ZSTD_CCtxWorkspaceBound(params.cParams); ctx->cwksp = vzalloc(wksp_size); if (!ctx->cwksp) { @@ -160,7 +164,6 @@ static int __zstd_compress(const u8 *src, unsigned int slen, { size_t out_len; struct zstd_ctx *zctx = ctx; - const ZSTD_parameters params = zstd_params(); out_len = ZSTD_compressCCtx(zctx->cctx, dst, *dlen, src, slen, ¶ms); if (ZSTD_isError(out_len)) -- 2.7.4