* [PATCH] Prevent shrinking of active anon lru list in case of no swap space
@ 2009-05-14 5:10 Minchan Kim
2009-05-14 7:19 ` KOSAKI Motohiro
0 siblings, 1 reply; 4+ messages in thread
From: Minchan Kim @ 2009-05-14 5:10 UTC (permalink / raw)
To: Andrew Morton, LKML, linux-mm
Cc: KOSAKI Motohiro, Johannes Weiner, Rik van Riel
Now shrink_active_list is called several places.
But if we don't have a swap space, we can't reclaim anon pages.
So, we don't need deactivating anon pages in anon lru list.
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Rik van Riel <riel@redhat.com>
---
mm/vmscan.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2f9d555..e4d71f4 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1238,6 +1238,12 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
enum lru_list lru;
struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
+ /*
+ * we can't shrink anon list in case of no swap space.
+ */
+ if (file == 0 && nr_swap_pages <= 0)
+ return;
+
lru_add_drain();
spin_lock_irq(&zone->lru_lock);
pgmoved = sc->isolate_pages(nr_pages, &l_hold, &pgscanned, sc->order,
--
1.5.4.3
--
Kinds Regards
Minchan Kim
--
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] Prevent shrinking of active anon lru list in case of no swap space
2009-05-14 5:10 [PATCH] Prevent shrinking of active anon lru list in case of no swap space Minchan Kim
@ 2009-05-14 7:19 ` KOSAKI Motohiro
2009-05-14 7:40 ` Minchan Kim
0 siblings, 1 reply; 4+ messages in thread
From: KOSAKI Motohiro @ 2009-05-14 7:19 UTC (permalink / raw)
To: Minchan Kim
Cc: kosaki.motohiro, Andrew Morton, LKML, linux-mm, Johannes Weiner,
Rik van Riel
>
> Now shrink_active_list is called several places.
> But if we don't have a swap space, we can't reclaim anon pages.
> So, we don't need deactivating anon pages in anon lru list.
>
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Rik van Riel <riel@redhat.com>
hm, The analysis seems right. but
In general branch should put into non frequency path.
why caller modification as following patch is wrong?
/*
* Do some background aging of the anon list, to give
* pages a chance to be referenced before reclaiming.
*/
- if (inactive_anon_is_low(zone, &sc))
+ if (inactive_anon_is_low(zone, &sc) && (nr_swap_pages <= 0))
shrink_active_list(SWAP_CLUSTER_MAX, zone,
&sc, priority, 0);
> ---
> mm/vmscan.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 2f9d555..e4d71f4 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1238,6 +1238,12 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
> enum lru_list lru;
> struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
>
> + /*
> + * we can't shrink anon list in case of no swap space.
> + */
> + if (file == 0 && nr_swap_pages <= 0)
> + return;
> +
>
> lru_add_drain();
> spin_lock_irq(&zone->lru_lock);
> pgmoved = sc->isolate_pages(nr_pages, &l_hold, &pgscanned, sc->order,
> --
> 1.5.4.3
>
>
> --
> Kinds Regards
> Minchan Kim
--
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] Prevent shrinking of active anon lru list in case of no swap space
2009-05-14 7:19 ` KOSAKI Motohiro
@ 2009-05-14 7:40 ` Minchan Kim
2009-05-14 7:53 ` KOSAKI Motohiro
0 siblings, 1 reply; 4+ messages in thread
From: Minchan Kim @ 2009-05-14 7:40 UTC (permalink / raw)
To: KOSAKI Motohiro
Cc: Minchan Kim, Andrew Morton, LKML, linux-mm, Johannes Weiner,
Rik van Riel
On Thu, 14 May 2009 16:19:52 +0900 (JST)
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
> >
> > Now shrink_active_list is called several places.
> > But if we don't have a swap space, we can't reclaim anon pages.
> > So, we don't need deactivating anon pages in anon lru list.
> >
> > Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> > Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> > Cc: Johannes Weiner <hannes@cmpxchg.org>
> > Cc: Rik van Riel <riel@redhat.com>
>
> hm, The analysis seems right. but
>
> In general branch should put into non frequency path.
> why caller modification as following patch is wrong?
Yes. You're right. Firstly I though that.
But there are a few place where inactve_anon_is_low is called.
In addition to it, we always have to call with (nr_swap_pages <= 0) with it.
So alone inactive_anon_is_low is lost function's meaning.
I think it's meaningless.
But We can improve one function wrapper.
/* I can't be remind proper function name. Can you suggest me ? */
if (do_we_have_to_shrink_list(zone, &sc))
int do_we_have_to_shrink_list(...)
{
if (inactive_anon_is_low(zone, &sc) && (nr_swap_pages <= 0))
}
What do you think ?
>
> /*
> * Do some background aging of the anon list, to give
> * pages a chance to be referenced before reclaiming.
> */
> - if (inactive_anon_is_low(zone, &sc))
> + if (inactive_anon_is_low(zone, &sc) && (nr_swap_pages <= 0))
> shrink_active_list(SWAP_CLUSTER_MAX, zone,
> &sc, priority, 0);
>
>
>
>
> > ---
> > mm/vmscan.c | 6 ++++++
> > 1 files changed, 6 insertions(+), 0 deletions(-)
> >
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 2f9d555..e4d71f4 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -1238,6 +1238,12 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
> > enum lru_list lru;
> > struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
> >
> > + /*
> > + * we can't shrink anon list in case of no swap space.
> > + */
> > + if (file == 0 && nr_swap_pages <= 0)
> > + return;
> > +
> >
> > lru_add_drain();
> > spin_lock_irq(&zone->lru_lock);
> > pgmoved = sc->isolate_pages(nr_pages, &l_hold, &pgscanned, sc->order,
> > --
> > 1.5.4.3
> >
> >
> > --
> > Kinds Regards
> > Minchan Kim
>
>
>
--
Kinds Regards
Minchan Kim
--
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] Prevent shrinking of active anon lru list in case of no swap space
2009-05-14 7:40 ` Minchan Kim
@ 2009-05-14 7:53 ` KOSAKI Motohiro
0 siblings, 0 replies; 4+ messages in thread
From: KOSAKI Motohiro @ 2009-05-14 7:53 UTC (permalink / raw)
To: Minchan Kim
Cc: kosaki.motohiro, Andrew Morton, LKML, linux-mm, Johannes Weiner,
Rik van Riel
> On Thu, 14 May 2009 16:19:52 +0900 (JST)
> KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> wrote:
>
> > >
> > > Now shrink_active_list is called several places.
> > > But if we don't have a swap space, we can't reclaim anon pages.
> > > So, we don't need deactivating anon pages in anon lru list.
> > >
> > > Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> > > Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> > > Cc: Johannes Weiner <hannes@cmpxchg.org>
> > > Cc: Rik van Riel <riel@redhat.com>
> >
> > hm, The analysis seems right. but
> >
> > In general branch should put into non frequency path.
> > why caller modification as following patch is wrong?
>
> Yes. You're right. Firstly I though that.
> But there are a few place where inactve_anon_is_low is called.
> In addition to it, we always have to call with (nr_swap_pages <= 0) with it.
> So alone inactive_anon_is_low is lost function's meaning.
>
> I think it's meaningless.
> But We can improve one function wrapper.
>
> /* I can't be remind proper function name. Can you suggest me ? */
> if (do_we_have_to_shrink_list(zone, &sc))
>
>
> int do_we_have_to_shrink_list(...)
> {
> if (inactive_anon_is_low(zone, &sc) && (nr_swap_pages <= 0))
>
> }
>
> What do you think ?
The idea except function-name is good.
hmm.. sorry. I have no alternative idea.
>
> >
> > /*
> > * Do some background aging of the anon list, to give
> > * pages a chance to be referenced before reclaiming.
> > */
> > - if (inactive_anon_is_low(zone, &sc))
> > + if (inactive_anon_is_low(zone, &sc) && (nr_swap_pages <= 0))
> > shrink_active_list(SWAP_CLUSTER_MAX, zone,
> > &sc, priority, 0);
> >
> >
> >
> >
> > > ---
> > > mm/vmscan.c | 6 ++++++
> > > 1 files changed, 6 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > > index 2f9d555..e4d71f4 100644
> > > --- a/mm/vmscan.c
> > > +++ b/mm/vmscan.c
> > > @@ -1238,6 +1238,12 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
> > > enum lru_list lru;
> > > struct zone_reclaim_stat *reclaim_stat = get_reclaim_stat(zone, sc);
> > >
> > > + /*
> > > + * we can't shrink anon list in case of no swap space.
> > > + */
> > > + if (file == 0 && nr_swap_pages <= 0)
> > > + return;
> > > +
> > >
> > > lru_add_drain();
> > > spin_lock_irq(&zone->lru_lock);
> > > pgmoved = sc->isolate_pages(nr_pages, &l_hold, &pgscanned, sc->order,
> > > --
> > > 1.5.4.3
> > >
> > >
> > > --
> > > Kinds Regards
> > > Minchan Kim
> >
> >
> >
>
>
> --
> Kinds Regards
> Minchan Kim
>
> --
> 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>
--
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:[~2009-05-14 7:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-14 5:10 [PATCH] Prevent shrinking of active anon lru list in case of no swap space Minchan Kim
2009-05-14 7:19 ` KOSAKI Motohiro
2009-05-14 7:40 ` Minchan Kim
2009-05-14 7:53 ` KOSAKI Motohiro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox