diff options
author | Eric Sandeen <sandeen@redhat.com> | 2009-07-05 22:17:31 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-07-05 22:17:31 -0400 |
commit | 089ceecc1ea4a69ed8bcc5c7c7b96ce487e26b33 (patch) | |
tree | 141821f26ff0d6e201f43b0c18b26075cea376a4 /fs | |
parent | f4a01017d678fe4baecf480e79d7c4f4b7ebc772 (diff) |
ext4: mark several more functions in mballoc.c as noinline
Ted noticed a stack-deep callchain through
writepages->ext4_mb_regular_allocator->ext4_mb_init_cache->submit_bh ...
With all the static functions in mballoc.c, gcc helpfully
inlines for us, and we get something like this:
ext4_mb_regular_allocator (232 bytes stack)
ext4_mb_init_cache (232 bytes stack)
submit_bh (starts 464 deeper)
the 2 ext4 functions here get several others inlined; by telling
gcc not to inline them, we can save stack space for when we
head off into submit_bh land and associated block layer callchains.
The following noinlined functions are only called once, so this
won't impact any other callchains:
ext4_mb_regular_allocator (104) (was 232)
ext4_mb_find_by_goal (56) (noinlined)
ext4_mb_init_group (24) (noinlined)
ext4_mb_init_cache (136) (was 232)
ext4_mb_generate_buddy (88) (noinlined)
ext4_mb_generate_from_pa (40) (noinlined)
submit_bh
ext4_mb_simple_scan_group (24) (noinlined)
ext4_mb_scan_aligned (56) (noinlined)
ext4_mb_complex_scan_group (40) (noinlined)
ext4_mb_try_best_found (24) (noinlined)
now when we head off into submit_bh() we're only 264 bytes deeper
in stack than when we entered ext4_mb_regular_allocator()
(vs. 464 bytes before). Every 200 bytes helps. :)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/mballoc.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 519a0a686d94..4a45efabb203 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -657,7 +657,8 @@ static void ext4_mb_mark_free_simple(struct super_block *sb, | |||
657 | } | 657 | } |
658 | } | 658 | } |
659 | 659 | ||
660 | static void ext4_mb_generate_buddy(struct super_block *sb, | 660 | static noinline_for_stack |
661 | void ext4_mb_generate_buddy(struct super_block *sb, | ||
661 | void *buddy, void *bitmap, ext4_group_t group) | 662 | void *buddy, void *bitmap, ext4_group_t group) |
662 | { | 663 | { |
663 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); | 664 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); |
@@ -1480,7 +1481,8 @@ static void ext4_mb_measure_extent(struct ext4_allocation_context *ac, | |||
1480 | ext4_mb_check_limits(ac, e4b, 0); | 1481 | ext4_mb_check_limits(ac, e4b, 0); |
1481 | } | 1482 | } |
1482 | 1483 | ||
1483 | static int ext4_mb_try_best_found(struct ext4_allocation_context *ac, | 1484 | static noinline_for_stack |
1485 | int ext4_mb_try_best_found(struct ext4_allocation_context *ac, | ||
1484 | struct ext4_buddy *e4b) | 1486 | struct ext4_buddy *e4b) |
1485 | { | 1487 | { |
1486 | struct ext4_free_extent ex = ac->ac_b_ex; | 1488 | struct ext4_free_extent ex = ac->ac_b_ex; |
@@ -1507,7 +1509,8 @@ static int ext4_mb_try_best_found(struct ext4_allocation_context *ac, | |||
1507 | return 0; | 1509 | return 0; |
1508 | } | 1510 | } |
1509 | 1511 | ||
1510 | static int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, | 1512 | static noinline_for_stack |
1513 | int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, | ||
1511 | struct ext4_buddy *e4b) | 1514 | struct ext4_buddy *e4b) |
1512 | { | 1515 | { |
1513 | ext4_group_t group = ac->ac_g_ex.fe_group; | 1516 | ext4_group_t group = ac->ac_g_ex.fe_group; |
@@ -1566,7 +1569,8 @@ static int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, | |||
1566 | * The routine scans buddy structures (not bitmap!) from given order | 1569 | * The routine scans buddy structures (not bitmap!) from given order |
1567 | * to max order and tries to find big enough chunk to satisfy the req | 1570 | * to max order and tries to find big enough chunk to satisfy the req |
1568 | */ | 1571 | */ |
1569 | static void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac, | 1572 | static noinline_for_stack |
1573 | void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac, | ||
1570 | struct ext4_buddy *e4b) | 1574 | struct ext4_buddy *e4b) |
1571 | { | 1575 | { |
1572 | struct super_block *sb = ac->ac_sb; | 1576 | struct super_block *sb = ac->ac_sb; |
@@ -1609,7 +1613,8 @@ static void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac, | |||
1609 | * In order to optimize scanning, caller must pass number of | 1613 | * In order to optimize scanning, caller must pass number of |
1610 | * free blocks in the group, so the routine can know upper limit. | 1614 | * free blocks in the group, so the routine can know upper limit. |
1611 | */ | 1615 | */ |
1612 | static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, | 1616 | static noinline_for_stack |
1617 | void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, | ||
1613 | struct ext4_buddy *e4b) | 1618 | struct ext4_buddy *e4b) |
1614 | { | 1619 | { |
1615 | struct super_block *sb = ac->ac_sb; | 1620 | struct super_block *sb = ac->ac_sb; |
@@ -1668,7 +1673,8 @@ static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, | |||
1668 | * we try to find stripe-aligned chunks for stripe-size requests | 1673 | * we try to find stripe-aligned chunks for stripe-size requests |
1669 | * XXX should do so at least for multiples of stripe size as well | 1674 | * XXX should do so at least for multiples of stripe size as well |
1670 | */ | 1675 | */ |
1671 | static void ext4_mb_scan_aligned(struct ext4_allocation_context *ac, | 1676 | static noinline_for_stack |
1677 | void ext4_mb_scan_aligned(struct ext4_allocation_context *ac, | ||
1672 | struct ext4_buddy *e4b) | 1678 | struct ext4_buddy *e4b) |
1673 | { | 1679 | { |
1674 | struct super_block *sb = ac->ac_sb; | 1680 | struct super_block *sb = ac->ac_sb; |
@@ -1831,7 +1837,8 @@ void ext4_mb_put_buddy_cache_lock(struct super_block *sb, | |||
1831 | 1837 | ||
1832 | } | 1838 | } |
1833 | 1839 | ||
1834 | static int ext4_mb_init_group(struct super_block *sb, ext4_group_t group) | 1840 | static noinline_for_stack |
1841 | int ext4_mb_init_group(struct super_block *sb, ext4_group_t group) | ||
1835 | { | 1842 | { |
1836 | 1843 | ||
1837 | int ret; | 1844 | int ret; |
@@ -3457,7 +3464,8 @@ static void ext4_mb_generate_from_freelist(struct super_block *sb, void *bitmap, | |||
3457 | * used in in-core bitmap. buddy must be generated from this bitmap | 3464 | * used in in-core bitmap. buddy must be generated from this bitmap |
3458 | * Need to be called with ext4 group lock held | 3465 | * Need to be called with ext4 group lock held |
3459 | */ | 3466 | */ |
3460 | static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, | 3467 | static noinline_for_stack |
3468 | void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, | ||
3461 | ext4_group_t group) | 3469 | ext4_group_t group) |
3462 | { | 3470 | { |
3463 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); | 3471 | struct ext4_group_info *grp = ext4_get_group_info(sb, group); |