+ zstd-move-params-structure-to-global-variable-to-reduce-stack-usage.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: crypto/zstd.c: move params structure to global variable to reduce stack usage
has been added to the -mm tree.  Its filename is
     zstd-move-params-structure-to-global-variable-to-reduce-stack-usage.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/zstd-move-params-structure-to-global-variable-to-reduce-stack-usage.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/zstd-move-params-structure-to-global-variable-to-reduce-stack-usage.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Maninder Singh <maninder1.s@xxxxxxxxxxx>
Subject: crypto/zstd.c: move params structure to global variable to reduce stack usage

As params structure remains same for lifetime, just initialise it
at init time and make it global variable.

Link: http://lkml.kernel.org/r/1559552526-4317-4-git-send-email-maninder1.s@xxxxxxxxxxx
Signed-off-by: Maninder Singh <maninder1.s@xxxxxxxxxxx>
Signed-off-by: Vaneet Narang <v.narang@xxxxxxxxxxx>
Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Cc: David S. Miller <davem@xxxxxxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx>
Cc: Joe Perches <joe@xxxxxxxxxxx>
Cc: Amit Sahrawat <a.sahrawat@xxxxxxxxxxx>
Cc: <pankaj.m@xxxxxxxxxxx>
Cc: Vaneet Narang <v.narang@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 crypto/zstd.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/crypto/zstd.c~zstd-move-params-structure-to-global-variable-to-reduce-stack-usage
+++ a/crypto/zstd.c
@@ -24,6 +24,8 @@ struct zstd_ctx {
 	void *dwksp;
 };
 
+static ZSTD_parameters params;
+
 static ZSTD_parameters zstd_params(void)
 {
 	return ZSTD_getParams(ZSTD_DEF_LEVEL, 0, 0);
@@ -32,8 +34,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) {
@@ -152,7 +156,6 @@ static int __zstd_compress(const u8 *src
 {
 	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, &params);
 	if (ZSTD_isError(out_len))
_

Patches currently in -mm which might be from maninder1.s@xxxxxxxxxxx are

zstd-pass-pointer-rathen-than-structure-to-functions.patch
zstd-use-u16-data-type-for-rankpos.patch
zstd-move-params-structure-to-global-variable-to-reduce-stack-usage.patch
zstd-change-structure-variable-from-int-to-char.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux