* [patch] memory reclaim more efficiently
@ 2008-06-23 0:55 Takenori Nagano
2008-06-23 1:49 ` KOSAKI Motohiro
0 siblings, 1 reply; 3+ messages in thread
From: Takenori Nagano @ 2008-06-23 0:55 UTC (permalink / raw)
To: linux-mm, linux-kernel; +Cc: Keiichi KII
Hi,
Efficiency of memory reclaim is recently one of the hot topics. (LRU splitting,
pageout throttling, etc...) I would like to contribute it and I made this patch.
In shrink_zone(), system can not return to user mode before it finishes to
search LRU list. IMHO, it is very wasteful, since the user processes stay
unnecessarily long time in shrink_zone() loop and application response time
becomes relatively bad. This patch changes shrink_zone() that it finishes memory
reclaim when it reclaims enough memory.
the conditions to end searching:
1. order of request page is 0
2. process is not kswapd.
3. satisfy the condition to return try_to_free_pages()
# nr_reclaim > SWAP_CLUSTER_MAX
Signed-off-by: Takenori Nagano <t-nagano@ah.jp.nec.com>
Signed-off-by: Keiichi Kii <k-keiichi@bx.jp.nec.com>
---
diff -uprN linux-2.6.26-rc6.orig/mm/vmscan.c linux-2.6.26-rc6/mm/vmscan.c
--- linux-2.6.26-rc6.orig/mm/vmscan.c 2008-06-13 06:22:24.000000000 +0900
+++ linux-2.6.26-rc6/mm/vmscan.c 2008-06-20 15:05:03.492700863 +0900
@@ -1224,6 +1224,9 @@ static unsigned long shrink_zone(int pri
nr_reclaimed += shrink_inactive_list(nr_to_scan, zone,
sc);
}
+ if (nr_reclaimed > sc->swap_cluster_max && !sc->order
+ && !current_is_kswapd())
+ break;
}
throttle_vm_writeout(sc->gfp_mask);
--
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] 3+ messages in thread
* Re: [patch] memory reclaim more efficiently
2008-06-23 0:55 [patch] memory reclaim more efficiently Takenori Nagano
@ 2008-06-23 1:49 ` KOSAKI Motohiro
2008-06-23 4:54 ` Takenori Nagano
0 siblings, 1 reply; 3+ messages in thread
From: KOSAKI Motohiro @ 2008-06-23 1:49 UTC (permalink / raw)
To: Takenori Nagano; +Cc: kosaki.motohiro, linux-mm, linux-kernel, Keiichi KII
Hi nagano-san,
> In shrink_zone(), system can not return to user mode before it finishes to
> search LRU list. IMHO, it is very wasteful, since the user processes stay
> unnecessarily long time in shrink_zone() loop and application response time
> becomes relatively bad. This patch changes shrink_zone() that it finishes memory
> reclaim when it reclaims enough memory.
>
> the conditions to end searching:
>
> 1. order of request page is 0
> 2. process is not kswapd.
> 3. satisfy the condition to return try_to_free_pages()
> # nr_reclaim > SWAP_CLUSTER_MAX
I have 3 question.
1. Do you have any performance number?
2. I think this patch advocate many try_to_free_pages() called is better than
one try_to_free_page waste long time. right?
and, why do you think so?
3. if this patch improve perfomance, I guess DEF_PRIORITY is
too small on your machine.
if DEF_PRIORITY is proportional to system memory, do your problem are solved?
--
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] 3+ messages in thread
* Re: [patch] memory reclaim more efficiently
2008-06-23 1:49 ` KOSAKI Motohiro
@ 2008-06-23 4:54 ` Takenori Nagano
0 siblings, 0 replies; 3+ messages in thread
From: Takenori Nagano @ 2008-06-23 4:54 UTC (permalink / raw)
To: KOSAKI Motohiro; +Cc: linux-mm, linux-kernel, Keiichi KII
KOSAKI Motohiro wrote:
> > Hi nagano-san,
> >
>> >> In shrink_zone(), system can not return to user mode before it finishes to
>> >> search LRU list. IMHO, it is very wasteful, since the user processes stay
>> >> unnecessarily long time in shrink_zone() loop and application response time
>> >> becomes relatively bad. This patch changes shrink_zone() that it finishes
memory
>> >> reclaim when it reclaims enough memory.
>> >>
>> >> the conditions to end searching:
>> >>
>> >> 1. order of request page is 0
>> >> 2. process is not kswapd.
>> >> 3. satisfy the condition to return try_to_free_pages()
>> >> # nr_reclaim > SWAP_CLUSTER_MAX
Hi Kosaki-san,
> > I have 3 question.
> >
> > 1. Do you have any performance number?
I tested some, but I don't collect data. :-(
I will test again and post results.
> > 2. I think this patch advocate many try_to_free_pages() called is better than
> > one try_to_free_page waste long time. right?
> > and, why do you think so?
I think user process is stopped long time on memory reclaim is not good.
It is enough for user process to reclaim memory is needed. We have kswapd memory
reclaim daemon. I think memory reclaim is kswapd's job.
> > 3. if this patch improve perfomance, I guess DEF_PRIORITY is
> > too small on your machine.
> > if DEF_PRIORITY is proportional to system memory, do your problem are solved?
Your idea is so nice. :-)
IMHO, it is not perfect if reclaimable memory is not on front.
Thanks,
Takenori
--
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] 3+ messages in thread
end of thread, other threads:[~2008-06-23 4:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-23 0:55 [patch] memory reclaim more efficiently Takenori Nagano
2008-06-23 1:49 ` KOSAKI Motohiro
2008-06-23 4:54 ` Takenori Nagano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox