All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: fix up the vmscan stat in vmstat
@ 2012-04-12 18:03 Ying Han
  2012-04-12 18:08 ` Rik van Riel
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Ying Han @ 2012-04-12 18:03 UTC (permalink / raw)
  To: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Hillf Danton, Hugh Dickins, Dan Magenheimer,
	Andrew Morton
  Cc: linux-mm

It is always confusing on stat "pgsteal" where it counts both direct
reclaim as well as background reclaim. However, we have "kswapd_steal"
which also counts background reclaim value.

This patch fixes it and also makes it match the existng "pgscan_" stats.

Test:
pgsteal_kswapd_dma32 447623
pgsteal_kswapd_normal 42272677
pgsteal_kswapd_movable 0
pgsteal_direct_dma32 2801
pgsteal_direct_normal 44353270
pgsteal_direct_movable 0

Signed-off-by: Ying Han <yinghan@google.com>
---
 include/linux/vm_event_item.h |    5 +++--
 mm/vmscan.c                   |   11 ++++++++---
 mm/vmstat.c                   |    4 ++--
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 03b90cdc..06f8e38 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -26,13 +26,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
 		PGFREE, PGACTIVATE, PGDEACTIVATE,
 		PGFAULT, PGMAJFAULT,
 		FOR_ALL_ZONES(PGREFILL),
-		FOR_ALL_ZONES(PGSTEAL),
+		FOR_ALL_ZONES(PGSTEAL_KSWAPD),
+		FOR_ALL_ZONES(PGSTEAL_DIRECT),
 		FOR_ALL_ZONES(PGSCAN_KSWAPD),
 		FOR_ALL_ZONES(PGSCAN_DIRECT),
 #ifdef CONFIG_NUMA
 		PGSCAN_ZONE_RECLAIM_FAILED,
 #endif
-		PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
+		PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
 		KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
 		KSWAPD_SKIP_CONGESTION_WAIT,
 		PAGEOUTRUN, ALLOCSTALL, PGROTATED,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 33c332b..078c9fd 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1568,9 +1568,14 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
 	reclaim_stat->recent_scanned[0] += nr_anon;
 	reclaim_stat->recent_scanned[1] += nr_file;
 
-	if (current_is_kswapd())
-		__count_vm_events(KSWAPD_STEAL, nr_reclaimed);
-	__count_zone_vm_events(PGSTEAL, zone, nr_reclaimed);
+	if (global_reclaim(sc)) {
+		if (current_is_kswapd())
+			__count_zone_vm_events(PGSTEAL_KSWAPD, zone,
+					       nr_reclaimed);
+		else
+			__count_zone_vm_events(PGSTEAL_DIRECT, zone,
+					       nr_reclaimed);
+	}
 
 	putback_inactive_pages(mz, &page_list);
 
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f600557..7db1b9b 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -738,7 +738,8 @@ const char * const vmstat_text[] = {
 	"pgmajfault",
 
 	TEXTS_FOR_ZONES("pgrefill")
-	TEXTS_FOR_ZONES("pgsteal")
+	TEXTS_FOR_ZONES("pgsteal_kswapd")
+	TEXTS_FOR_ZONES("pgsteal_direct")
 	TEXTS_FOR_ZONES("pgscan_kswapd")
 	TEXTS_FOR_ZONES("pgscan_direct")
 
@@ -747,7 +748,6 @@ const char * const vmstat_text[] = {
 #endif
 	"pginodesteal",
 	"slabs_scanned",
-	"kswapd_steal",
 	"kswapd_inodesteal",
 	"kswapd_low_wmark_hit_quickly",
 	"kswapd_high_wmark_hit_quickly",
-- 
1.7.7.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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 18:03 [PATCH] mm: fix up the vmscan stat in vmstat Ying Han
@ 2012-04-12 18:08 ` Rik van Riel
  2012-04-12 18:52 ` Christoph Lameter
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Rik van Riel @ 2012-04-12 18:08 UTC (permalink / raw)
  To: Ying Han
  Cc: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Hillf Danton, Hugh Dickins, Dan Magenheimer, Andrew Morton,
	linux-mm

On 04/12/2012 02:03 PM, Ying Han wrote:
> It is always confusing on stat "pgsteal" where it counts both direct
> reclaim as well as background reclaim. However, we have "kswapd_steal"
> which also counts background reclaim value.
>
> This patch fixes it and also makes it match the existng "pgscan_" stats.
>
> Test:
> pgsteal_kswapd_dma32 447623
> pgsteal_kswapd_normal 42272677
> pgsteal_kswapd_movable 0
> pgsteal_direct_dma32 2801
> pgsteal_direct_normal 44353270
> pgsteal_direct_movable 0
>
> Signed-off-by: Ying Han<yinghan@google.com>

Reviewed-by: Rik van Riel <riel@redhat.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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 18:03 [PATCH] mm: fix up the vmscan stat in vmstat Ying Han
  2012-04-12 18:08 ` Rik van Riel
