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>

authored by Eric Sandeen and committed by Theodore Ts'o 089ceecc f4a01017

+16 -8
+16 -8
fs/ext4/mballoc.c
··· 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 662 void *buddy, void *bitmap, ext4_group_t group) 662 663 { 663 664 struct ext4_group_info *grp = ext4_get_group_info(sb, group); ··· 1481 1480 ext4_mb_check_limits(ac, e4b, 0); 1482 1481 } 1483 1482 1484 - static int ext4_mb_try_best_found(struct ext4_allocation_context *ac, 1483 + static noinline_for_stack 1484 + int ext4_mb_try_best_found(struct ext4_allocation_context *ac, 1485 1485 struct ext4_buddy *e4b) 1486 1486 { 1487 1487 struct ext4_free_extent ex = ac->ac_b_ex; ··· 1509 1507 return 0; 1510 1508 } 1511 1509 1512 - static int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, 1510 + static noinline_for_stack 1511 + int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, 1513 1512 struct ext4_buddy *e4b) 1514 1513 { 1515 1514 ext4_group_t group = ac->ac_g_ex.fe_group; ··· 1569 1566 * The routine scans buddy structures (not bitmap!) from given order 1570 1567 * to max order and tries to find big enough chunk to satisfy the req 1571 1568 */ 1572 - static void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac, 1569 + static noinline_for_stack 1570 + void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac, 1573 1571 struct ext4_buddy *e4b) 1574 1572 { 1575 1573 struct super_block *sb = ac->ac_sb; ··· 1613 1609 * In order to optimize scanning, caller must pass number of 1614 1610 * free blocks in the group, so the routine can know upper limit. 1615 1611 */ 1616 - static void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, 1612 + static noinline_for_stack 1613 + void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, 1617 1614 struct ext4_buddy *e4b) 1618 1615 { 1619 1616 struct super_block *sb = ac->ac_sb; ··· 1673 1668 * we try to find stripe-aligned chunks for stripe-size requests 1674 1669 * XXX should do so at least for multiples of stripe size as well 1675 1670 */ 1676 - static void ext4_mb_scan_aligned(struct ext4_allocation_context *ac, 1671 + static noinline_for_stack 1672 + void ext4_mb_scan_aligned(struct ext4_allocation_context *ac, 1677 1673 struct ext4_buddy *e4b) 1678 1674 { 1679 1675 struct super_block *sb = ac->ac_sb; ··· 1837 1831 1838 1832 } 1839 1833 1840 - static int ext4_mb_init_group(struct super_block *sb, ext4_group_t group) 1834 + static noinline_for_stack 1835 + int ext4_mb_init_group(struct super_block *sb, ext4_group_t group) 1841 1836 { 1842 1837 1843 1838 int ret; ··· 3464 3457 * used in in-core bitmap. buddy must be generated from this bitmap 3465 3458 * Need to be called with ext4 group lock held 3466 3459 */ 3467 - static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, 3460 + static noinline_for_stack 3461 + void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap, 3468 3462 ext4_group_t group) 3469 3463 { 3470 3464 struct ext4_group_info *grp = ext4_get_group_info(sb, group);