linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: mballoc: avoid 20-argument function call
@ 2015-06-10 22:28 Rasmus Villemoes
  2015-06-15  4:36 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Rasmus Villemoes @ 2015-06-10 22:28 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger
  Cc: Rasmus Villemoes, linux-ext4, linux-kernel

Making a function call with 20 arguments is rather expensive in both
stack and .text. In this case, doing the formatting manually doesn't
make it any less readable, so we might as well save 155 bytes of .text
and 112 bytes of stack.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 fs/ext4/mballoc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 8d1e60214ef0..a74bbbd6d57d 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2257,12 +2257,9 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
 
 	group--;
 	if (group == 0)
-		seq_printf(seq, "#%-5s: %-5s %-5s %-5s "
-				"[ %-5s %-5s %-5s %-5s %-5s %-5s %-5s "
-				  "%-5s %-5s %-5s %-5s %-5s %-5s %-5s ]\n",
-			   "group", "free", "frags", "first",
-			   "2^0", "2^1", "2^2", "2^3", "2^4", "2^5", "2^6",
-			   "2^7", "2^8", "2^9", "2^10", "2^11", "2^12", "2^13");
+		seq_puts(seq, "#group: free  frags first ["
+			      " 2^0   2^1   2^2   2^3   2^4   2^5   2^6  "
+			      " 2^7   2^8   2^9   2^10  2^11  2^12  2^13  ]");
 
 	i = (sb->s_blocksize_bits + 2) * sizeof(sg.info.bb_counters[0]) +
 		sizeof(struct ext4_group_info);
-- 
2.1.3


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

* Re: ext4: mballoc: avoid 20-argument function call
  2015-06-10 22:28 [PATCH] ext4: mballoc: avoid 20-argument function call Rasmus Villemoes
@ 2015-06-15  4:36 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2015-06-15  4:36 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: Andreas Dilger, linux-ext4, linux-kernel

On Thu, Jun 11, 2015 at 12:28:02AM +0200, Rasmus Villemoes wrote:
> Making a function call with 20 arguments is rather expensive in both
> stack and .text. In this case, doing the formatting manually doesn't
> make it any less readable, so we might as well save 155 bytes of .text
> and 112 bytes of stack.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>

Thanks, applied.

						- Ted

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

end of thread, other threads:[~2015-06-15  4:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10 22:28 [PATCH] ext4: mballoc: avoid 20-argument function call Rasmus Villemoes
2015-06-15  4:36 ` Theodore Ts'o

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