* [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone
@ 2010-01-08 5:12 Minchan Kim
2010-01-08 5:30 ` KOSAKI Motohiro
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Minchan Kim @ 2010-01-08 5:12 UTC (permalink / raw)
To: Andrew Morton; +Cc: KOSAKI Motohiro, Mel Gorman, Rik van Riel, linux-mm, lkml
Kswapd check that zone have enough free by zone_water_mark.
If any zone doesn't have enough page, it set all_zones_ok to zero.
all_zone_ok makes kswapd retry not sleeping.
I think the watermark check before shrink zone is pointless.
Kswapd try to shrink zone then the check is meaningul.
This patch move the check after shrink zone.
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Mel Gorman <mel@csn.ul.ie>
CC: Rik van Riel <riel@redhat.com>
---
mm/vmscan.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 885207a..b81adf8 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2057,9 +2057,6 @@ loop_again:
priority != DEF_PRIORITY)
continue;
- if (!zone_watermark_ok(zone, order,
- high_wmark_pages(zone), end_zone, 0))
- all_zones_ok = 0;
temp_priority[i] = priority;
sc.nr_scanned = 0;
note_zone_scanning_priority(zone, priority);
@@ -2099,13 +2096,17 @@ loop_again:
total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2)
sc.may_writepage = 1;
- /*
- * We are still under min water mark. it mean we have
- * GFP_ATOMIC allocation failure risk. Hurry up!
- */
- if (!zone_watermark_ok(zone, order, min_wmark_pages(zone),
- end_zone, 0))
- has_under_min_watermark_zone = 1;
+ if (!zone_watermark_ok(zone, order,
+ high_wmark_pages(zone), end_zone, 0)) {
+ all_zones_ok = 0;
+ /*
+ * We are still under min water mark. it mean we have
+ * GFP_ATOMIC allocation failure risk. Hurry up!
+ */
+ if (!zone_watermark_ok(zone, order, min_wmark_pages(zone),
+ end_zone, 0))
+ has_under_min_watermark_zone = 1;
+ }
}
if (all_zones_ok)
--
1.5.6.3
--
Kind 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 related [flat|nested] 6+ messages in thread
* Re: [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone
2010-01-08 5:12 [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone Minchan Kim
@ 2010-01-08 5:30 ` KOSAKI Motohiro
2010-01-10 14:25 ` Wu Fengguang
2010-01-12 23:01 ` Andrew Morton
2 siblings, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2010-01-08 5:30 UTC (permalink / raw)
To: Minchan Kim
Cc: kosaki.motohiro, Andrew Morton, Mel Gorman, Rik van Riel,
linux-mm, lkml
> Kswapd check that zone have enough free by zone_water_mark.
> If any zone doesn't have enough page, it set all_zones_ok to zero.
> all_zone_ok makes kswapd retry not sleeping.
>
> I think the watermark check before shrink zone is pointless.
> Kswapd try to shrink zone then the check is meaningul.
probably s/meaningul/meaningful/ ?
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>
> This patch move the check after shrink zone.
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Mel Gorman <mel@csn.ul.ie>
> CC: Rik van Riel <riel@redhat.com>
> ---
> mm/vmscan.c | 21 +++++++++++----------
> 1 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 885207a..b81adf8 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2057,9 +2057,6 @@ loop_again:
> priority != DEF_PRIORITY)
> continue;
>
> - if (!zone_watermark_ok(zone, order,
> - high_wmark_pages(zone), end_zone, 0))
> - all_zones_ok = 0;
> temp_priority[i] = priority;
> sc.nr_scanned = 0;
> note_zone_scanning_priority(zone, priority);
> @@ -2099,13 +2096,17 @@ loop_again:
> total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2)
> sc.may_writepage = 1;
>
> - /*
> - * We are still under min water mark. it mean we have
> - * GFP_ATOMIC allocation failure risk. Hurry up!
> - */
> - if (!zone_watermark_ok(zone, order, min_wmark_pages(zone),
> - end_zone, 0))
> - has_under_min_watermark_zone = 1;
> + if (!zone_watermark_ok(zone, order,
> + high_wmark_pages(zone), end_zone, 0)) {
> + all_zones_ok = 0;
> + /*
> + * We are still under min water mark. it mean we have
> + * GFP_ATOMIC allocation failure risk. Hurry up!
> + */
> + if (!zone_watermark_ok(zone, order, min_wmark_pages(zone),
> + end_zone, 0))
> + has_under_min_watermark_zone = 1;
> + }
>
--
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] 6+ messages in thread
* Re: [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone
2010-01-08 5:12 [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone Minchan Kim
2010-01-08 5:30 ` KOSAKI Motohiro
@ 2010-01-10 14:25 ` Wu Fengguang
2010-01-12 23:01 ` Andrew Morton
2 siblings, 0 replies; 6+ messages in thread
From: Wu Fengguang @ 2010-01-10 14:25 UTC (permalink / raw)
To: Minchan Kim
Cc: Andrew Morton, KOSAKI Motohiro, Mel Gorman, Rik van Riel,
linux-mm, lkml
On Fri, Jan 08, 2010 at 02:12:35PM +0900, Minchan Kim wrote:
> Kswapd check that zone have enough free by zone_water_mark.
> If any zone doesn't have enough page, it set all_zones_ok to zero.
> all_zone_ok makes kswapd retry not sleeping.
!all_zone_ok :)
> I think the watermark check before shrink zone is pointless.
> Kswapd try to shrink zone then the check is meaningul.
>
> This patch move the check after shrink zone.
This tends to make kswapd do less work in one invocation, with lower
priority. Looks at least not bad to me :) Thanks!
Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
--
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] 6+ messages in thread
* Re: [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone
2010-01-08 5:12 [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone Minchan Kim
2010-01-08 5:30 ` KOSAKI Motohiro
2010-01-10 14:25 ` Wu Fengguang
@ 2010-01-12 23:01 ` Andrew Morton
2010-01-12 23:40 ` KOSAKI Motohiro
2010-01-13 1:51 ` Minchan Kim
2 siblings, 2 replies; 6+ messages in thread
From: Andrew Morton @ 2010-01-12 23:01 UTC (permalink / raw)
To: Minchan Kim; +Cc: KOSAKI Motohiro, Mel Gorman, Rik van Riel, linux-mm, lkml
On Fri, 8 Jan 2010 14:12:35 +0900
Minchan Kim <minchan.kim@gmail.com> wrote:
> Kswapd check that zone have enough free by zone_water_mark.
> If any zone doesn't have enough page, it set all_zones_ok to zero.
> all_zone_ok makes kswapd retry not sleeping.
>
> I think the watermark check before shrink zone is pointless.
> Kswapd try to shrink zone then the check is meaningul.
>
> This patch move the check after shrink zone.
The changelog is rather hard to understand. I changed it to
: Kswapd checks that zone has sufficient pages free via zone_watermark_ok().
:
: If any zone doesn't have enough pages, we set all_zones_ok to zero.
: !all_zone_ok makes kswapd retry rather than sleeping.
:
: I think the watermark check before shrink_zone() is pointless. Only after
: kswapd has tried to shrink the zone is the check meaningful.
:
: Move the check to after the call to shrink_zone().
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Mel Gorman <mel@csn.ul.ie>
> CC: Rik van Riel <riel@redhat.com>
> ---
> mm/vmscan.c | 21 +++++++++++----------
> 1 files changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 885207a..b81adf8 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2057,9 +2057,6 @@ loop_again:
> priority != DEF_PRIORITY)
> continue;
>
> - if (!zone_watermark_ok(zone, order,
> - high_wmark_pages(zone), end_zone, 0))
> - all_zones_ok = 0;
This will make kswapd stop doing reclaim if all zones have
zone_is_all_unreclaimable():
if (zone_is_all_unreclaimable(zone))
continue;
This seems bad.
> temp_priority[i] = priority;
> sc.nr_scanned = 0;
> note_zone_scanning_priority(zone, priority);
> @@ -2099,13 +2096,17 @@ loop_again:
> total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2)
> sc.may_writepage = 1;
>
> - /*
> - * We are still under min water mark. it mean we have
> - * GFP_ATOMIC allocation failure risk. Hurry up!
> - */
> - if (!zone_watermark_ok(zone, order, min_wmark_pages(zone),
> - end_zone, 0))
> - has_under_min_watermark_zone = 1;
> + if (!zone_watermark_ok(zone, order,
> + high_wmark_pages(zone), end_zone, 0)) {
> + all_zones_ok = 0;
> + /*
> + * We are still under min water mark. it mean we have
> + * GFP_ATOMIC allocation failure risk. Hurry up!
> + */
> + if (!zone_watermark_ok(zone, order, min_wmark_pages(zone),
> + end_zone, 0))
> + has_under_min_watermark_zone = 1;
> + }
>
The vmscan.c code makes an effort to look nice in an 80-col display.
--
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] 6+ messages in thread
* Re: [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone
2010-01-12 23:01 ` Andrew Morton
@ 2010-01-12 23:40 ` KOSAKI Motohiro
2010-01-13 1:51 ` Minchan Kim
1 sibling, 0 replies; 6+ messages in thread
From: KOSAKI Motohiro @ 2010-01-12 23:40 UTC (permalink / raw)
To: Andrew Morton
Cc: kosaki.motohiro, Minchan Kim, Mel Gorman, Rik van Riel, linux-mm,
lkml
> > mm/vmscan.c | 21 +++++++++++----------
> > 1 files changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 885207a..b81adf8 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -2057,9 +2057,6 @@ loop_again:
> > priority != DEF_PRIORITY)
> > continue;
> >
> > - if (!zone_watermark_ok(zone, order,
> > - high_wmark_pages(zone), end_zone, 0))
> > - all_zones_ok = 0;
>
> This will make kswapd stop doing reclaim if all zones have
> zone_is_all_unreclaimable():
>
> if (zone_is_all_unreclaimable(zone))
> continue;
>
> This seems bad.
No. That's intentional, I think. All zones of small asymmetric numa
node are always unreclaimable typically. stopping kswapd prevent to
waste 100% cpu time such situation.
In the other hand, This logic doesn't cause disaster to symmetric numa.
it merely cause direct reclaim and re-wakeup kswapd.
--
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] 6+ messages in thread
* Re: [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone
2010-01-12 23:01 ` Andrew Morton
2010-01-12 23:40 ` KOSAKI Motohiro
@ 2010-01-13 1:51 ` Minchan Kim
1 sibling, 0 replies; 6+ messages in thread
From: Minchan Kim @ 2010-01-13 1:51 UTC (permalink / raw)
To: Andrew Morton; +Cc: KOSAKI Motohiro, Mel Gorman, Rik van Riel, linux-mm, lkml
On Tue, 2010-01-12 at 15:01 -0800, Andrew Morton wrote:
> On Fri, 8 Jan 2010 14:12:35 +0900
> Minchan Kim <minchan.kim@gmail.com> wrote:
>
> > Kswapd check that zone have enough free by zone_water_mark.
> > If any zone doesn't have enough page, it set all_zones_ok to zero.
> > all_zone_ok makes kswapd retry not sleeping.
> >
> > I think the watermark check before shrink zone is pointless.
> > Kswapd try to shrink zone then the check is meaningul.
> >
> > This patch move the check after shrink zone.
>
> The changelog is rather hard to understand. I changed it to
>
> : Kswapd checks that zone has sufficient pages free via zone_watermark_ok().
> :
> : If any zone doesn't have enough pages, we set all_zones_ok to zero.
> : !all_zone_ok makes kswapd retry rather than sleeping.
> :
> : I think the watermark check before shrink_zone() is pointless. Only after
> : kswapd has tried to shrink the zone is the check meaningful.
> :
> : Move the check to after the call to shrink_zone().
>
Thanks, Andrew.
> > Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> > CC: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> > CC: Mel Gorman <mel@csn.ul.ie>
> > CC: Rik van Riel <riel@redhat.com>
> > ---
> > mm/vmscan.c | 21 +++++++++++----------
> > 1 files changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index 885207a..b81adf8 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -2057,9 +2057,6 @@ loop_again:
> > priority != DEF_PRIORITY)
> > continue;
> >
> > - if (!zone_watermark_ok(zone, order,
> > - high_wmark_pages(zone), end_zone, 0))
> > - all_zones_ok = 0;
>
> This will make kswapd stop doing reclaim if all zones have
> zone_is_all_unreclaimable():
>
> if (zone_is_all_unreclaimable(zone))
> continue;
>
> This seems bad.
Do you mean zone_is_all_unreclaimable in front of if (nr_slab ==0 && ..)?
reclaim_state->reclaimed_slab = 0;
nr_slab = shrink_slab(sc.nr_scanned, GFP_KERNEL,
lru_pages);
sc.nr_reclaimed += reclaim_state->reclaimed_slab;
total_scanned += sc.nr_scanned;
if (zone_is_all_unreclaimable(zone)) <===
continue;
Actually I think the check is pointless, too.
We set ZONE_ALL_UNRECLAIMABLE after the check and increase next zone in
loop.
The check is a little bit effective in just case concurrent zone
reclaim. But if we remove the check, it's one more call
zone_watermark_ok and it's okay, I think.
In addition, we check zone_is_all_unreclaimable in start in loop
following as.
for (i = 0; i <= end_zone; i++) {
struct zone *zone = pgdat->node_zones + i;
int nr_slab;
int nid, zid;
if (!populated_zone(zone))
continue;
if (zone_is_all_unreclaimable(zone) && <===
priority != DEF_PRIORITY)
continue;
so the check in higher priority is effective if anyone doesn't free any
page.
>
> > temp_priority[i] = priority;
> > sc.nr_scanned = 0;
> > note_zone_scanning_priority(zone, priority);
> > @@ -2099,13 +2096,17 @@ loop_again:
> > total_scanned > sc.nr_reclaimed + sc.nr_reclaimed / 2)
> > sc.may_writepage = 1;
> >
> > - /*
> > - * We are still under min water mark. it mean we have
> > - * GFP_ATOMIC allocation failure risk. Hurry up!
> > - */
> > - if (!zone_watermark_ok(zone, order, min_wmark_pages(zone),
> > - end_zone, 0))
> > - has_under_min_watermark_zone = 1;
> > + if (!zone_watermark_ok(zone, order,
> > + high_wmark_pages(zone), end_zone, 0)) {
> > + all_zones_ok = 0;
> > + /*
> > + * We are still under min water mark. it mean we have
> > + * GFP_ATOMIC allocation failure risk. Hurry up!
> > + */
> > + if (!zone_watermark_ok(zone, order, min_wmark_pages(zone),
> > + end_zone, 0))
> > + has_under_min_watermark_zone = 1;
> > + }
> >
>
> The vmscan.c code makes an effort to look nice in an 80-col display.
Okay. I will keep in mind.
--
Kind 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] 6+ messages in thread
end of thread, other threads:[~2010-01-13 1:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-08 5:12 [PATCH -mmotm-2010-01-06-14-34] check high watermark after shrink zone Minchan Kim
2010-01-08 5:30 ` KOSAKI Motohiro
2010-01-10 14:25 ` Wu Fengguang
2010-01-12 23:01 ` Andrew Morton
2010-01-12 23:40 ` KOSAKI Motohiro
2010-01-13 1:51 ` Minchan Kim
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).