z3fold: use %z modifier for format string
PATCH 1/1 z3fold: use %z modifier for format string
Printing a size_t requires the %zd format rather than %d:
mm/z3fold.c: In function a??init_z3folda??:include/linux/kern_levels.h:4:18: error: format a??%da?? expects argument of type a??inta??, but argument 2 has type a??long unsigned inta?? [-Werror=format=]
--- mm/z3fold.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/z3fold.c +1 -1
@@ -884,7 +884,7 @@ static int __init init_z3fold(void) {/* Fail the initialization if z3fold header won't fit in one chunk */ if (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ) { -pr_err ("z3fold: z3fold_header size (%d) is bigger than " +pr_err ("z3fold: z3fold_header size (%zd) is bigger than " "the chunk size (%d), can't proceed\n" ,sizeof (struct z3fold_header ) ,ZHDR_SIZE_ALIGNED );return -E2BIG ;
Signature · 7 lines
2.9.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 16 lines · Arnd Bergmann
Printing a
size_trequires the %zd format rather than %d:
mm/z3fold.c: In function a??init_z3folda??:include/linux/kern_levels.h:4:18: error: format a??%da?? expects argument of type a??inta??, but argument 2 has type a??long unsigned inta?? [-Werror=format=]Fixes 50a50d2676c4 ("z3fold: don't fail kernel build if z3fold_header is too big")Signed-off-by Arnd Bergmann <[email protected]>--- mm/z3fold.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/z3fold.c +0
-0
mm/z3fold.c static int __init init_z3fold(void) · line 890
Quoted 8 lines
mm/z3fold.c +1
-1@@ -884,7 +884,7 @@ static int __init init_z3fold(void) {/* Fail the initialization if z3fold header won't fit in one chunk */ if (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ) { -pr_err ("z3fold: z3fold_header size (%d) is bigger than " +pr_err ("z3fold: z3fold_header size (%zd) is bigger than " "the chunk size (%d), can't proceed\n" ,sizeof (struct z3fold_header ) ,ZHDR_SIZE_ALIGNED );return -E2BIG ;
The embedded "z3fold: " prefix here should be removed as there's a pr_fmt that also adds it.
The test looks like it should be a BUILD_BUG_ON rather than any runtime test too.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi Joe,
Quoted 29 lines · Joe Perches
Quoted 16 lines · Arnd Bergmann
Printing a
size_trequires the %zd format rather than %d:
mm/z3fold.c: In function ‘init_z3fold’:include/linux/kern_levels.h:4:18: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]Fixes 50a50d2676c4 ("z3fold: don't fail kernel build if z3fold_header is too big")Signed-off-by Arnd Bergmann <[email protected]>--- mm/z3fold.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/z3fold.c +0
-0mm/z3fold.c static int __init init_z3fold(void) · line 890
Quoted 8 lines
mm/z3fold.c +1
-1@@ -884,7 +884,7 @@ static int __init init_z3fold(void) {/* Fail the initialization if z3fold header won't fit in one chunk */ if (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ) { -pr_err ("z3fold: z3fold_header size (%d) is bigger than " +pr_err ("z3fold: z3fold_header size (%zd) is bigger than " "the chunk size (%d), can't proceed\n" ,sizeof (struct z3fold_header ) ,ZHDR_SIZE_ALIGNED );return -E2BIG ;The embedded "z3fold: " prefix here should be removed as there's a
pr_fmtthat also adds it.
Quoted 2 lines
The test looks like it should be a
BUILD_BUG_ONrather than any runtime test too.
It used to be BUILD_BUG_ON but we deliberately changed that because sizeof(spinlock_t) gets bloated in debug builds, so it just won't build with default CHUNK_SIZE.
~vitaly
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 17 lines · CET Vitaly Wool
Quoted 17 lines
mm/z3fold.c static int __init init_z3fold(void) · line 890
Quoted 13 lines
mm/z3fold.c +1
-1@@ -884,7 +884,7 @@ static int __init init_z3fold(void) {/* Fail the initialization if z3fold header won't fit in one chunk */ if (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ) { -pr_err ("z3fold: z3fold_header size (%d) is bigger than " +pr_err ("z3fold: z3fold_header size (%zd) is bigger than " "the chunk size (%d), can't proceed\n" ,sizeof (struct z3fold_header ) ,ZHDR_SIZE_ALIGNED );return -E2BIG ;The embedded "z3fold: " prefix here should be removed as there's a
pr_fmtthat also adds it.
Quoted 6 lines
Quoted 2 lines
The test looks like it should be a
BUILD_BUG_ONrather than any runtime test too.It used to be
BUILD_BUG_ONbut we deliberately changed that becausesizeof(spinlock_t)gets bloated in debug builds, so it just won't build with defaultCHUNK_SIZE.
Could this be improved by making the CHUNK_SIZE bigger depending on the debug options?
Alternatively, how about using a bit_spin_lock instead of raw_spin_lock? That would guarantee a fixed size for the lock and make z3fold_header always 24 bytes (on 32-bit architectures) or 40 bytes
(on 64-bit architectures). You could even play some tricks with the first_num field to make it fit in the same word as the lock and make the structure fit into 32 bytes if you care about that.
Arnd
Quoted 21 lines · Arnd Bergmann
Quoted 20 lines · CET Vitaly Wool
Quoted 19 lines
mm/z3fold.c static int __init init_z3fold(void) · line 890
Quoted 13 lines
mm/z3fold.c +1
-1@@ -884,7 +884,7 @@ static int __init init_z3fold(void) {/* Fail the initialization if z3fold header won't fit in one chunk */ if (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ) { -pr_err ("z3fold: z3fold_header size (%d) is bigger than " +pr_err ("z3fold: z3fold_header size (%zd) is bigger than " "the chunk size (%d), can't proceed\n" ,sizeof (struct z3fold_header ) ,ZHDR_SIZE_ALIGNED );return -E2BIG ;The embedded "z3fold: " prefix here should be removed as there's a
pr_fmtthat also adds it.The test looks like it should be a
BUILD_BUG_ONrather than any runtime test too.
Quoted 6 lines
Quoted 3 lines
It used to be
BUILD_BUG_ONbut we deliberately changed that becausesizeof(spinlock_t)gets bloated in debug builds, so it just won't build with defaultCHUNK_SIZE.Could this be improved by making the
CHUNK_SIZEbigger depending on the debug options?
I don't see how silently enforcing a suboptimal configuration is better than failing the initialization (so that you can adjust CHUNK_SIZE yourself). I can add something descriptive to Documentation/vm/z3fold.txt for that matter.
Quoted 6 lines
Alternatively, how about using a
bit_spin_lockinstead ofraw_spin_lock? That would guarantee a fixed size for the lock and makez3fold_headeralways 24 bytes (on 32-bit architectures) or 40 bytes
(on 64-bit architectures). You could even play some tricks with thefirst_numfield to make it fit in the same word as the lock and make the structure fit into 32 bytes if you care about that.
That is interesting. Actually I can have that bit in page->private and then I don't need to handle headless pages in a special way, that sounds appealing. However, there is a warning about bit_spin_lock performance penalty. Do you know how big it is?
Best regards,
Vitaly
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 26 lines · CET Vitaly Wool
Quoted 25 lines · Arnd Bergmann
Quoted 23 lines · CET Vitaly Wool
Quoted 17 lines
mm/z3fold.c static int __init init_z3fold(void) · line 890
Quoted 13 lines
mm/z3fold.c +1
-1@@ -884,7 +884,7 @@ static int __init init_z3fold(void) {/* Fail the initialization if z3fold header won't fit in one chunk */ if (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ) { -pr_err ("z3fold: z3fold_header size (%d) is bigger than " +pr_err ("z3fold: z3fold_header size (%zd) is bigger than " "the chunk size (%d), can't proceed\n" ,sizeof (struct z3fold_header ) ,ZHDR_SIZE_ALIGNED );return -E2BIG ;The embedded "z3fold: " prefix here should be removed as there's a
pr_fmtthat also adds it.Quoted 2 lines
The test looks like it should be a
BUILD_BUG_ONrather than any runtime test too.It used to be
BUILD_BUG_ONbut we deliberately changed that becausesizeof(spinlock_t)gets bloated in debug builds, so it just won't build with defaultCHUNK_SIZE.
Quoted 7 lines
Quoted 2 lines
Could this be improved by making the
CHUNK_SIZEbigger depending on the debug options?I don't see how silently enforcing a suboptimal configuration is better than failing the initialization (so that you can adjust
CHUNK_SIZEyourself). I can add something descriptive toDocumentation/vm/z3fold.txtfor that matter.
Failing at runtime when you know it's broken at compile-time seems wrong, too. If you can't use z3fold with spinlock debugging, you may as well hide the option in Kconfig based on the other ones.
Printing a runtime warning for the suboptimal configuration but making it work anyway is probably better than just failing.
Quoted 11 lines
Quoted 6 lines
Alternatively, how about using a
bit_spin_lockinstead ofraw_spin_lock? That would guarantee a fixed size for the lock and makez3fold_headeralways 24 bytes (on 32-bit architectures) or 40 bytes
(on 64-bit architectures). You could even play some tricks with thefirst_numfield to make it fit in the same word as the lock and make the structure fit into 32 bytes if you care about that.That is interesting. Actually I can have that bit in
page->privateand then I don't need to handle headless pages in a special way, that sounds appealing. However, there is a warning aboutbit_spin_lockperformance penalty. Do you know how big it is?
No idea, sorry. On x86, test_and_set_bit() seems to be only one instruction to test/set the bit, followed by a conditional branch, compared to a cmpxchg() for the raw_spin_lock(), so the fast path seems pretty much the same.
Arnd
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 41 lines · Vitaly Wool
Quoted 21 lines · Arnd Bergmann
Quoted 20 lines · CET Vitaly Wool
Quoted 19 lines
mm/z3fold.c static int __init init_z3fold(void) · line 890
Quoted 13 lines
mm/z3fold.c +1
-1@@ -884,7 +884,7 @@ static int __init init_z3fold(void) {/* Fail the initialization if z3fold header won't fit in one chunk */ if (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ) { -pr_err ("z3fold: z3fold_header size (%d) is bigger than " +pr_err ("z3fold: z3fold_header size (%zd) is bigger than " "the chunk size (%d), can't proceed\n" ,sizeof (struct z3fold_header ) ,ZHDR_SIZE_ALIGNED );return -E2BIG ;The embedded "z3fold: " prefix here should be removed as there's a
pr_fmtthat also adds it.The test looks like it should be a
BUILD_BUG_ONrather than any runtime test too.Quoted 6 lines
Quoted 3 lines
It used to be
BUILD_BUG_ONbut we deliberately changed that becausesizeof(spinlock_t)gets bloated in debug builds, so it just won't build with defaultCHUNK_SIZE.Could this be improved by making the
CHUNK_SIZEbigger depending on the debug options?I don't see how silently enforcing a suboptimal configuration is better than failing the initialization (so that you can adjust
CHUNK_SIZEyourself). I can add something descriptive toDocumentation/vm/z3fold.txtfor that matter.Quoted 6 lines
Alternatively, how about using a
bit_spin_lockinstead ofraw_spin_lock? That would guarantee a fixed size for the lock and makez3fold_headeralways 24 bytes (on 32-bit architectures) or 40 bytes
(on 64-bit architectures). You could even play some tricks with thefirst_numfield to make it fit in the same word as the lock and make the structure fit into 32 bytes if you care about that.
Quoted 4 lines
That is interesting. Actually I can have that bit in
page->privateand then I don't need to handle headless pages in a special way, that sounds appealing. However, there is a warning aboutbit_spin_lockperformance penalty. Do you know how big it is?
all these patches you're sending are to improve performance...why would we then use bit spinlocks that degrade performance? let's just calculate the zhdr size correctly instead of assuming it's always < chunk size.
Quoted 3 lines
Best regards,
Vitaly
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi Arnd,
Quoted 7 lines · Arnd Bergmann
Printing a
size_trequires the %zd format rather than %d:
mm/z3fold.c: In function ‘init_z3fold’:include/linux/kern_levels.h:4:18: error: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Werror=format=]Fixes 50a50d2676c4 ("z3fold: don't fail kernel build if z3fold_header is too big")Signed-off-by Arnd Bergmann <[email protected]>
And thanks :)
~vitaly
Quoted 18 lines
--- mm/z3fold.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/z3fold.c +1
-2@@ -884,7 +884,7 @@ static int __init init_z3fold(void) {/* Fail the initialization if z3fold header won't fit in one chunk */ if (sizeof (struct z3fold_header ) >ZHDR_SIZE_ALIGNED ) { -pr_err ("z3fold: z3fold_header size (%d) is bigger than " +pr_err ("z3fold: z3fold_header size (%zd) is bigger than " "the chunk size (%d), can't proceed\n" ,sizeof (struct z3fold_header ) ,ZHDR_SIZE_ALIGNED );return -E2BIG ; --
Quoted 2 lines
2.9.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>