@ 2012-04-12 18:52 ` Christoph Lameter
  2012-04-12 19:05 ` Johannes Weiner
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2012-04-12 18:52 UTC (permalink / raw)
  To: Ying Han
  Cc: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Hillf Danton, Hugh Dickins, Dan Magenheimer,
	Andrew Morton, linux-mm

On Thu, 12 Apr 2012, Ying Han wrote:

> It is always confusing on stat "pgsteal" where it counts both direct
> reclaim as well as background reclaim. However, we have "kswapd_steal"
> which also counts background reclaim value.
>
> This patch fixes it and also makes it match the existng "pgscan_" stats.

It also removes one stat item (kswapd_steal) which strictly speaking is
breaking the system ABI for tools that may rely on those stats. But I
think this is pretty obscure stuff. No major tools would depend on this I
guess.

Acked-by: Christoph Lameter <cl@linux.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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 18:03 [PATCH] mm: fix up the vmscan stat in vmstat Ying Han
  2012-04-12 18:08 ` Rik van Riel
  2012-04-12 18:52 ` Christoph Lameter
@ 2012-04-12 19:05 ` Johannes Weiner
  2012-04-12 19:24   ` Ying Han
  2012-04-12 22:36 ` Andrew Morton
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Johannes Weiner @ 2012-04-12 19:05 UTC (permalink / raw)
  To: Ying Han
  Cc: Michal Hocko, Mel Gorman, KAMEZAWA Hiroyuki, Rik van Riel,
	Hillf Danton, Hugh Dickins, Dan Magenheimer, Andrew Morton,
	linux-mm

On Thu, Apr 12, 2012 at 11:03:02AM -0700, Ying Han wrote:
> It is always confusing on stat "pgsteal" where it counts both direct
> reclaim as well as background reclaim. However, we have "kswapd_steal"
> which also counts background reclaim value.
> 
> This patch fixes it and also makes it match the existng "pgscan_" stats.
> 
> Test:
> pgsteal_kswapd_dma32 447623
> pgsteal_kswapd_normal 42272677
> pgsteal_kswapd_movable 0
> pgsteal_direct_dma32 2801
> pgsteal_direct_normal 44353270
> pgsteal_direct_movable 0
> 
> Signed-off-by: Ying Han <yinghan@google.com>
> ---
>  include/linux/vm_event_item.h |    5 +++--
>  mm/vmscan.c                   |   11 ++++++++---
>  mm/vmstat.c                   |    4 ++--
>  3 files changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
> index 03b90cdc..06f8e38 100644
> --- a/include/linux/vm_event_item.h
> +++ b/include/linux/vm_event_item.h
> @@ -26,13 +26,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
>  		PGFREE, PGACTIVATE, PGDEACTIVATE,
>  		PGFAULT, PGMAJFAULT,
>  		FOR_ALL_ZONES(PGREFILL),
> -		FOR_ALL_ZONES(PGSTEAL),
> +		FOR_ALL_ZONES(PGSTEAL_KSWAPD),
> +		FOR_ALL_ZONES(PGSTEAL_DIRECT),
>  		FOR_ALL_ZONES(PGSCAN_KSWAPD),
>  		FOR_ALL_ZONES(PGSCAN_DIRECT),
>  #ifdef CONFIG_NUMA
>  		PGSCAN_ZONE_RECLAIM_FAILED,
>  #endif
> -		PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
> +		PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
>  		KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
>  		KSWAPD_SKIP_CONGESTION_WAIT,
>  		PAGEOUTRUN, ALLOCSTALL, PGROTATED,
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 33c332b..078c9fd 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1568,9 +1568,14 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
>  	reclaim_stat->recent_scanned[0] += nr_anon;
>  	reclaim_stat->recent_scanned[1] += nr_file;
>  
> -	if (current_is_kswapd())
> -		__count_vm_events(KSWAPD_STEAL, nr_reclaimed);
> -	__count_zone_vm_events(PGSTEAL, zone, nr_reclaimed);
> +	if (global_reclaim(sc)) {
> +		if (current_is_kswapd())
> +			__count_zone_vm_events(PGSTEAL_KSWAPD, zone,
> +					       nr_reclaimed);
> +		else
> +			__count_zone_vm_events(PGSTEAL_DIRECT, zone,
> +					       nr_reclaimed);
> +	}

Hey, you changed more than the changelog said!  Why no longer count
memcg hard limit-triggered activity?

Agreed with everything else, though.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 19:05 ` Johannes Weiner
@ 2012-04-12 19:24   ` Ying Han
  2012-04-12 19:32     ` Johannes Weiner
  0 siblings, 1 reply; 13+ messages in thread
