2012-02-17 14:28:21

by Kautuk Consul

[permalink] [raw]
Subject: [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.

Signed-off-by: Kautuk Consul <[email protected]>
---
mm/rmap.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/rmap.c b/mm/rmap.c
index c8454e0..74aff97 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -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)
{
--
1.7.5.4


2012-02-17 15:15:19

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 1/2] rmap: Staticize page_referenced_file and page_referenced_anon

On Fri, 2012-02-17 at 09:27 -0500, Kautuk Consul wrote:
> 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?

> -static int page_referenced_anon(struct page *page,
> +static inline int page_referenced_anon(struct page *page,

2012-02-17 15:19:51

by Kautuk Consul

[permalink] [raw]
Subject: Re: [PATCH 1/2] rmap: Staticize page_referenced_file and page_referenced_anon

On Fri, Feb 17, 2012 at 10:15 AM, Peter Zijlstra <[email protected]> wrote:
> On Fri, 2012-02-17 at 09:27 -0500, Kautuk Consul wrote:
>> 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. :)

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



>
>> -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. :)

2012-02-17 15:28:00

by Kautuk Consul

[permalink] [raw]
Subject: Re: [PATCH 1/2] rmap: Staticize page_referenced_file and page_referenced_anon

Okay, I sent v2 of this anyway with the correct description.

2012-02-17 18:08:12

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH 1/2] rmap: Staticize page_referenced_file and page_referenced_anon

On Fri, 2012-02-17 at 10:19 -0500, Kautuk Consul wrote:
> > 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.