linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] add inactive ratio calculation function of each zone V2
@ 2009-05-21  0:23 Minchan Kim
  2009-05-25  9:00 ` Mel Gorman
  2009-05-27  5:30 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Minchan Kim @ 2009-05-21  0:23 UTC (permalink / raw)
  To: Andrew Morton, LKML, linux-mm
  Cc: Mel Gorman, KOSAKI Motohiro, Rik van Riel, Johannes Weiner,
	Yasunori Goto

Changelog since V1 
 o Change function name from calculate_zone_inactive_ratio to calculate_inactive_ratio
   - by Mel Gorman advise
 o Modify tab indent - by Mel Gorman advise

This patch devide setup_per_zone_inactive_ratio with
per-zone inactive ratio calculaton.

This patch is just for helping my next patch.
(reset wmark_min and inactive ratio of zone when hotplug happens)

Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Rik van Riel <riel@redhat.com>
CC: Johannes Weiner <hannes@cmpxchg.org>
---
 include/linux/mm.h |    1 +
 mm/page_alloc.c    |   28 ++++++++++++++++------------
 2 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7ea4d1b..5d7a835 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1059,6 +1059,7 @@ extern void set_dma_reserve(unsigned long new_dma_reserve);
 extern void memmap_init_zone(unsigned long, int, unsigned long,
 				unsigned long, enum memmap_context);
 extern void setup_per_zone_wmarks(void);
+extern void calculate_zone_inactive_ratio(struct zone *zone);
 extern void mem_init(void);
 extern void __init mmap_init(void);
 extern void show_mem(void);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b518ea7..f11cfbf 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4553,22 +4553,26 @@ void setup_per_zone_wmarks(void)
  *    1TB     101        10GB
  *   10TB     320        32GB
  */
-static void __init setup_per_zone_inactive_ratio(void)
+void calculate_zone_inactive_ratio(struct zone *zone)
 {
-	struct zone *zone;
+	unsigned int gb, ratio;
 
-	for_each_zone(zone) {
-		unsigned int gb, ratio;
+	/* Zone size in gigabytes */
+	gb = zone->present_pages >> (30 - PAGE_SHIFT);
+	if (gb)
+		ratio = int_sqrt(10 * gb);
+	else
+		ratio = 1;
 
-		/* Zone size in gigabytes */
-		gb = zone->present_pages >> (30 - PAGE_SHIFT);
-		if (gb)
-			ratio = int_sqrt(10 * gb);
-		else
-			ratio = 1;
+	zone->inactive_ratio = ratio;
+}
 
-		zone->inactive_ratio = ratio;
-	}
+static void __init setup_per_zone_inactive_ratio(void)
+{
+	struct zone *zone;
+
+	for_each_zone(zone)
+		calculate_zone_inactive_ratio(zone);	
 }
 
 /*
-- 
1.5.4.3


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

* Re: [PATCH 2/3] add inactive ratio calculation function of each zone V2
  2009-05-21  0:23 [PATCH 2/3] add inactive ratio calculation function of each zone V2 Minchan Kim
@ 2009-05-25  9:00 ` Mel Gorman
  2009-05-27  5:30 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Mel Gorman @ 2009-05-25  9:00 UTC (permalink / raw)
  To: Minchan Kim
  Cc: Andrew Morton, LKML, linux-mm, KOSAKI Motohiro, Rik van Riel,
	Johannes Weiner, Yasunori Goto

On Thu, May 21, 2009 at 09:23:21AM +0900, Minchan Kim wrote:
> Changelog since V1 
>  o Change function name from calculate_zone_inactive_ratio to calculate_inactive_ratio
>    - by Mel Gorman advise
>  o Modify tab indent - by Mel Gorman advise
> 
> This patch devide setup_per_zone_inactive_ratio with
> per-zone inactive ratio calculaton.
> 
> This patch is just for helping my next patch.
> (reset wmark_min and inactive ratio of zone when hotplug happens)
> 
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

Reviewed-by: Mel Gorman <mel@csn.ul.ie>