From: Ying Han @ 2012-04-12 19:24 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: Michal Hocko, Mel Gorman, KAMEZAWA Hiroyuki, Rik van Riel,
	Hillf Danton, Hugh Dickins, Dan Magenheimer, Andrew Morton,
	linux-mm

On Thu, Apr 12, 2012 at 12:05 PM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> On Thu, Apr 12, 2012 at 11:03:02AM -0700, Ying Han wrote:
>> It is always confusing on stat "pgsteal" where it counts both direct
>> reclaim as well as background reclaim. However, we have "kswapd_steal"
>> which also counts background reclaim value.
>>
>> This patch fixes it and also makes it match the existng "pgscan_" stats.
>>
>> Test:
>> pgsteal_kswapd_dma32 447623
>> pgsteal_kswapd_normal 42272677
>> pgsteal_kswapd_movable 0
>> pgsteal_direct_dma32 2801
>> pgsteal_direct_normal 44353270
>> pgsteal_direct_movable 0
>>
>> Signed-off-by: Ying Han <yinghan@google.com>
>> ---
>>  include/linux/vm_event_item.h |    5 +++--
>>  mm/vmscan.c                   |   11 ++++++++---
>>  mm/vmstat.c                   |    4 ++--
>>  3 files changed, 13 insertions(+), 7 deletions(-)
>>
>> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
>> index 03b90cdc..06f8e38 100644
>> --- a/include/linux/vm_event_item.h
>> +++ b/include/linux/vm_event_item.h
>> @@ -26,13 +26,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
>>               PGFREE, PGACTIVATE, PGDEACTIVATE,
>>               PGFAULT, PGMAJFAULT,
>>               FOR_ALL_ZONES(PGREFILL),
>> -             FOR_ALL_ZONES(PGSTEAL),
>> +             FOR_ALL_ZONES(PGSTEAL_KSWAPD),
>> +             FOR_ALL_ZONES(PGSTEAL_DIRECT),
>>               FOR_ALL_ZONES(PGSCAN_KSWAPD),
>>               FOR_ALL_ZONES(PGSCAN_DIRECT),
>>  #ifdef CONFIG_NUMA
>>               PGSCAN_ZONE_RECLAIM_FAILED,
>>  #endif
>> -             PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
>> +             PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
>>               KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
>>               KSWAPD_SKIP_CONGESTION_WAIT,
>>               PAGEOUTRUN, ALLOCSTALL, PGROTATED,
>> diff --git a/mm/vmscan.c b/mm/vmscan.c
>> index 33c332b..078c9fd 100644
>> --- a/mm/vmscan.c
>> +++ b/mm/vmscan.c
>> @@ -1568,9 +1568,14 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
>>       reclaim_stat->recent_scanned[0] += nr_anon;
>>       reclaim_stat->recent_scanned[1] += nr_file;
>>
>> -     if (current_is_kswapd())
>> -             __count_vm_events(KSWAPD_STEAL, nr_reclaimed);
>> -     __count_zone_vm_events(PGSTEAL, zone, nr_reclaimed);
>> +     if (global_reclaim(sc)) {
>> +             if (current_is_kswapd())
>> +                     __count_zone_vm_events(PGSTEAL_KSWAPD, zone,
>> +                                            nr_reclaimed);
>> +             else
>> +                     __count_zone_vm_events(PGSTEAL_DIRECT, zone,
>> +                                            nr_reclaimed);
>> +     }
>
> Hey, you changed more than the changelog said!  Why no longer count
> memcg hard limit-triggered activity?

To make it consistent with "PGSCAN_*" stats, as in the commit log..
Although i could be more specific. :(

I think it is good to keep those stats to be global reclaim, and memcg
hardlimit-triggered should go to memory.vmscan_stat as you presented.

--Ying
>
> Agreed with everything else, though.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 19:24   ` Ying Han
@ 2012-04-12 19:32     ` Johannes Weiner
  0 siblings, 0 replies; 13+ messages in thread
From: Johannes Weiner @ 2012-04-12 19:32 UTC (permalink / raw)
  To: Ying Han
  Cc: Michal Hocko, Mel Gorman, KAMEZAWA Hiroyuki, Rik van Riel,
	Hillf Danton, Hugh Dickins, Dan Magenheimer, Andrew Morton,
	linux-mm

On Thu, Apr 12, 2012 at 12:24:49PM -0700, Ying Han wrote:
> On Thu, Apr 12, 2012 at 12:05 PM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> > On Thu, Apr 12, 2012 at 11:03:02AM -0700, Ying Han wrote:
> >> It is always confusing on stat "pgsteal" where it counts both direct
> >> reclaim as well as background reclaim. However, we have "kswapd_steal"
> >> which also counts background reclaim value.
> >>
> >> This patch fixes it and also makes it match the existng "pgscan_" stats.
> >>
> >> Test:
> >> pgsteal_kswapd_dma32 447623
> >> pgsteal_kswapd_normal 42272677
> >> pgsteal_kswapd_movable 0
> >> pgsteal_direct_dma32 2801
> >> pgsteal_direct_normal 44353270
> >> pgsteal_direct_movable 0
> >>
> >> Signed-off-by: Ying Han <yinghan@google.com>
> >> ---
> >>  include/linux/vm_event_item.h |    5 +++--
> >>  mm/vmscan.c                   |   11 ++++++++---
> >>  mm/vmstat.c                   |    4 ++--
> >>  3 files changed, 13 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
> >> index 03b90cdc..06f8e38 100644
> >> --- a/include/linux/vm_event_item.h
> >> +++ b/include/linux/vm_event_item.h
> >> @@ -26,13 +26,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
> >>               PGFREE, PGACTIVATE, PGDEACTIVATE,
> >>               PGFAULT, PGMAJFAULT,
> >>               FOR_ALL_ZONES(PGREFILL),
> >> -             FOR_ALL_ZONES(PGSTEAL),
> >> +             FOR_ALL_ZONES(PGSTEAL_KSWAPD),
> >> +             FOR_ALL_ZONES(PGSTEAL_DIRECT),
> >>               FOR_ALL_ZONES(PGSCAN_KSWAPD),
> >>               FOR_ALL_ZONES(PGSCAN_DIRECT),
> >>  #ifdef CONFIG_NUMA
> >>               PGSCAN_ZONE_RECLAIM_FAILED,
> >>  #endif
> >> -             PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
> >> +             PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
> >>               KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
> >>               KSWAPD_SKIP_CONGESTION_WAIT,
> >>               PAGEOUTRUN, ALLOCSTALL, PGROTATED,
> >> diff --git a/mm/vmscan.c b/mm/vmscan.c
> >> index 33c332b..078c9fd 100644
> >> --- a/mm/vmscan.c
> >> +++ b/mm/vmscan.c
> >> @@ -1568,9 +1568,14 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
> >>       reclaim_stat->recent_scanned[0] += nr_anon;
> >>       reclaim_stat->recent_scanned[1] += nr_file;
> >>
> >> -     if (current_is_kswapd())
> >> -             __count_vm_events(KSWAPD_STEAL, nr_reclaimed);
> >> -     __count_zone_vm_events(PGSTEAL, zone, nr_reclaimed);
> >> +     if (global_reclaim(sc)) {
> >> +             if (current_is_kswapd())
> >> +                     __count_zone_vm_events(PGSTEAL_KSWAPD, zone,
> >> +                                            nr_reclaimed);
> >> +             else
> >> +                     __count_zone_vm_events(PGSTEAL_DIRECT, zone,
> >> +                                            nr_reclaimed);
> >> +     }
> >
> > Hey, you changed more than the changelog said!  Why no longer count
> > memcg hard limit-triggered activity?
> 
> To make it consistent with "PGSCAN_*" stats, as in the commit log..
> Although i could be more specific. :(

My mistake then, I thought it was just in regard of naming and didn't
check how PGSCAN_* is accounted.

> I think it is good to keep those stats to be global reclaim, and memcg
> hardlimit-triggered should go to memory.vmscan_stat as you presented.

Ok.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 18:03 [PATCH] mm: fix up the vmscan stat in vmstat Ying Han
                   ` (2 preceding siblings ...)
  2012-04-12 19:05 ` Johannes Weiner
@ 2012-04-12 22:36 ` Andrew Morton
  2012-04-13  0:52   ` Ying Han
  2012-04-13 14:26   ` Rik van Riel
  2012-04-13  0:45 ` Minchan Kim
  2012-04-13  1:04 ` KAMEZAWA Hiroyuki
  5 siblings, 2 replies; 13+ messages in thread
From: Andrew Morton @ 2012-04-12 22:36 UTC (permalink / raw)
  To: Ying Han
  Cc: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Hillf Danton, Hugh Dickins, Dan Magenheimer,
	linux-mm

On Thu, 12 Apr 2012 11:03:02 -0700
Ying Han <yinghan@google.com> wrote:

> It is always confusing on stat "pgsteal" where it counts both direct
> reclaim as well as background reclaim. However, we have "kswapd_steal"
> which also counts background reclaim value.
> 
> This patch fixes it and also makes it match the existng "pgscan_" stats.
> 
> Test:
> pgsteal_kswapd_dma32 447623
> pgsteal_kswapd_normal 42272677
> pgsteal_kswapd_movable 0
> pgsteal_direct_dma32 2801
> pgsteal_direct_normal 44353270
> pgsteal_direct_movable 0
> 
> Signed-off-by: Ying Han <yinghan@google.com>
> ---
>  include/linux/vm_event_item.h |    5 +++--
>  mm/vmscan.c                   |   11 ++++++++---
>  mm/vmstat.c                   |    4 ++--

I was going to have a big whine about the failure to update the
/proc/vmstat documentation.  But we don't have any /proc/vmstat
documentation.  That was a sneaky labor-saving device.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 18:03 [PATCH] mm: fix up the vmscan stat in vmstat Ying Han
                   ` (3 preceding siblings ...)
  2012-04-12 22:36 ` Andrew Morton
@ 2012-04-13  0:45 ` Minchan Kim
  2012-04-13  1:04 ` KAMEZAWA Hiroyuki
  5 siblings, 0 replies; 13+ messages in thread
From: Minchan Kim @ 2012-04-13  0:45 UTC (permalink / raw)
  To: Ying Han
  Cc: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Hillf Danton, Hugh Dickins, Dan Magenheimer,
	Andrew Morton, linux-mm

On 04/13/2012 03:03 AM, Ying Han wrote:
> It is always confusing on stat "pgsteal" where it counts both direct
> reclaim as well as background reclaim. However, we have "kswapd_steal"
> which also counts background reclaim value.
>
> This patch fixes it and also makes it match the existng "pgscan_" stats.
>
> Test:
> pgsteal_kswapd_dma32 447623
> pgsteal_kswapd_normal 42272677
> pgsteal_kswapd_movable 0
> pgsteal_direct_dma32 2801
> pgsteal_direct_normal 44353270
> pgsteal_direct_movable 0
>
> Signed-off-by: Ying Han<yinghan@google.com>

Reviewed-by: Minchan Kim <minchan@kernel.org>

Off-topic:
There is another vmstat like that.(pgfault,pgmajfault)
But it's not trivial to fix it. Let it be.

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 22:36 ` Andrew Morton
@ 2012-04-13  0:52   ` Ying Han
  2012-04-13 14:26   ` Rik van Riel
  1 sibling, 0 replies; 13+ messages in thread
From: Ying Han @ 2012-04-13  0:52 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Hillf Danton, Hugh Dickins, Dan Magenheimer,
	linux-mm

On Thu, Apr 12, 2012 at 3:36 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> On Thu, 12 Apr 2012 11:03:02 -0700
> Ying Han <yinghan@google.com> wrote:
>
>> It is always confusing on stat "pgsteal" where it counts both direct
>> reclaim as well as background reclaim. However, we have "kswapd_steal"
>> which also counts background reclaim value.
>>
>> This patch fixes it and also makes it match the existng "pgscan_" stats.
>>
>> Test:
>> pgsteal_kswapd_dma32 447623
>> pgsteal_kswapd_normal 42272677
>> pgsteal_kswapd_movable 0
>> pgsteal_direct_dma32 2801
>> pgsteal_direct_normal 44353270
>> pgsteal_direct_movable 0
>>
>> Signed-off-by: Ying Han <yinghan@google.com>
>> ---
>>  include/linux/vm_event_item.h |    5 +++--
>>  mm/vmscan.c                   |   11 ++++++++---
>>  mm/vmstat.c                   |    4 ++--
>
> I was going to have a big whine about the failure to update the
> /proc/vmstat documentation.  But we don't have any /proc/vmstat
> documentation.  That was a sneaky labor-saving device.

yeah, there were couple of times that I was looking for the
documentation for vmstat but failed. It turns out that I just need to
quickly look at the source code and find out what each field means.

maybe that gives us a hint only kernel developers cares about them :)

--Ying

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 18:03 [PATCH] mm: fix up the vmscan stat in vmstat Ying Han
                   ` (4 preceding siblings ...)
  2012-04-13  0:45 ` Minchan Kim
@ 2012-04-13  1:04 ` KAMEZAWA Hiroyuki
  5 siblings, 0 replies; 13+ messages in thread
From: KAMEZAWA Hiroyuki @ 2012-04-13  1:04 UTC (permalink / raw)
  To: Ying Han
  Cc: Michal Hocko, Johannes Weiner, Mel Gorman, Rik van Riel,
	Hillf Danton, Hugh Dickins, Dan Magenheimer, Andrew Morton,
	linux-mm

(2012/04/13 3:03), Ying Han wrote:

> It is always confusing on stat "pgsteal" where it counts both direct
> reclaim as well as background reclaim. However, we have "kswapd_steal"
> which also counts background reclaim value.
> 
> This patch fixes it and also makes it match the existng "pgscan_" stats.
> 
> Test:
> pgsteal_kswapd_dma32 447623
> pgsteal_kswapd_normal 42272677
> pgsteal_kswapd_movable 0
> pgsteal_direct_dma32 2801
> pgsteal_direct_normal 44353270
> pgsteal_direct_movable 0
> 
> Signed-off-by: Ying Han <yinghan@google.com>


Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-12 22:36 ` Andrew Morton
  2012-04-13  0:52   ` Ying Han
@ 2012-04-13 14:26   ` Rik van Riel
  1 sibling, 0 replies; 13+ messages in thread
From: Rik van Riel @ 2012-04-13 14:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Ying Han, Michal Hocko, Johannes Weiner, Mel Gorman,
	KAMEZAWA Hiroyuki, Hillf Danton, Hugh Dickins, Dan Magenheimer,
	linux-mm

On 04/12/2012 06:36 PM, Andrew Morton wrote:

> I was going to have a big whine about the failure to update the
> /proc/vmstat documentation.  But we don't have any /proc/vmstat
> documentation.  That was a sneaky labor-saving device.

I believe that may be a feature, since we use /proc/vmstat
to look at all kinds of VM internals...

-- 
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] mm: fix up the vmscan stat in vmstat
  2012-04-13 22:25 Ying Han
