rmap: Make page_referenced_file and page_referenced_anon inline
Subsystems (2)
PATCH v2 1/2 rmap: Make page_referenced_file and page_referenced_anon inline
Inline the page_referenced_anon and page_referenced_file functions.
These functions are called only from page_referenced.
--- mm/rmap.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
mm/rmap.c +2 -2
@@ -772,7 +772,7 @@ out:return referenced; } -static int page_referenced_anon (struct page *page, +static inline int page_referenced_anon (struct page *page,struct mem_cgroup *memcg,unsigned long *vm_flags) {
@@ -821,7 +821,7 @@ static int page_referenced_anon(struct page *page,* * This function is only called from page_referenced for object-based pages. */ -static int page_referenced_file (struct page *page, +static inline int page_referenced_file (struct page *page,struct mem_cgroup *memcg,unsigned long *vm_flags) {
Signature · 8 lines
1.7.5.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · On Fri, 17 Feb 2012 10:26:38 -0500 Kautuk Consul <[email protected]>…
Inline the
page_referenced_anonandpage_referenced_filefunctions.
These functions are called only frompage_referenced.Signed-off-by Kautuk Consul <[email protected]>
Hmm ? In my environ,
before patch.
[kamezawa@bluextal linux]$ size mm/rmap.o
text data bss dec hex filename
11474 0 24 11498 2cea mm/rmap.o
(8833) (optimize-for-size=y)
After patch.
[kamezawa@bluextal linux]$ size mm/rmap.o
text data bss dec hex filename
11422 0 24 11446 2cb6 mm/rmap.o
(8775) (optimize-for-size=y)
text size is 50bytes decreased. But I wonder page_referenced_anon/file is enough large function which is not inlined by hand in usual...
Quoted 1 line
From
Documentation/CodingStyleChapter15: The inline disease
==
A reasonable rule of thumb is to not put inline at functions that have more than 3 lines of code in them. An exception to this rule are the cases where a parameter is known to be a compiletime constant, and as a result of this constantness you *know* the compiler will be able to optimize most of your function away at compile time. For a good example of this later case, see the kmalloc() inline function.
Often people argue that adding inline to functions that are static and used only once is always a win since there is no space tradeoff. While this is technically correct, gcc is capable of inlining these automatically without help, and the maintenance issue of removing the inline when a second user appears outweighs the potential value of the hint that tells gcc to do something it would have done anyway.
==
I'm sorry but I don't Ack this.
Thanks,
-Kame
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>