linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: skcipher - Realign struct skcipher_walk to save 8 bytes
@ 2025-04-11 19:20 Thorsten Blum
  2025-04-16  7:59 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-04-11 19:20 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Eric Biggers
  Cc: Thorsten Blum, linux-crypto, linux-kernel

Reduce skcipher_walk's struct size by 8 bytes by realigning its members.

pahole output before:

  /* size: 120, cachelines: 2, members: 13 */
  /* sum members: 108, holes: 2, sum holes: 8 */
  /* padding: 4 */
  /* last cacheline: 56 bytes */

and after:

  /* size: 112, cachelines: 2, members: 13 */
  /* padding: 4 */
  /* last cacheline: 48 bytes */

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 include/crypto/internal/skcipher.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index a958ab0636ad..0cad8e7364c8 100644
--- a/include/crypto/internal/skcipher.h
+++ b/include/crypto/internal/skcipher.h
@@ -67,8 +67,6 @@ struct skcipher_walk {
 		struct scatter_walk in;
 	};
 
-	unsigned int nbytes;
-
 	union {
 		/* Virtual address of the destination. */
 		struct {
@@ -81,6 +79,7 @@ struct skcipher_walk {
 		struct scatter_walk out;
 	};
 
+	unsigned int nbytes;
 	unsigned int total;
 
 	u8 *page;
-- 
2.49.0


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

* Re: [PATCH] crypto: skcipher - Realign struct skcipher_walk to save 8 bytes
  2025-04-11 19:20 [PATCH] crypto: skcipher - Realign struct skcipher_walk to save 8 bytes Thorsten Blum
@ 2025-04-16  7:59 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2025-04-16  7:59 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: David S. Miller, Eric Biggers, linux-crypto, linux-kernel

On Fri, Apr 11, 2025 at 09:20:51PM +0200, Thorsten Blum wrote:
> Reduce skcipher_walk's struct size by 8 bytes by realigning its members.
> 
> pahole output before:
> 
>   /* size: 120, cachelines: 2, members: 13 */
>   /* sum members: 108, holes: 2, sum holes: 8 */
>   /* padding: 4 */
>   /* last cacheline: 56 bytes */
> 
> and after:
> 
>   /* size: 112, cachelines: 2, members: 13 */
>   /* padding: 4 */
>   /* last cacheline: 48 bytes */
> 
> No functional changes intended.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  include/crypto/internal/skcipher.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2025-04-16  7:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-11 19:20 [PATCH] crypto: skcipher - Realign struct skcipher_walk to save 8 bytes Thorsten Blum
2025-04-16  7:59 ` Herbert Xu

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).