@ 2012-04-13 22:26 ` Ying Han
  0 siblings, 0 replies; 13+ messages in thread
From: Ying Han @ 2012-04-13 22:26 UTC (permalink / raw)
  To: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Hillf Danton, Hugh Dickins, Dan Magenheimer,
	Andrew Morton
  Cc: linux-mm

Sorry for the spam, please ignore... I hit the wrong button.

--Ying

On Fri, Apr 13, 2012 at 3:25 PM, Ying Han <yinghan@google.com> wrote:
> It is always confusing on stat "pgsteal" where it counts both direct
> reclaim as well as background reclaim. However, we have "kswapd_steal"
> which also counts background reclaim value.
>
> This patch fixes it and also makes it match the existng "pgscan_" stats.
>
> Test:
> pgsteal_kswapd_dma32 447623
> pgsteal_kswapd_normal 42272677
> pgsteal_kswapd_movable 0
> pgsteal_direct_dma32 2801
> pgsteal_direct_normal 44353270
> pgsteal_direct_movable 0
>
> Signed-off-by: Ying Han <yinghan@google.com>
> ---
>  include/linux/vm_event_item.h |    5 +++--
>  mm/vmscan.c                   |   11 ++++++++---
>  mm/vmstat.c                   |    4 ++--
>  3 files changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
> index 03b90cdc..06f8e38 100644
> --- a/include/linux/vm_event_item.h
> +++ b/include/linux/vm_event_item.h
> @@ -26,13 +26,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
>                PGFREE, PGACTIVATE, PGDEACTIVATE,
>                PGFAULT, PGMAJFAULT,
>                FOR_ALL_ZONES(PGREFILL),
> -               FOR_ALL_ZONES(PGSTEAL),
> +               FOR_ALL_ZONES(PGSTEAL_KSWAPD),
> +               FOR_ALL_ZONES(PGSTEAL_DIRECT),
>                FOR_ALL_ZONES(PGSCAN_KSWAPD),
>                FOR_ALL_ZONES(PGSCAN_DIRECT),
>  #ifdef CONFIG_NUMA
>                PGSCAN_ZONE_RECLAIM_FAILED,
>  #endif
> -               PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
> +               PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
>                KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
>                KSWAPD_SKIP_CONGESTION_WAIT,
>                PAGEOUTRUN, ALLOCSTALL, PGROTATED,
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 33c332b..078c9fd 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1568,9 +1568,14 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
>        reclaim_stat->recent_scanned[0] += nr_anon;
>        reclaim_stat->recent_scanned[1] += nr_file;
>
> -       if (current_is_kswapd())
> -               __count_vm_events(KSWAPD_STEAL, nr_reclaimed);
> -       __count_zone_vm_events(PGSTEAL, zone, nr_reclaimed);
> +       if (global_reclaim(sc)) {
> +               if (current_is_kswapd())
> +                       __count_zone_vm_events(PGSTEAL_KSWAPD, zone,
> +                                              nr_reclaimed);
> +               else
> +                       __count_zone_vm_events(PGSTEAL_DIRECT, zone,
> +                                              nr_reclaimed);
> +       }
>
>        putback_inactive_pages(mz, &page_list);
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index f600557..7db1b9b 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -738,7 +738,8 @@ const char * const vmstat_text[] = {
>        "pgmajfault",
>
>        TEXTS_FOR_ZONES("pgrefill")
> -       TEXTS_FOR_ZONES("pgsteal")
> +       TEXTS_FOR_ZONES("pgsteal_kswapd")
> +       TEXTS_FOR_ZONES("pgsteal_direct")
>        TEXTS_FOR_ZONES("pgscan_kswapd")
>        TEXTS_FOR_ZONES("pgscan_direct")
>
> @@ -747,7 +748,6 @@ const char * const vmstat_text[] = {
>  #endif
>        "pginodesteal",
>        "slabs_scanned",
> -       "kswapd_steal",
>        "kswapd_inodesteal",
>        "kswapd_low_wmark_hit_quickly",
>        "kswapd_high_wmark_hit_quickly",
> --
> 1.7.7.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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] mm: fix up the vmscan stat in vmstat
@ 2012-04-13 22:25 Ying Han
  2012-04-13 22:26 ` Ying Han
  0 siblings, 1 reply; 13+ messages in thread
