Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1716690

Re: [PATCH 2/2] dm integrity: use init_completion instead of COMPLETION_INITIALIZER_ONSTACK

From Mike Snitzer <snitzer@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] dm integrity: use init_completion instead of COMPLETION_INITIALIZER_ONSTACK
Date 2017-08-21 18:20 +0200
Message-ID <ugXAL-6Cy-35@gated-at.bofh.it> (permalink)
References <ueLNo-2Xb-11@gated-at.bofh.it> <ueLNo-2Xb-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Aug 15 2017 at 11:11am -0400,
Arnd Bergmann <arnd@arndb.de> wrote:

> The new lockdep support for completions causeed the stack usage
> in dm-integrity to explode, in case of write_journal from 504 bytes
> to 1120 (using arm gcc-7.1.1):
> 
> drivers/md/dm-integrity.c: In function 'write_journal':
> drivers/md/dm-integrity.c:827:1: error: the frame size of 1120 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
> 
> The problem is that not only the size of 'struct completion' grows
> significantly, but we end up having multiple copies of it on the stack
> when we assign it from a local variable after the initial declaration.
> 
> COMPLETION_INITIALIZER_ONSTACK() is the right thing to use when we
> want to declare and initialize a completion on the stack. However,
> this driver doesn't do that and instead initializes the completion
> just before it is used.
> 
> In this case, init_completion() does the same thing more efficiently,
> and drops the stack usage for the function above down to 496 bytes.
> While the other functions in this file are not bad enough to cause
> a warning, they benefit equally from the change, so I do the change
> across the entire file. In the one place where we reuse a completion,
> I picked the cheaper reinit_completion() over init_completion().
> 
> Fixes: cd8084f91c02 ("locking/lockdep: Apply crossrelease to completions")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> The patch causing this is currently part of linux-next, scheduled for
> 4.14, so it would be good to have this in the same release.

This looks good.  Please just stage it for 4.14 along with its
dependencies via whatever tree they are going in.

Acked-by: Mike Snitzer <snitzer@redhat.com>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] mmc: test: reduce stack usage in mmc_test_nonblock_transfer Arnd Bergmann <arnd@arndb.de> - 2017-08-15 17:20 +0200
  [PATCH 2/2] dm integrity: use init_completion instead of COMPLETION_INITIALIZER_ONSTACK Arnd Bergmann <arnd@arndb.de> - 2017-08-15 17:20 +0200
    Re: [dm-devel] [PATCH 2/2] dm integrity: use init_completion instead  of COMPLETION_INITIALIZER_ONSTACK Mikulas Patocka <mpatocka@redhat.com> - 2017-08-16 18:20 +0200
    Re: [PATCH 2/2] dm integrity: use init_completion instead of  COMPLETION_INITIALIZER_ONSTACK Mike Snitzer <snitzer@redhat.com> - 2017-08-21 18:20 +0200
  Re: [PATCH 1/2] mmc: test: reduce stack usage in  mmc_test_nonblock_transfer Adrian Hunter <adrian.hunter@intel.com> - 2017-08-16 12:30 +0200
  Re: [PATCH 1/2] mmc: test: reduce stack usage in mmc_test_nonblock_transfer Ulf Hansson <ulf.hansson@linaro.org> - 2017-08-22 13:20 +0200

csiph-web