linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value.
@ 2009-08-31 22:54 Vincent Li
  2009-08-31 23:29 ` Minchan Kim
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Vincent Li @ 2009-08-31 22:54 UTC (permalink / raw)
  To: linux-mm
  Cc: KOSAKI Motohiro, Rik van Riel, Minchan Kim, Wu Fengguang,
	Andrew Morton, Vincent Li

commit 5343daceec (If sc->isolate_pages() return 0...) make shrink_inactive_list handle
sc->isolate_pages() return value properly. Add similar proper return value check for
shrink_active_list() sc->isolate_pages().

Signed-off-by: Vincent Li <macli@brc.ubc.ca>
---
 mm/vmscan.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 460a6f7..2d1c846 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1319,9 +1319,12 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
 	if (scanning_global_lru(sc)) {
 		zone->pages_scanned += pgscanned;
 	}
-	reclaim_stat->recent_scanned[file] += nr_taken;
-
 	__count_zone_vm_events(PGREFILL, zone, pgscanned);
+
+	if (nr_taken == 0)
+		goto done;
+
+	reclaim_stat->recent_scanned[file] += nr_taken;
 	if (file)
 		__mod_zone_page_state(zone, NR_ACTIVE_FILE, -nr_taken);
 	else
@@ -1383,6 +1386,8 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
 	__mod_zone_page_state(zone, NR_ISOLATED_ANON + file, -nr_taken);
 	__mod_zone_page_state(zone, LRU_ACTIVE + file * LRU_FILE, nr_rotated);
 	__mod_zone_page_state(zone, LRU_BASE + file * LRU_FILE, nr_deactivated);
+
+done:
 	spin_unlock_irq(&zone->lru_lock);
 }
 
-- 
1.6.0.4

--
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] 8+ messages in thread

* Re: [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value.
  2009-08-31 22:54 [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value Vincent Li
@ 2009-08-31 23:29 ` Minchan Kim
  2009-09-01  0:01   ` Vincent Li
  2009-08-31 23:42 ` Rik van Riel
  2009-09-01  1:56 ` Wu Fengguang
  2 siblings, 1 reply; 8+ messages in thread
From: Minchan Kim @ 2009-08-31 23:29 UTC (permalink / raw)
  To: Vincent Li
  Cc: linux-mm, KOSAKI Motohiro, Rik van Riel, Minchan Kim,
	Wu Fengguang, Andrew Morton

On Mon, 31 Aug 2009 15:54:01 -0700
Vincent Li <macli@brc.ubc.ca> wrote:

> commit 5343daceec (If sc->isolate_pages() return 0...) make shrink_inactive_list handle
> sc->isolate_pages() return value properly. Add similar proper return value check for
> shrink_active_list() sc->isolate_pages().
> 
> Signed-off-by: Vincent Li <macli@brc.ubc.ca>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>

You should have write down your patch's effect clearly
in changelog although it's easy. ;-)

-- 
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] 8+ messages in thread

* Re: [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value.
  2009-08-31 22:54 [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value Vincent Li
  2009-08-31 23:29 ` Minchan Kim
@ 2009-08-31 23:42 ` Rik van Riel
  2009-09-01  1:56 ` Wu Fengguang
  2 siblings, 0 replies; 8+ messages in thread
From: Rik van Riel @ 2009-08-31 23:42 UTC (permalink / raw)
  To: Vincent Li
  Cc: linux-mm, KOSAKI Motohiro, Minchan Kim, Wu Fengguang,
	Andrew Morton

Vincent Li wrote:
> commit 5343daceec (If sc->isolate_pages() return 0...) make shrink_inactive_list handle
> sc->isolate_pages() return value properly. Add similar proper return value check for
> shrink_active_list() sc->isolate_pages().
> 
> Signed-off-by: Vincent Li <macli@brc.ubc.ca>

Acked-by: Rik van Riel <riel@redhat.com>