> CC: Rik van Riel <riel@redhat.com>
> CC: Johannes Weiner <hannes@cmpxchg.org>
> ---
>  include/linux/mm.h |    1 +
>  mm/page_alloc.c    |   28 ++++++++++++++++------------
>  2 files changed, 17 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 7ea4d1b..5d7a835 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1059,6 +1059,7 @@ extern void set_dma_reserve(unsigned long new_dma_reserve);
>  extern void memmap_init_zone(unsigned long, int, unsigned long,
>  				unsigned long, enum memmap_context);
>  extern void setup_per_zone_wmarks(void);
> +extern void calculate_zone_inactive_ratio(struct zone *zone);
>  extern void mem_init(void);
>  extern void __init mmap_init(void);
>  extern void show_mem(void);
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index b518ea7..f11cfbf 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4553,22 +4553,26 @@ void setup_per_zone_wmarks(void)
>   *    1TB     101        10GB
>   *   10TB     320        32GB
>   */
> -static void __init setup_per_zone_inactive_ratio(void)
> +void calculate_zone_inactive_ratio(struct zone *zone)
>  {
> -	struct zone *zone;
> +	unsigned int gb, ratio;
>  
> -	for_each_zone(zone) {
> -		unsigned int gb, ratio;
> +	/* Zone size in gigabytes */
> +	gb = zone->present_pages >> (30 - PAGE_SHIFT);
> +	if (gb)
> +		ratio = int_sqrt(10 * gb);
> +	else
> +		ratio = 1;
>  
> -		/* Zone size in gigabytes */
> -		gb = zone->present_pages >> (30 - PAGE_SHIFT);
> -		if (gb)
> -			ratio = int_sqrt(10 * gb);
> -		else
> -			ratio = 1;
> +	zone->inactive_ratio = ratio;
> +}
>  
> -		zone->inactive_ratio = ratio;
> -	}
> +static void __init setup_per_zone_inactive_ratio(void)
> +{
> +	struct zone *zone;
> +
> +	for_each_zone(zone)
> +		calculate_zone_inactive_ratio(zone);	
>  }
>  
>  /*
> -- 
> 1.5.4.3
> 

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

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

* Re: [PATCH 2/3] add inactive ratio calculation function of each zone V2
  2009-05-21  0:23 [PATCH 2/3] add inactive ratio calculation function of each zone V2 Minchan Kim
  2009-05-25  9:00 ` Mel Gorman
@ 2009-05-27  5:30 ` Andrew Morton
  2009-05-27  6:05   ` Minchan Kim
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2009-05-27  5:30 UTC (permalink / raw)
  To: Minchan Kim
  Cc: LKML, linux-mm, Mel Gorman, KOSAKI Motohiro, Rik van Riel,
	Johannes Weiner, Yasunori Goto

On Thu, 21 May 2009 09:23:21 +0900 Minchan Kim <minchan.kim@gmail.com> wrote:

> Changelog since V1 
>  o Change function name from calculate_zone_inactive_ratio to calculate_inactive_ratio
>    - by Mel Gorman advise
>  o Modify tab indent - by Mel Gorman advise

The first two patches still had various trivial whitespace bustages. 
You don't need Mel to find these things when we have the very nice
scripts/checkpatch.pl.  Please incorporate that script into your patch
preparation tools

> This patch devide setup_per_zone_inactive_ratio with
> per-zone inactive ratio calculaton.

The above sentence appears to be the changelog for this patch but it
doesn't make a lot of sense.

afaict the changelog should be:

"factor the per-zone arithemetic inside
setup_per_zone_inactive_ratio()'s loop into a a separate function,
calculate_zone_inactive_ratio().  This function will be used in a later
patch".

yes?


> This patch is just for helping my next patch.
> (reset wmark_min and inactive ratio of zone when hotplug happens)
> 
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> CC: Rik van Riel <riel@redhat.com>
> CC: Johannes Weiner <hannes@cmpxchg.org>

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

* Re: [PATCH 2/3] add inactive ratio calculation function of each zone V2
  2009-05-27  5:30 ` Andrew Morton
@ 2009-05-27  6:05   ` Minchan Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Minchan Kim @ 2009-05-27  6:05 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Minchan Kim, LKML, linux-mm, Mel Gorman, KOSAKI Motohiro,
	Rik van Riel, Johannes Weiner, Yasunori Goto

On Tue, 26 May 2009 22:30:02 -0700
Andrew Morton <akpm@linux-foundation.org> wrote:

> On Thu, 21 May 2009 09:23:21 +0900 Minchan Kim <minchan.kim@gmail.com> wrote:
> 
> > Changelog since V1 
> >  o Change function name from calculate_zone_inactive_ratio to calculate_inactive_ratio
> >    - by Mel Gorman advise
> >  o Modify tab indent - by Mel Gorman advise
> 
> The first two patches still had various trivial whitespace bustages. 
> You don't need Mel to find these things when we have the very nice
> scripts/checkpatch.pl.  Please incorporate that script into your patch
> preparation tools

Oops. I thought I tried to do checkpatch.pl with my patches. 

> > This patch devide setup_per_zone_inactive_ratio with
> > per-zone inactive ratio calculaton.
> 
> The above sentence appears to be the changelog for this patch but it
> doesn't make a lot of sense.
> 
> afaict the changelog should be:
> 
> "factor the per-zone arithemetic inside
> setup_per_zone_inactive_ratio()'s loop into a a separate function,
> calculate_zone_inactive_ratio().  This function will be used in a later
> patch".
> 
> yes?

Exactly. 

I will repost this with your improved changelog.
Thanks. Andrew.



-- 
Kinds Regards
Minchan Kim

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

end of thread, other threads:[~2009-05-27  6:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-21  0:23 [PATCH 2/3] add inactive ratio calculation function of each zone V2 Minchan Kim
2009-05-25  9:00 ` Mel Gorman
2009-05-27  5:30 ` Andrew Morton
2009-05-27  6:05   ` 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).