]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/util: reduce stack usage of folio_mapcount
authorKairui Song <kasong@tencent.com>
Mon, 1 Aug 2022 17:31:55 +0000 (01:31 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Aug 2022 05:02:50 +0000 (22:02 -0700)
commit2c88d0d6e6b9898b5f84eed96dd87bad3fb7e57f
tree367c3c13e75e89e5371265c3ecfac03bcf401fd8
parentf65c04e9e76b076cf80043598c338fa0019d60c5
mm/util: reduce stack usage of folio_mapcount

folio_test_hugetlb() will call PageHeadHuge which is a function call,
and blocks the compiler from recognizing this redundant load.

After rearranging the code, stack usage is dropped from 32 to 24, and
the function size is smaller (tested on GCC 12):

Before:
Stack usage:
mm/util.c:845:5:folio_mapcount  32      static
Size:
0000000000000ea0 00000000000000c7 T folio_mapcount

After:
Stack usage:
mm/util.c:845:5:folio_mapcount  24      static
Size:
0000000000000ea0 00000000000000b0 T folio_mapcount

Link: https://lkml.kernel.org/r/20220801173155.92008-1-ryncsn@gmail.com
Signed-off-by: Kairui Song <kasong@tencent.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/util.c