linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] lib: zstd: Make symbol 'HUF_compressWeights_wksp' static
@ 2021-04-08 12:54 Zhao Xuehui
  2021-04-09  0:20 ` Nick Desaulniers
  0 siblings, 1 reply; 4+ messages in thread
From: Zhao Xuehui @ 2021-04-08 12:54 UTC (permalink / raw)
  To: gustavoars, sfr, ojeda, nathan, ndesaulniers, linux-kernel
  Cc: yangjihong1, zhangjinhao2, zhaoxuehui1

The symbol 'HUF_compressWeights_wksp' is not used outside of
huf_compress.c, so this commit marks it static.

Signed-off-by: Zhao Xuehui <zhaoxuehui1@huawei.com>
---
 lib/zstd/huf_compress.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
index fd32838c185f..1e5e001c3d41 100644
--- a/lib/zstd/huf_compress.c
+++ b/lib/zstd/huf_compress.c
@@ -79,7 +79,8 @@ unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxS
  * Note : all elements within weightTable are supposed to be <= HUF_TABLELOG_MAX.
  */
 #define MAX_FSE_TABLELOG_FOR_HUFF_HEADER 6
-size_t HUF_compressWeights_wksp(void *dst, size_t dstSize, const void *weightTable, size_t wtSize, void *workspace, size_t workspaceSize)
+static size_t HUF_compressWeights_wksp(void *dst, size_t dstSize, const void *weightTable,
+				       size_t wtSize, void *workspace, size_t workspaceSize)
 {
 	BYTE *const ostart = (BYTE *)dst;
 	BYTE *op = ostart;


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] lib: zstd: Make symbol 'HUF_compressWeights_wksp' static
  2021-04-08 12:54 [PATCH -next] lib: zstd: Make symbol 'HUF_compressWeights_wksp' static Zhao Xuehui
@ 2021-04-09  0:20 ` Nick Desaulniers
  2021-04-09  3:09   ` Miguel Ojeda
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Desaulniers @ 2021-04-09  0:20 UTC (permalink / raw)
  To: Zhao Xuehui, Nick Terrell
  Cc: Gustavo A . R . Silva, Stephen Rothwell, Miguel Ojeda,
	Nathan Chancellor, LKML, yangjihong1, zhangjinhao2

On Thu, Apr 8, 2021 at 5:55 AM Zhao Xuehui <zhaoxuehui1@huawei.com> wrote:
>
> The symbol 'HUF_compressWeights_wksp' is not used outside of
> huf_compress.c, so this commit marks it static.

Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

Quite a few other functions are declared in a header, but I don't see
any existing callers in tree.  I wonder if the maintainer could
consider cleaning these up so that we don't retain them in binaries
without dead code elimination enabled, or if there's a need to keep
this code in line with an external upstream codebase?

>
> Signed-off-by: Zhao Xuehui <zhaoxuehui1@huawei.com>
> ---
>  lib/zstd/huf_compress.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
> index fd32838c185f..1e5e001c3d41 100644
> --- a/lib/zstd/huf_compress.c
> +++ b/lib/zstd/huf_compress.c
> @@ -79,7 +79,8 @@ unsigned HUF_optimalTableLog(unsigned maxTableLog, size_t srcSize, unsigned maxS
>   * Note : all elements within weightTable are supposed to be <= HUF_TABLELOG_MAX.
>   */
>  #define MAX_FSE_TABLELOG_FOR_HUFF_HEADER 6
> -size_t HUF_compressWeights_wksp(void *dst, size_t dstSize, const void *weightTable, size_t wtSize, void *workspace, size_t workspaceSize)
> +static size_t HUF_compressWeights_wksp(void *dst, size_t dstSize, const void *weightTable,
> +                                      size_t wtSize, void *workspace, size_t workspaceSize)
>  {
>         BYTE *const ostart = (BYTE *)dst;
>         BYTE *op = ostart;
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] lib: zstd: Make symbol 'HUF_compressWeights_wksp' static
  2021-04-09  0:20 ` Nick Desaulniers
@ 2021-04-09  3:09   ` Miguel Ojeda
  2021-04-09 21:42     ` Nick Terrell
  0 siblings, 1 reply; 4+ messages in thread
From: Miguel Ojeda @ 2021-04-09  3:09 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Zhao Xuehui, Nick Terrell, Gustavo A . R . Silva,
	Stephen Rothwell, Miguel Ojeda, Nathan Chancellor, LKML,
	yangjihong1, zhangjinhao2

On Fri, Apr 9, 2021 at 2:20 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> Quite a few other functions are declared in a header, but I don't see
> any existing callers in tree.  I wonder if the maintainer could
> consider cleaning these up so that we don't retain them in binaries
> without dead code elimination enabled, or if there's a need to keep
> this code in line with an external upstream codebase?

Yeah, the equivalent cleanup was done upstream by Nick in 2018 [1],
but there has been no major update to lib/zstd since 2017.

Thus a cleanup would actually make it closer to upstream, which is the
best case scenario :)

    Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

[1] https://github.com/facebook/zstd/commit/f2d6db45cd28457fa08467416e8535985f062859

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] lib: zstd: Make symbol 'HUF_compressWeights_wksp' static
  2021-04-09  3:09   ` Miguel Ojeda
@ 2021-04-09 21:42     ` Nick Terrell
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Terrell @ 2021-04-09 21:42 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Nick Desaulniers, Zhao Xuehui, Gustavo A . R . Silva,
	Stephen Rothwell, Miguel Ojeda, Nathan Chancellor, LKML,
	yangjihong1, zhangjinhao2



> On Apr 8, 2021, at 8:09 PM, Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:
> 
> On Fri, Apr 9, 2021 at 2:20 AM Nick Desaulniers <ndesaulniers@google.com> wrote:
>> 
>> Quite a few other functions are declared in a header, but I don't see
>> any existing callers in tree.  I wonder if the maintainer could
>> consider cleaning these up so that we don't retain them in binaries
>> without dead code elimination enabled, or if there's a need to keep
>> this code in line with an external upstream codebase?
> 
> Yeah, the equivalent cleanup was done upstream by Nick in 2018 [1],
> but there has been no major update to lib/zstd since 2017.
> 
> Thus a cleanup would actually make it closer to upstream, which is the
> best case scenario :)
> 
>    Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
> 
> [1] https://github.com/facebook/zstd/commit/f2d6db45cd28457fa08467416e8535985f062859

This looks good to me as well. I have a patchset up to use upstream zstd directly in the kernel [0].
That will allow us to keep zstd up to date. And after that lands, I hope to set up a zstd linux tree
to make merging patches into lib/zstd easier, since over the years quite a few have been ignored.

[0] https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg2532407.html

Best,
Nick Terrell

> Cheers,
> Miguel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-09 21:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 12:54 [PATCH -next] lib: zstd: Make symbol 'HUF_compressWeights_wksp' static Zhao Xuehui
2021-04-09  0:20 ` Nick Desaulniers
2021-04-09  3:09   ` Miguel Ojeda
2021-04-09 21:42     ` Nick Terrell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).