Skip to content

Commit

Permalink
mm: uninline kstrdup()
Browse files Browse the repository at this point in the history
gcc inlines kstrdup into kstrdup_const() but it can very efficiently tail
call into it instead:

	$ ./scripts/bloat-o-meter ../vmlinux-000 ../obj/vmlinux
	add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-84 (-84)
	Function                                     old     new   delta
	kstrdup_const                                119      35     -84

Link: https://lkml.kernel.org/r/Y/4fDlbIhTLNLFHz@p183
Signed-off-by: Alexey Dobriyan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
Alexey Dobriyan authored and akpm00 committed Apr 8, 2023
1 parent 6d51363 commit 2a6772e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ EXPORT_SYMBOL(kfree_const);
*
* Return: newly allocated copy of @s or %NULL in case of error
*/
noinline
char *kstrdup(const char *s, gfp_t gfp)
{
size_t len;
Expand Down

0 comments on commit 2a6772e

Please sign in to comment.