-- 
All rights reversed.

--
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] 8+ messages in thread

* Re: [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value.
  2009-08-31 23:29 ` Minchan Kim
@ 2009-09-01  0:01   ` Vincent Li
  2009-09-01  0:12     ` Minchan Kim
  0 siblings, 1 reply; 8+ messages in thread
From: Vincent Li @ 2009-09-01  0:01 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Vincent Li, linux-mm, KOSAKI Motohiro, Rik van Riel, Wu Fengguang,
	Andrew Morton

On Tue, 1 Sep 2009, Minchan Kim wrote:

> On Mon, 31 Aug 2009 15:54:01 -0700
> Vincent Li <macli@brc.ubc.ca> wrote:
> 
> > commit 5343daceec (If sc->isolate_pages() return 0...) make shrink_inactive_list handle
> > sc->isolate_pages() return value properly. Add similar proper return value check for
> > shrink_active_list() sc->isolate_pages().
> > 
> > Signed-off-by: Vincent Li <macli@brc.ubc.ca>
> Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
> 
> You should have write down your patch's effect clearly
> in changelog although it's easy. ;-)

Yes, I should have. This patch is inspired by Kosaki's patch, I 
thought mentioning that commit would make this patch as follow-up work and 
changelog clear enough. Would following changelog ok?

----
Add proper return value check for shrink_active_list() 
sc->isolate_pages(). 

When "nr_taken == 0"
	1: nr_scan related statistics should still be caculated.
	2: jump to the end of function and release zone->lru_lock.
----
Regards,

Vincent Li
Biomedical Research Center
University of British Columbia

--
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] 8+ messages in thread

* Re: [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value.
  2009-09-01  0:01   ` Vincent Li
@ 2009-09-01  0:12     ` Minchan Kim
  2009-09-01  0:43       ` KOSAKI Motohiro
  0 siblings, 1 reply; 8+ messages in thread
From: Minchan Kim @ 2009-09-01  0:12 UTC (permalink / raw)
  To: Vincent Li
  Cc: Minchan Kim, linux-mm, KOSAKI Motohiro, Rik van Riel,
	Wu Fengguang, Andrew Morton

On Mon, 31 Aug 2009 17:01:03 -0700 (PDT)
Vincent Li <macli@brc.ubc.ca> wrote:

> On Tue, 1 Sep 2009, Minchan Kim wrote:
> 
> > On Mon, 31 Aug 2009 15:54:01 -0700
> > Vincent Li <macli@brc.ubc.ca> wrote:
> > 
> > > commit 5343daceec (If sc->isolate_pages() return 0...) make shrink_inactive_list handle
> > > sc->isolate_pages() return value properly. Add similar proper return value check for
> > > shrink_active_list() sc->isolate_pages().
> > > 
> > > Signed-off-by: Vincent Li <macli@brc.ubc.ca>
> > Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
> > 
> > You should have write down your patch's effect clearly
> > in changelog although it's easy. ;-)
> 
> Yes, I should have. This patch is inspired by Kosaki's patch, I 
> thought mentioning that commit would make this patch as follow-up work and 
> changelog clear enough. Would following changelog ok?
> 
> ----
> Add proper return value check for shrink_active_list() 
> sc->isolate_pages(). 
> 
> When "nr_taken == 0"
> 	1: nr_scan related statistics should still be caculated.
> 	2: jump to the end of function and release zone->lru_lock.

It looks good than old. 
In fact, What I wanted is your patch impact.

For example, 
----
If we can't isolate pages from LRU list, 
we don't have to account page movement, either.
Already, in commit 5343daceec, KOSAKI did it about shrink_inactive_list.

This patch removes unnecessary overhead of page accouting 
and locking in shrink_active_list as follow-up work of commit 5343daceec.
---



> ----
> Regards,
> 
> Vincent Li
> Biomedical Research Center
> University of British Columbia


-- 
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] 8+ messages in thread

