Skip to contentSkip to conversation

crypto: skcipher - Realign struct skcipher_walk to save 8 bytes

PATCH In review Thorsten Blum 2 participants 2 messages Apr 11, 2025 – Apr 16, 2025 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: skcipher - Realign struct skcipher_walk to save 8 bytes

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.

---
 include/crypto/internal/skcipher.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/crypto/internal/skcipher.h +1 -2
index a958ab0636ad..0cad8e7364c8 100644
@@ -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;
Signature · 1 line
2.49.0
maintainer
#1 lore raw
Quoted 15 lines · Thorsten Blum

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 */

Quoted 6 lines

No functional changes intended.

---
 include/crypto/internal/skcipher.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt