linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][for -mm] fix accounting in vmscan.c for memory controller
@ 2007-12-11  2:26 KAMEZAWA Hiroyuki
  2007-12-11  5:14 ` Balbir Singh
  2007-12-11 11:24 ` KAMEZAWA Hiroyuki
  0 siblings, 2 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2007-12-11  2:26 UTC (permalink / raw)
  To: Andrew Morton; +Cc: balbir, yamamoto, LKML, linux-mm, riel

Without this, ALLOCSTALL and PGSCAN_DIRECT increases too much unless
there is no memory shortage.

against 2.6.24-rc4-mm1.

-Kame

==
Some amount of accounting is done while page reclaiming.

Now, there are 2 types of page reclaim (if memory controller is used)
  - global: shortage of (global) pages.
  - under cgroup: use up to limit.

I think 2 accountings, ALLOCSTALL and DIRECT should be accounted only under
global lru scan. They are accounted against memory shortage at alloc_pages().

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

 mm/vmscan.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6.24-rc4-mm1/mm/vmscan.c
===================================================================
--- linux-2.6.24-rc4-mm1.orig/mm/vmscan.c
+++ linux-2.6.24-rc4-mm1/mm/vmscan.c
@@ -896,8 +896,9 @@ static unsigned long shrink_inactive_lis
 		if (current_is_kswapd()) {
 			__count_zone_vm_events(PGSCAN_KSWAPD, zone, nr_scan);
 			__count_vm_events(KSWAPD_STEAL, nr_freed);
-		} else
+		} else if (scan_global_lru(sc))
 			__count_zone_vm_events(PGSCAN_DIRECT, zone, nr_scan);
+
 		__count_zone_vm_events(PGSTEAL, zone, nr_freed);
 
 		if (nr_taken == 0)
@@ -1333,7 +1334,8 @@ static unsigned long do_try_to_free_page
 	unsigned long lru_pages = 0;
 	int i;
 
-	count_vm_event(ALLOCSTALL);
+	if (scan_global_lru(sc))
+		count_vm_event(ALLOCSTALL);
 	/*
 	 * mem_cgroup will not do shrink_slab.
 	 */

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

* Re: [PATCH][for -mm] fix accounting in vmscan.c for memory controller
  2007-12-11  2:26 [PATCH][for -mm] fix accounting in vmscan.c for memory controller KAMEZAWA Hiroyuki
@ 2007-12-11  5:14 ` Balbir Singh
  2007-12-11  5:29   ` KAMEZAWA Hiroyuki
  2007-12-11 11:24 ` KAMEZAWA Hiroyuki
  1 sibling, 1 reply; 5+ messages in thread
From: Balbir Singh @ 2007-12-11  5:14 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: Andrew Morton, yamamoto, LKML, linux-mm, riel

KAMEZAWA Hiroyuki wrote:
> Without this, ALLOCSTALL and PGSCAN_DIRECT increases too much unless
> there is no memory shortage.
> 
> against 2.6.24-rc4-mm1.
> 
> -Kame
> 
> ==
> Some amount of accounting is done while page reclaiming.
> 
> Now, there are 2 types of page reclaim (if memory controller is used)
>   - global: shortage of (global) pages.
>   - under cgroup: use up to limit.
> 
> I think 2 accountings, ALLOCSTALL and DIRECT should be accounted only under
> global lru scan. They are accounted against memory shortage at alloc_pages().
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
>  mm/vmscan.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.24-rc4-mm1/mm/vmscan.c
> ===================================================================
> --- linux-2.6.24-rc4-mm1.orig/mm/vmscan.c
> +++ linux-2.6.24-rc4-mm1/mm/vmscan.c
> @@ -896,8 +896,9 @@ static unsigned long shrink_inactive_lis
>  		if (current_is_kswapd()) {
>  			__count_zone_vm_events(PGSCAN_KSWAPD, zone, nr_scan);
>  			__count_vm_events(KSWAPD_STEAL, nr_freed);
> -		} else
> +		} else if (scan_global_lru(sc))
>  			__count_zone_vm_events(PGSCAN_DIRECT, zone, nr_scan);
> +
>  		__count_zone_vm_events(PGSTEAL, zone, nr_freed);
> 
>  		if (nr_taken == 0)
> @@ -1333,7 +1334,8 @@ static unsigned long do_try_to_free_page
>  	unsigned long lru_pages = 0;
>  	int i;
> 
> -	count_vm_event(ALLOCSTALL);
> +	if (scan_global_lru(sc))
> +		count_vm_event(ALLOCSTALL);
>  	/*
>  	 * mem_cgroup will not do shrink_slab.
>  	 */
> 

Looks good to me.

Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>

TODO:

1. Should we have vm_events for the memory controller as well?
   May be in the longer term

-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

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

* Re: [PATCH][for -mm] fix accounting in vmscan.c for memory controller
  2007-12-11  5:14 ` Balbir Singh
@ 2007-12-11  5:29   ` KAMEZAWA Hiroyuki
  2007-12-11  5:36     ` Balbir Singh
  0 siblings, 1 reply; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2007-12-11  5:29 UTC (permalink / raw)
  To: balbir; +Cc: Andrew Morton, yamamoto, LKML, linux-mm, riel

On Tue, 11 Dec 2007 10:44:36 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> Looks good to me.
> 
> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
> 
> TODO:
> 
> 1. Should we have vm_events for the memory controller as well?
>    May be in the longer term
> 

ALLOC_STALL is recoreded as failcnt, I think.
I think DIRECT can be accoutned easily.

But I'm not in hurry very much, because all reclaimation is DIRECT, now.
After we implement background reclaim, we should consider it.

Thanks,
-Kame

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

* Re: [PATCH][for -mm] fix accounting in vmscan.c for memory controller
  2007-12-11  5:29   ` KAMEZAWA Hiroyuki
@ 2007-12-11  5:36     ` Balbir Singh
  0 siblings, 0 replies; 5+ messages in thread
From: Balbir Singh @ 2007-12-11  5:36 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: Andrew Morton, yamamoto, LKML, linux-mm, riel

KAMEZAWA Hiroyuki wrote:
> On Tue, 11 Dec 2007 10:44:36 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> 
>> Looks good to me.
>>
>> Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
>>
>> TODO:
>>
>> 1. Should we have vm_events for the memory controller as well?
>>    May be in the longer term
>>
> 
> ALLOC_STALL is recoreded as failcnt, I think.
> I think DIRECT can be accoutned easily.

Thanks for clarifying

-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL

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

* Re: [PATCH][for -mm] fix accounting in vmscan.c for memory controller
  2007-12-11  2:26 [PATCH][for -mm] fix accounting in vmscan.c for memory controller KAMEZAWA Hiroyuki
  2007-12-11  5:14 ` Balbir Singh
@ 2007-12-11 11:24 ` KAMEZAWA Hiroyuki
  1 sibling, 0 replies; 5+ messages in thread
From: KAMEZAWA Hiroyuki @ 2007-12-11 11:24 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki; +Cc: Andrew Morton, balbir, yamamoto, LKML, linux-mm, riel

On Tue, 11 Dec 2007 11:26:44 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> Without this, ALLOCSTALL and PGSCAN_DIRECT increases too much unless
> there is no memory shortage.
Sorry,

Without this, ALLOCSTALL and PGSCAN_DIRECT increases too much even if
                                                              ^^^^^^^
there is no memory shortage.

-Kame


> 
> against 2.6.24-rc4-mm1.
> 
> -Kame
> 
> ==
> Some amount of accounting is done while page reclaiming.
> 
> Now, there are 2 types of page reclaim (if memory controller is used)
>   - global: shortage of (global) pages.
>   - under cgroup: use up to limit.
> 
> I think 2 accountings, ALLOCSTALL and DIRECT should be accounted only under
> global lru scan. They are accounted against memory shortage at alloc_pages().
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
>  mm/vmscan.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6.24-rc4-mm1/mm/vmscan.c
> ===================================================================
> --- linux-2.6.24-rc4-mm1.orig/mm/vmscan.c
> +++ linux-2.6.24-rc4-mm1/mm/vmscan.c
> @@ -896,8 +896,9 @@ static unsigned long shrink_inactive_lis
>  		if (current_is_kswapd()) {
>  			__count_zone_vm_events(PGSCAN_KSWAPD, zone, nr_scan);
>  			__count_vm_events(KSWAPD_STEAL, nr_freed);
> -		} else
> +		} else if (scan_global_lru(sc))
>  			__count_zone_vm_events(PGSCAN_DIRECT, zone, nr_scan);
> +
>  		__count_zone_vm_events(PGSTEAL, zone, nr_freed);
>  
>  		if (nr_taken == 0)
> @@ -1333,7 +1334,8 @@ static unsigned long do_try_to_free_page
>  	unsigned long lru_pages = 0;
>  	int i;
>  
> -	count_vm_event(ALLOCSTALL);
> +	if (scan_global_lru(sc))
> +		count_vm_event(ALLOCSTALL);
>  	/*
>  	 * mem_cgroup will not do shrink_slab.
>  	 */
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

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

end of thread, other threads:[~2007-12-11 11:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-11  2:26 [PATCH][for -mm] fix accounting in vmscan.c for memory controller KAMEZAWA Hiroyuki
2007-12-11  5:14 ` Balbir Singh
2007-12-11  5:29   ` KAMEZAWA Hiroyuki
2007-12-11  5:36     ` Balbir Singh
2007-12-11 11:24 ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox