Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6680961ybi; Wed, 5 Jun 2019 04:56:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXgzlt48481n0JjeuJ/M6OC1WfeBqnwfBjdD906ICXaWs8ObhDj/P6lmooI50pKcSEe2PO X-Received: by 2002:aa7:8acb:: with SMTP id b11mr44948861pfd.115.1559735805712; Wed, 05 Jun 2019 04:56:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559735805; cv=none; d=google.com; s=arc-20160816; b=CsWgGziMnnRVyB7d026K9T22lpChyhG+ehmOP1Iw1AhRfkKJ+vINTSp/4cQlBLH9p9 Cva+WPdTjGDVceD96yrR0UGpfGuXRMRc1pbz9MRqlTDMDWxAYSYfAD8QTXpUyP190xtp dY6f+qIH1urmFlwoUTxIgHww/De6m0fKbZuSNYpw1Z3AUYPxEdyuYuOEYLGUmgfYkavV Y7zwTWlaXk0w1NN1Kqo4Szx3D0t3UKIUxkMhHz77zaS68K4uOGaFUb4xngaetBqJ2Ard rRV9p+BBcqgBqm/YePKHiqtOWx/AwGVQ7+2NMXr6L6cq3Jgw9eCPOXipoQG6yG5rNfrI 2UnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :reply-to:message-id:subject:cc:to:from:date; bh=9PAi29TOw80u5fLYsTOf/VAPCQhvherSx48FDKBeNM4=; b=BsGnMPthpGSDMw5AOkae98VBzhQi3vFCev33Of9lh7Pn7eNRq0ieY+qM62f4QjVFcf oLyMmA7TfjZhPJJBjzWaB07jDVm8gZ2sjSEh39AWnrwhgnTrZ4QnLe+WrUgcc08Mkxvo 4bURcD/L9PSYcQ4Cm4Vb/r0FOF3S3t+Hv0D1oTlGQlBK8fZQzemYqBSIeeY5I+UVeQRf MR8Xr1/xFHyqgE5h7xkp2puqGz1UfsxJ5gNBZCRIyup1YNWtMcFeppT5sekVMlJ9nG6v RAeaQSs6ir86wGkzJmb8+I6bo3R87sZ5vWVWbaokSyt1QOw1gT1BYeXbaXMe6m8X8XKD WyWg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t7si24780872pgu.3.2019.06.05.04.56.22; Wed, 05 Jun 2019 04:56:45 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727457AbfFEL4R (ORCPT + 99 others); Wed, 5 Jun 2019 07:56:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:34562 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727183AbfFEL4R (ORCPT ); Wed, 5 Jun 2019 07:56:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 703DEAC24; Wed, 5 Jun 2019 11:56:14 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 1DF95DA843; Wed, 5 Jun 2019 13:57:04 +0200 (CEST) Date: Wed, 5 Jun 2019 13:57:03 +0200 From: David Sterba To: Andrew Morton Cc: Maninder Singh , herbert@gondor.apana.org.au, davem@davemloft.net, keescook@chromium.org, gustavo@embeddedor.com, 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, Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org Subject: Re: [PATCH 1/4] zstd: pass pointer rathen than structure to functions Message-ID: <20190605115703.GY15290@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Andrew Morton , Maninder Singh , herbert@gondor.apana.org.au, davem@davemloft.net, keescook@chromium.org, gustavo@embeddedor.com, 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, Chris Mason , Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org References: <1559552526-4317-1-git-send-email-maninder1.s@samsung.com> <1559552526-4317-2-git-send-email-maninder1.s@samsung.com> <20190604154326.8868a10f896c148a0ce804d1@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190604154326.8868a10f896c148a0ce804d1@linux-foundation.org> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Tue, Jun 04, 2019 at 03:43:26PM -0700, Andrew Morton wrote: > On Mon, 3 Jun 2019 14:32:03 +0530 Maninder Singh wrote: > > > currently params structure is passed in all functions, which increases > > stack usage in all the function and lead to stack overflow on target like > > ARM with kernel stack size of 8 KB so better to pass pointer. > > > > Checked for ARM: > > > > Original Patched > > Call FLow Size: 1264 1040 > > .... > > (HUF_sort) -> 296 > > (HUF_buildCTable_wksp) -> 144 > > (HUF_compress4X_repeat) -> 88 > > (ZSTD_compressBlock_internal) -> 200 > > (ZSTD_compressContinue_internal)-> 136 -> 88 > > (ZSTD_compressCCtx) -> 192 -> 64 > > (zstd_compress) -> 144 -> 96 > > (crypto_compress) -> 32 > > (zcomp_compress) -> 32 > > .... > > > > Signed-off-by: Maninder Singh > > Signed-off-by: Vaneet Narang > > > > You missed btrfs. This needs review, please - particularly the > kernel-wide static ZSTD_parameters in zstd_get_btrfs_parameters(). > > The base patch is here: > > http://lkml.kernel.org/r/1559552526-4317-2-git-send-email-maninder1.s@samsung.com > > --- a/fs/btrfs/zstd.c~zstd-pass-pointer-rathen-than-structure-to-functions-fix > +++ a/fs/btrfs/zstd.c > @@ -27,15 +27,17 @@ > /* 307s to avoid pathologically clashing with transaction commit */ > #define ZSTD_BTRFS_RECLAIM_JIFFIES (307 * HZ) > > -static ZSTD_parameters zstd_get_btrfs_parameters(unsigned int level, > +static ZSTD_parameters *zstd_get_btrfs_parameters(unsigned int level, > size_t src_len) > { > - ZSTD_parameters params = ZSTD_getParams(level, src_len, 0); > + static ZSTD_parameters params; > + > + params = ZSTD_getParams(level, src_len, 0); No thats' broken, the params can't be static as it depends on level and src_len. What happens if there are several requests in parallel with eg. different levels? Would be really great if the mailinglist is CCed when the code is changed in a non-trivial way.