From: Ying Han @ 2012-04-13 22:25 UTC (permalink / raw)
  To: Michal Hocko, Johannes Weiner, Mel Gorman, KAMEZAWA Hiroyuki,
	Rik van Riel, Hillf Danton, Hugh Dickins, Dan Magenheimer,
	Andrew Morton
  Cc: linux-mm

It is always confusing on stat "pgsteal" where it counts both direct
reclaim as well as background reclaim. However, we have "kswapd_steal"
which also counts background reclaim value.

This patch fixes it and also makes it match the existng "pgscan_" stats.

Test:
pgsteal_kswapd_dma32 447623
pgsteal_kswapd_normal 42272677
pgsteal_kswapd_movable 0
pgsteal_direct_dma32 2801
pgsteal_direct_normal 44353270
pgsteal_direct_movable 0

Signed-off-by: Ying Han <yinghan@google.com>
---
 include/linux/vm_event_item.h |    5 +++--
 mm/vmscan.c                   |   11 ++++++++---
 mm/vmstat.c                   |    4 ++--
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 03b90cdc..06f8e38 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -26,13 +26,14 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
 		PGFREE, PGACTIVATE, PGDEACTIVATE,
 		PGFAULT, PGMAJFAULT,
 		FOR_ALL_ZONES(PGREFILL),