* Re: [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value.
  2009-09-01  0:12     ` Minchan Kim
@ 2009-09-01  0:43       ` KOSAKI Motohiro
  2009-09-01  4:56         ` Vincent Li
  0 siblings, 1 reply; 8+ messages in thread
From: KOSAKI Motohiro @ 2009-09-01  0:43 UTC (permalink / raw)
  To: Minchan Kim
  Cc: kosaki.motohiro, Vincent Li, linux-mm, Rik van Riel, Wu Fengguang,
	Andrew Morton

> On Mon, 31 Aug 2009 17:01:03 -0700 (PDT)
> Vincent Li <macli@brc.ubc.ca> wrote:
> 
> > On Tue, 1 Sep 2009, Minchan Kim wrote:
> > 
> > > On Mon, 31 Aug 2009 15:54:01 -0700
> > > Vincent Li <macli@brc.ubc.ca> wrote:
> > > 
> > > > commit 5343daceec (If sc->isolate_pages() return 0...) make shrink_inactive_list handle
> > > > sc->isolate_pages() return value properly. Add similar proper return value check for
> > > > shrink_active_list() sc->isolate_pages().
> > > > 
> > > > Signed-off-by: Vincent Li <macli@brc.ubc.ca>
> > > Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
> > > 
> > > You should have write down your patch's effect clearly
> > > in changelog although it's easy. ;-)
> > 
> > Yes, I should have. This patch is inspired by Kosaki's patch, I 
> > thought mentioning that commit would make this patch as follow-up work and 
> > changelog clear enough. Would following changelog ok?
> > 
> > ----
> > Add proper return value check for shrink_active_list() 
> > sc->isolate_pages(). 
> > 
> > When "nr_taken == 0"
> > 	1: nr_scan related statistics should still be caculated.
> > 	2: jump to the end of function and release zone->lru_lock.
> 
> It looks good than old. 
> In fact, What I wanted is your patch impact.
> 
> For example, 
> ----
> If we can't isolate pages from LRU list, 
> we don't have to account page movement, either.
> Already, in commit 5343daceec, KOSAKI did it about shrink_inactive_list.
> 
> This patch removes unnecessary overhead of page accouting 
> and locking in shrink_active_list as follow-up work of commit 5343daceec.
> ---

Vincent, can you please resubmit the patch with new description?
Plus, You can add my reviewed-by sign too.





--
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] 8+ messages in thread

* Re: [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value.
  2009-08-31 22:54 [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value Vincent Li
  2009-08-31 23:29 ` Minchan Kim
  2009-08-31 23:42 ` Rik van Riel
@ 2009-09-01  1:56 ` Wu Fengguang
  2 siblings, 0 replies; 8+ messages in thread
From: Wu Fengguang @ 2009-09-01  1:56 UTC (permalink / raw)
  To: Vincent Li
  Cc: linux-mm@kvack.org, KOSAKI Motohiro, Rik van Riel, Minchan Kim,
	Andrew Morton

On Tue, Sep 01, 2009 at 06:54:01AM +0800, Vincent Li wrote:
> commit 5343daceec (If sc->isolate_pages() return 0...) make shrink_inactive_list handle
> sc->isolate_pages() return value properly. Add similar proper return value check for
> shrink_active_list() sc->isolate_pages().
> 
> Signed-off-by: Vincent Li <macli@brc.ubc.ca>

Looks good to me, thanks.

Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>

> ---
>  mm/vmscan.c |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 460a6f7..2d1c846 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1319,9 +1319,12 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
>  	if (scanning_global_lru(sc)) {
>  		zone->pages_scanned += pgscanned;
>  	}
> -	reclaim_stat->recent_scanned[file] += nr_taken;
> -
>  	__count_zone_vm_events(PGREFILL, zone, pgscanned);
> +
> +	if (nr_taken == 0)
> +		goto done;
> +
> +	reclaim_stat->recent_scanned[file] += nr_taken;
>  	if (file)
>  		__mod_zone_page_state(zone, NR_ACTIVE_FILE, -nr_taken);
>  	else
> @@ -1383,6 +1386,8 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
>  	__mod_zone_page_state(zone, NR_ISOLATED_ANON + file, -nr_taken);
>  	__mod_zone_page_state(zone, LRU_ACTIVE + file * LRU_FILE, nr_rotated);
>  	__mod_zone_page_state(zone, LRU_BASE + file * LRU_FILE, nr_deactivated);
> +
> +done:
>  	spin_unlock_irq(&zone->lru_lock);
>  }
>  
> -- 
> 1.6.0.4

--
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] 8+ messages in thread

* Re: [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value.
  2009-09-01  0:43       ` KOSAKI Motohiro
@ 2009-09-01  4:56         ` Vincent Li
  0 siblings, 0 replies; 8+ messages in thread
From: Vincent Li @ 2009-09-01  4:56 UTC (permalink / raw)
  To: KOSAKI Motohiro
  Cc: Minchan Kim, Vincent Li, linux-mm, Rik van Riel, Wu Fengguang,
	Andrew Morton

On Tue, 1 Sep 2009, KOSAKI Motohiro wrote:

> > On Mon, 31 Aug 2009 17:01:03 -0700 (PDT)
> > Vincent Li <macli@brc.ubc.ca> wrote:
> > 
> > > On Tue, 1 Sep 2009, Minchan Kim wrote:
> > > 
> > > > On Mon, 31 Aug 2009 15:54:01 -0700
> > > > Vincent Li <macli@brc.ubc.ca> wrote:
> > > > 
> > > > > commit 5343daceec (If sc->isolate_pages() return 0...) make shrink_inactive_list handle
> > > > > sc->isolate_pages() return value properly. Add similar proper return value check for
> > > > > shrink_active_list() sc->isolate_pages().
> > > > > 
> > > > > Signed-off-by: Vincent Li <macli@brc.ubc.ca>
> > > > Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
> > > > 
> > > > You should have write down your patch's effect clearly
> > > > in changelog although it's easy. ;-)
> > > 
> > > Yes, I should have. This patch is inspired by Kosaki's patch, I 
> > > thought mentioning that commit would make this patch as follow-up work and 
> > > changelog clear enough. Would following changelog ok?
> > > 
> > > ----
> > > Add proper return value check for shrink_active_list() 
> > > sc->isolate_pages(). 
> > > 
> > > When "nr_taken == 0"
> > > 	1: nr_scan related statistics should still be caculated.
> > > 	2: jump to the end of function and release zone->lru_lock.
> > 
> > It looks good than old. 
> > In fact, What I wanted is your patch impact.
> > 
> > For example, 
> > ----
> > If we can't isolate pages from LRU list, 
> > we don't have to account page movement, either.
> > Already, in commit 5343daceec, KOSAKI did it about shrink_inactive_list.
> > 
> > This patch removes unnecessary overhead of page accouting 
> > and locking in shrink_active_list as follow-up work of commit 5343daceec.
> > ---
> 
> Vincent, can you please resubmit the patch with new description?
> Plus, You can add my reviewed-by sign too.

Ok, I will resubmit the patch with Kim's description and add reviewed-by 
sign. Thanks everyone for reviewing!

Vincent Li
Biomedical Research Center
University of British Columbia

--
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] 8+ messages in thread

end of thread, other threads:[~2009-09-01  4:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-31 22:54 [PATCH] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value Vincent Li
2009-08-31 23:29 ` Minchan Kim
2009-09-01  0:01   ` Vincent Li
2009-09-01  0:12     ` Minchan Kim
2009-09-01  0:43       ` KOSAKI Motohiro
2009-09-01  4:56         ` Vincent Li
2009-08-31 23:42 ` Rik van Riel
2009-09-01  1:56 ` Wu Fengguang

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