Skip to contentSkip to conversation

rmap: Staticize page_referenced_file and page_referenced_anon

PATCH In review Kautuk Consul 2 participants 5 messages Feb 17, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 rmap: Staticize page_referenced_file and page_referenced_anon

Staticize 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
index c8454e0..74aff97 100644
@@ -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>
#1 lore raw
Quoted 3 lines · Kautuk Consul

Staticize the page_referenced_anon and page_referenced_file functions.
These functions are called only from page_referenced.

Subject and changelog say: staticize, which I read to mean: make static. Yet what the patch does is make them inline ?!?

Also, if they're static and there's only a single callsite, gcc will already inline them, does this patch really make a difference?

mm/rmap.c out: · line 775

Quoted 2 lines
mm/rmap.c +1 -1
-static int page_referenced_anon(struct page *page,
+static inline int page_referenced_anon(struct page *page,

--
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>

#2 lore raw
Quoted 7 lines · Peter Zijlstra
Quoted 3 lines · Kautuk Consul

Staticize the page_referenced_anon and page_referenced_file functions.
These functions are called only from page_referenced.

Subject and changelog say: staticize, which I read to mean: make static. Yet what the patch does is make them inline ?!?

Yes, sorry my mistake. :)

Quoted 3 lines

Also, if they're static and there's only a single callsite, gcc will already inline them, does this patch really make a difference?

I just sent this patch for what I thought was "correctness", but I guess we can let this be if you are absolutely sure that all GCC cross compilers for all platforms will guarantee inlining.

Quoted 5 lines

mm/rmap.c out: · line 775

Quoted 3 lines
mm/rmap.c +1 -1
-static int page_referenced_anon(struct page *page,
+static inline int page_referenced_anon(struct page *page,

Please reply back if you feel I should resend this patch with modified description.
Else, I'll just forget about this one. :)

--
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>

#4 lore raw
In reply to Kautuk Consul
Quoted 6 lines · Kautuk Consul
Quoted 2 lines

Also, if they're static and there's only a single callsite, gcc will already inline them, does this patch really make a difference?

I just sent this patch for what I thought was "correctness", but I guess we can let this be if you are absolutely sure that all GCC cross compilers for all platforms will guarantee inlining.

Typically we don't explicitly inline such large functions, unless we need it for performance.

--
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>