-		FOR_ALL_ZONES(PGSTEAL),
+		FOR_ALL_ZONES(PGSTEAL_KSWAPD),
+		FOR_ALL_ZONES(PGSTEAL_DIRECT),
 		FOR_ALL_ZONES(PGSCAN_KSWAPD),
 		FOR_ALL_ZONES(PGSCAN_DIRECT),
 #ifdef CONFIG_NUMA
 		PGSCAN_ZONE_RECLAIM_FAILED,
 #endif
-		PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
+		PGINODESTEAL, SLABS_SCANNED, KSWAPD_INODESTEAL,
 		KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
 		KSWAPD_SKIP_CONGESTION_WAIT,
 		PAGEOUTRUN, ALLOCSTALL, PGROTATED,
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 33c332b..078c9fd 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1568,9 +1568,14 @@ shrink_inactive_list(unsigned long nr_to_scan, struct mem_cgroup_zone *mz,
 	reclaim_stat->recent_scanned[0] += nr_anon;
 	reclaim_stat->recent_scanned[1] += nr_file;
 
-	if (current_is_kswapd())
-		__count_vm_events(KSWAPD_STEAL, nr_reclaimed);
-	__count_zone_vm_events(PGSTEAL, zone, nr_reclaimed);
+	if (global_reclaim(sc)) {
+		if (current_is_kswapd())
+			__count_zone_vm_events(PGSTEAL_KSWAPD, zone,
+					       nr_reclaimed);
+		else
+			__count_zone_vm_events(PGSTEAL_DIRECT, zone,
+					       nr_reclaimed);
+	}
 
 	putback_inactive_pages(mz, &page_list);
 
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f600557..7db1b9b 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -738,7 +738,8 @@ const char * const vmstat_text[] = {
 	"pgmajfault",
 
 	TEXTS_FOR_ZONES("pgrefill")
-	TEXTS_FOR_ZONES("pgsteal")
+	TEXTS_FOR_ZONES("pgsteal_kswapd")
+	TEXTS_FOR_ZONES("pgsteal_direct")
 	TEXTS_FOR_ZONES("pgscan_kswapd")
 	TEXTS_FOR_ZONES("pgscan_direct")
 
@@ -747,7 +748,6 @@ const char * const vmstat_text[] = {
 #endif
 	"pginodesteal",
 	"slabs_scanned",
-	"kswapd_steal",
 	"kswapd_inodesteal",
 	"kswapd_low_wmark_hit_quickly",
 	"kswapd_high_wmark_hit_quickly",
-- 
1.7.7.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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-04-13 22:26 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 18:03 [PATCH] mm: fix up the vmscan stat in vmstat Ying Han
2012-04-12 18:08 ` Rik van Riel
2012-04-12 18:52 ` Christoph Lameter
2012-04-12 19:05 ` Johannes Weiner
2012-04-12 19:24   ` Ying Han
2012-04-12 19:32     ` Johannes Weiner
2012-04-12 22:36 ` Andrew Morton
2012-04-13  0:52   ` Ying Han
2012-04-13 14:26   ` Rik van Riel
2012-04-13  0:45 ` Minchan Kim
2012-04-13  1:04 ` KAMEZAWA Hiroyuki
2012-04-13 22:25 Ying Han
2012-04-13 22:26 ` Ying Han

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.