2008-02-01 20:22:31

by Eric Sandeen

[permalink] [raw]
Subject: [PATCH] make mballoc history a config option

mballoc history is likely a great debugging tool, but it seems a
bit heavyweight. If I make it a config option and turn it off,
things lighten up considerably, from:

220 ext4_mb_free_blocks
188 ext4_mb_seq_groups_show
176 ext4_mb_regular_allocator
164 ext4_mb_init_cache
156 ext4_mb_new_blocks
152 ext4_mb_release_inode_pa
136 ext4_mb_seq_history_show
124 ext4_mb_release_group_pa
124 ext4_mb_init
...

to:

176 ext4_mb_regular_allocator
164 ext4_mb_init_cache
156 ext4_mb_new_blocks
124 ext4_mb_init
112 ext4_mb_free_blocks
...
44 ext4_mb_release_inode_pa
...
16 ext4_mb_release_group_pa

It's a bit shocking how much this matters to the size of
ext4_mb_release_inode_pa etc; I've not yet found the
reason why.

Signed-off-by: Eric Sandeen <[email protected]>

---

Index: linux-2.6.24-git9/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.24-git9.orig/fs/ext4/mballoc.c
+++ linux-2.6.24-git9/fs/ext4/mballoc.c
@@ -367,10 +367,9 @@
#endif

/*
- * with EXT4_MB_HISTORY mballoc stores last N allocations in memory
- * and you can monitor it in /proc/fs/ext4/<dev>/mb_history
+ * with CONFIG_EXT4DEV_FS_MBHISTORY mballoc stores last N allocations in
+ * memory and you can monitor it in /proc/fs/ext4/<dev>/mb_history
*/
-#define EXT4_MB_HISTORY
#define EXT4_MB_HISTORY_ALLOC 1 /* allocation */
#define EXT4_MB_HISTORY_PREALLOC 2 /* preallocated blocks used */
#define EXT4_MB_HISTORY_DISCARD 4 /* preallocation discarded */
@@ -562,7 +561,7 @@ struct ext4_buddy {
#define EXT4_MB_BITMAP(e4b) ((e4b)->bd_bitmap)
#define EXT4_MB_BUDDY(e4b) ((e4b)->bd_buddy)

-#ifndef EXT4_MB_HISTORY
+#ifndef CONFIG_EXT4DEV_FS_MBHISTORY
static inline void ext4_mb_store_history(struct ext4_allocation_context *ac)
{
return;
@@ -2093,7 +2092,7 @@ out:
return err;
}

-#ifdef EXT4_MB_HISTORY
+#ifdef CONFIG_EXT4DEV_FS_MBHISTORY
struct ext4_mb_proc_session {
struct ext4_mb_history *history;
struct super_block *sb;
Index: linux-2.6.24-rc6-mm1/fs/Kconfig
===================================================================
--- linux-2.6.24-rc6-mm1.orig/fs/Kconfig
+++ linux-2.6.24-rc6-mm1/fs/Kconfig
@@ -202,6 +202,13 @@ config EXT4DEV_FS_SECURITY
If you are not using a security module that requires using
extended attributes for file security labels, say N.

+config EXT4DEV_FS_MBHISTORY
+ bool "Ext4dev mballoc allocator history"
+ help
+ Enabling this option make it possible to monitor mballoc
+ allocator history via /proc/fs/ext4/<dev>/mb_history.
+ Disabling this option will save memory and stack space.
+
config JBD
tristate
help


2008-02-01 21:17:00

by Eric Sandeen

[permalink] [raw]
Subject: Re: [PATCH] make mballoc history a config option

Eric Sandeen wrote:

> It's a bit shocking how much this matters to the size of
> ext4_mb_release_inode_pa etc; I've not yet found the
> reason why.

Oh, well, duh - its' the big 108 byte allocation context on the
stack.... and if it's not used it gets optimized away.

I think it's worth looking at allocating that one.

-Eric

2008-02-01 21:52:53

by Eric Sandeen

[permalink] [raw]
Subject: Re: [PATCH] make mballoc history a config option

Eric Sandeen wrote:
> Eric Sandeen wrote:
>
>> It's a bit shocking how much this matters to the size of
>> ext4_mb_release_inode_pa etc; I've not yet found the
>> reason why.
>
> Oh, well, duh - its' the big 108 byte allocation context on the
> stack.... and if it's not used it gets optimized away.
>
> I think it's worth looking at allocating that one.

Ok, hold off on that patch for now, sorry, looking at it more I think it
should be done better.

-Eric