* [PATCH 3/3] mm: remove function free_hot_page
@ 2010-01-13 14:54 Li Hong
2010-01-13 15:55 ` Américo Wang
2010-01-14 22:52 ` Andrew Morton
0 siblings, 2 replies; 4+ messages in thread
From: Li Hong @ 2010-01-13 14:54 UTC (permalink / raw)
To: linux-mm, linux-kernel, Andrew Morton, Eduard - Gabriel Munteanu
Now fuction 'free_hot_page' is just a wrap of ' free_hot_cold_page' with
parameter 'cold = 0'. After adding a clear comment for 'free_hot_cold_page', it
is reasonable to remove a level of call.
Signed-off-by: Li Hong <lihong.hi@gmail.com>
---
mm/page_alloc.c | 8 ++------
mm/swap.c | 2 +-
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 175dd36..c88e03d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1073,6 +1073,7 @@ void mark_free_pages(struct zone *zone)
/*
* Free a 0-order page
+ * cold == 1 ? free a cold page : free a hot page
*/
static void free_hot_cold_page(struct page *page, int cold)
{
@@ -1135,11 +1136,6 @@ out:
put_cpu();
}
-void free_hot_page(struct page *page)
-{
- free_hot_cold_page(page, 0);
-}
-
/*
* split_page takes a non-compound higher-order page, and splits it into
* n (1<<order) sub-pages: page[0..n]
@@ -2014,7 +2010,7 @@ void __free_pages(struct page *page, unsigned int order)
{
if (put_page_testzero(page)) {
if (order == 0)
- free_hot_page(page);
+ free_hot_cold_page(page, 0);
else
__free_pages_ok(page, order);
}
diff --git a/mm/swap.c b/mm/swap.c
index 308e57d..9036b89 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -55,7 +55,7 @@ static void __page_cache_release(struct page *page)
del_page_from_lru(zone, page);
spin_unlock_irqrestore(&zone->lru_lock, flags);
}
- free_hot_page(page);
+ free_hot_cold_page(page, 0);
}
static void put_compound_page(struct page *page)
--
1.6.3.3
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] mm: remove function free_hot_page
2010-01-13 14:54 [PATCH 3/3] mm: remove function free_hot_page Li Hong
@ 2010-01-13 15:55 ` Américo Wang
2010-01-13 16:07 ` Li Hong
2010-01-14 22:52 ` Andrew Morton
1 sibling, 1 reply; 4+ messages in thread
From: Américo Wang @ 2010-01-13 15:55 UTC (permalink / raw)
To: Li Hong; +Cc: linux-mm, linux-kernel, Andrew Morton, Eduard - Gabriel Munteanu
On Wed, Jan 13, 2010 at 10:54:50PM +0800, Li Hong wrote:
>Now fuction 'free_hot_page' is just a wrap of ' free_hot_cold_page' with
>parameter 'cold = 0'. After adding a clear comment for 'free_hot_cold_page', it
>is reasonable to remove a level of call.
How? The compiler can certainly inline it.
>
>Signed-off-by: Li Hong <lihong.hi@gmail.com>
>---
> mm/page_alloc.c | 8 ++------
> mm/swap.c | 2 +-
> 2 files changed, 3 insertions(+), 7 deletions(-)
>
>diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>index 175dd36..c88e03d 100644
>--- a/mm/page_alloc.c
>+++ b/mm/page_alloc.c
>@@ -1073,6 +1073,7 @@ void mark_free_pages(struct zone *zone)
>
> /*
> * Free a 0-order page
>+ * cold == 1 ? free a cold page : free a hot page
> */
> static void free_hot_cold_page(struct page *page, int cold)
> {
>@@ -1135,11 +1136,6 @@ out:
> put_cpu();
> }
>
>-void free_hot_page(struct page *page)
>-{
>- free_hot_cold_page(page, 0);
>-}
>-
> /*
> * split_page takes a non-compound higher-order page, and splits it into
> * n (1<<order) sub-pages: page[0..n]
>@@ -2014,7 +2010,7 @@ void __free_pages(struct page *page, unsigned int order)
> {
> if (put_page_testzero(page)) {
> if (order == 0)
>- free_hot_page(page);
>+ free_hot_cold_page(page, 0);
> else
> __free_pages_ok(page, order);
> }
>diff --git a/mm/swap.c b/mm/swap.c
>index 308e57d..9036b89 100644
>--- a/mm/swap.c
>+++ b/mm/swap.c
>@@ -55,7 +55,7 @@ static void __page_cache_release(struct page *page)
> del_page_from_lru(zone, page);
> spin_unlock_irqrestore(&zone->lru_lock, flags);
> }
>- free_hot_page(page);
>+ free_hot_cold_page(page, 0);
> }
>
> static void put_compound_page(struct page *page)
>--
>1.6.3.3
>--
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/
--
Live like a child, think like the god.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] mm: remove function free_hot_page
2010-01-13 15:55 ` Américo Wang
@ 2010-01-13 16:07 ` Li Hong
0 siblings, 0 replies; 4+ messages in thread
From: Li Hong @ 2010-01-13 16:07 UTC (permalink / raw)
To: Américo Wang
Cc: linux-mm, linux-kernel, Andrew Morton, Eduard - Gabriel Munteanu
I just think it is needless to add a simple wrap function here whether
it is inlined
or not.
-LH
2010/1/13 Américo Wang <xiyou.wangcong@gmail.com>:
> On Wed, Jan 13, 2010 at 10:54:50PM +0800, Li Hong wrote:
>>Now fuction 'free_hot_page' is just a wrap of ' free_hot_cold_page' with
>>parameter 'cold = 0'. After adding a clear comment for 'free_hot_cold_page', it
>>is reasonable to remove a level of call.
>
> How? The compiler can certainly inline it.
>
>>
>>Signed-off-by: Li Hong <lihong.hi@gmail.com>
>>---
>> mm/page_alloc.c | 8 ++------
>> mm/swap.c | 2 +-
>> 2 files changed, 3 insertions(+), 7 deletions(-)
>>
>>diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>index 175dd36..c88e03d 100644
>>--- a/mm/page_alloc.c
>>+++ b/mm/page_alloc.c
>>@@ -1073,6 +1073,7 @@ void mark_free_pages(struct zone *zone)
>>
>> /*
>> * Free a 0-order page
>>+ * cold == 1 ? free a cold page : free a hot page
>> */
>> static void free_hot_cold_page(struct page *page, int cold)
>> {
>>@@ -1135,11 +1136,6 @@ out:
>> put_cpu();
>> }
>>
>>-void free_hot_page(struct page *page)
>>-{
>>- free_hot_cold_page(page, 0);
>>-}
>>-
>> /*
>> * split_page takes a non-compound higher-order page, and splits it into
>> * n (1<<order) sub-pages: page[0..n]
>>@@ -2014,7 +2010,7 @@ void __free_pages(struct page *page, unsigned int order)
>> {
>> if (put_page_testzero(page)) {
>> if (order == 0)
>>- free_hot_page(page);
>>+ free_hot_cold_page(page, 0);
>> else
>> __free_pages_ok(page, order);
>> }
>>diff --git a/mm/swap.c b/mm/swap.c
>>index 308e57d..9036b89 100644
>>--- a/mm/swap.c
>>+++ b/mm/swap.c
>>@@ -55,7 +55,7 @@ static void __page_cache_release(struct page *page)
>> del_page_from_lru(zone, page);
>> spin_unlock_irqrestore(&zone->lru_lock, flags);
>> }
>>- free_hot_page(page);
>>+ free_hot_cold_page(page, 0);
>> }
>>
>> static void put_compound_page(struct page *page)
>>--
>>1.6.3.3
>>--
>>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at http://vger.kernel.org/majordomo-info.html
>>Please read the FAQ at http://www.tux.org/lkml/
>
> --
> Live like a child, think like the god.
>
>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] mm: remove function free_hot_page
2010-01-13 14:54 [PATCH 3/3] mm: remove function free_hot_page Li Hong
2010-01-13 15:55 ` Américo Wang
@ 2010-01-14 22:52 ` Andrew Morton
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2010-01-14 22:52 UTC (permalink / raw)
To: Li Hong; +Cc: linux-mm, linux-kernel, Eduard - Gabriel Munteanu
On Wed, 13 Jan 2010 22:54:50 +0800
Li Hong <lihong.hi@gmail.com> wrote:
> Now fuction 'free_hot_page' is just a wrap of ' free_hot_cold_page' with
> parameter 'cold = 0'. After adding a clear comment for 'free_hot_cold_page', it
> is reasonable to remove a level of call.
>
> Signed-off-by: Li Hong <lihong.hi@gmail.com>
> ---
> mm/page_alloc.c | 8 ++------
> mm/swap.c | 2 +-
> 2 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 175dd36..c88e03d 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1073,6 +1073,7 @@ void mark_free_pages(struct zone *zone)
>
> /*
> * Free a 0-order page
> + * cold == 1 ? free a cold page : free a hot page
> */
> static void free_hot_cold_page(struct page *page, int cold)
> {
> @@ -1135,11 +1136,6 @@ out:
> put_cpu();
> }
>
> -void free_hot_page(struct page *page)
> -{
> - free_hot_cold_page(page, 0);
> -}
> -
> /*
> * split_page takes a non-compound higher-order page, and splits it into
> * n (1<<order) sub-pages: page[0..n]
> @@ -2014,7 +2010,7 @@ void __free_pages(struct page *page, unsigned int order)
> {
> if (put_page_testzero(page)) {
> if (order == 0)
> - free_hot_page(page);
> + free_hot_cold_page(page, 0);
> else
> __free_pages_ok(page, order);
> }
> diff --git a/mm/swap.c b/mm/swap.c
> index 308e57d..9036b89 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -55,7 +55,7 @@ static void __page_cache_release(struct page *page)
> del_page_from_lru(zone, page);
> spin_unlock_irqrestore(&zone->lru_lock, flags);
> }
> - free_hot_page(page);
> + free_hot_cold_page(page, 0);
> }
yup, it's worth removing a level of function call.
We could do that simply by making free_hot_page() an inline function -
that would be a bit neater and wouild generate the same code as your
patch will.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-01-14 22:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 14:54 [PATCH 3/3] mm: remove function free_hot_page Li Hong
2010-01-13 15:55 ` Américo Wang
2010-01-13 16:07 ` Li Hong
2010-01-14 22:52 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).