Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1389829

Re: [PATCH v2 1/6] mm/page_alloc: recalculate some of zone threshold when on/offline memory

From Rui Teng <rui.teng@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/6] mm/page_alloc: recalculate some of zone threshold when on/offline memory
Date 2016-04-28 09:50 +0200
Message-ID <rsORX-7Mg-7@gated-at.bofh.it> (permalink)
References <rrHfQ-pj-7@gated-at.bofh.it> <rrHfR-pj-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 4/25/16 1:21 PM, js1304@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> Some of zone threshold depends on number of managed pages in the zone.
> When memory is going on/offline, it can be changed and we need to
> adjust them.
>
> This patch add recalculation to appropriate places and clean-up
> related function for better maintanance.
>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> ---
>  mm/page_alloc.c | 36 +++++++++++++++++++++++++++++-------
>  1 file changed, 29 insertions(+), 7 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 71fa015..ffa93e0 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -4633,6 +4633,8 @@ int local_memory_node(int node)
>  }
>  #endif
>
> +static void setup_min_unmapped_ratio(struct zone *zone);
> +static void setup_min_slab_ratio(struct zone *zone);
>  #else	/* CONFIG_NUMA */
>
>  static void set_zonelist_order(void)
> @@ -5747,9 +5749,8 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)
>  		zone->managed_pages = is_highmem_idx(j) ? realsize : freesize;
>  #ifdef CONFIG_NUMA
>  		zone->node = nid;
> -		zone->min_unmapped_pages = (freesize*sysctl_min_unmapped_ratio)
> -						/ 100;
> -		zone->min_slab_pages = (freesize * sysctl_min_slab_ratio) / 100;
> +		setup_min_unmapped_ratio(zone);
> +		setup_min_slab_ratio(zone);

The original logic use freesize to calculate the
zone->min_unmapped_pages and zone->min_slab_pages here.
But the new function will use zone->managed_pages.
Do you mean the original logic is wrong, or the managed_pages will
always be freesize when CONFIG_NUMA defined?

>  #endif
>  		zone->name = zone_names[j];
>  		spin_lock_init(&zone->lock);
> @@ -6655,6 +6656,7 @@ int __meminit init_per_zone_wmark_min(void)
>  {
>  	unsigned long lowmem_kbytes;
>  	int new_min_free_kbytes;
> +	struct zone *zone;
>
>  	lowmem_kbytes = nr_free_buffer_pages() * (PAGE_SIZE >> 10);
>  	new_min_free_kbytes = int_sqrt(lowmem_kbytes * 16);
> @@ -6672,6 +6674,14 @@ int __meminit init_per_zone_wmark_min(void)
>  	setup_per_zone_wmarks();
>  	refresh_zone_stat_thresholds();
>  	setup_per_zone_lowmem_reserve();
> +
> +	for_each_zone(zone) {
> +#ifdef CONFIG_NUMA
> +		setup_min_unmapped_ratio(zone);
> +		setup_min_slab_ratio(zone);
> +#endif
> +	}
> +
>  	return 0;
>  }
>  module_init(init_per_zone_wmark_min)
> @@ -6713,6 +6723,12 @@ int watermark_scale_factor_sysctl_handler(struct ctl_table *table, int write,
>  }
>
>  #ifdef CONFIG_NUMA
> +static void setup_min_unmapped_ratio(struct zone *zone)
> +{
> +	zone->min_unmapped_pages = (zone->managed_pages *
> +			sysctl_min_unmapped_ratio) / 100;
> +}
> +
>  int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write,
>  	void __user *buffer, size_t *length, loff_t *ppos)
>  {
> @@ -6724,11 +6740,17 @@ int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *table, int write,
>  		return rc;
>
>  	for_each_zone(zone)
> -		zone->min_unmapped_pages = (zone->managed_pages *
> -				sysctl_min_unmapped_ratio) / 100;
> +		setup_min_unmapped_ratio(zone);
> +
>  	return 0;
>  }
>
> +static void setup_min_slab_ratio(struct zone *zone)
> +{
> +	zone->min_slab_pages = (zone->managed_pages *
> +			sysctl_min_slab_ratio) / 100;
> +}
> +
>  int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write,
>  	void __user *buffer, size_t *length, loff_t *ppos)
>  {
> @@ -6740,8 +6762,8 @@ int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int write,
>  		return rc;
>
>  	for_each_zone(zone)
> -		zone->min_slab_pages = (zone->managed_pages *
> -				sysctl_min_slab_ratio) / 100;
> +		setup_min_slab_ratio(zone);
> +
>  	return 0;
>  }
>  #endif
>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] Introduce ZONE_CMA js1304@gmail.com - 2016-04-25 07:30 +0200
  [PATCH v2 5/6] mm/cma: remove MIGRATE_CMA js1304@gmail.com - 2016-04-25 07:30 +0200
  [PATCH v2 3/6] mm/cma: populate ZONE_CMA js1304@gmail.com - 2016-04-25 07:30 +0200
  [PATCH v2 1/6] mm/page_alloc: recalculate some of zone threshold when on/offline memory js1304@gmail.com - 2016-04-25 07:30 +0200
    Re: [PATCH v2 1/6] mm/page_alloc: recalculate some of zone threshold  when on/offline memory Rui Teng <rui.teng@linux.vnet.ibm.com> - 2016-04-28 09:50 +0200
      Re: [PATCH v2 1/6] mm/page_alloc: recalculate some of zone threshold  when on/offline memory Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-04-29 09:00 +0200
  [PATCH v2 6/6] mm/cma: remove per zone CMA stat js1304@gmail.com - 2016-04-25 07:30 +0200
  [PATCH v2 4/6] mm/cma: remove ALLOC_CMA js1304@gmail.com - 2016-04-25 07:30 +0200
  [PATCH v2 2/6] mm/cma: introduce new zone, ZONE_CMA js1304@gmail.com - 2016-04-25 07:30 +0200
    Re: [PATCH v2 2/6] mm/cma: introduce new zone, ZONE_CMA Rui Teng <rui.teng@linux.vnet.ibm.com> - 2016-04-26 11:40 +0200
      Re: [PATCH v2 2/6] mm/cma: introduce new zone, ZONE_CMA Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-04-29 09:10 +0200
  Re: [PATCH v2 0/6] Introduce ZONE_CMA Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-04-25 07:40 +0200
    Re: [PATCH v2 0/6] Introduce ZONE_CMA Mel Gorman <mgorman@techsingularity.net> - 2016-04-28 12:50 +0200
      Re: [PATCH v2 0/6] Introduce ZONE_CMA Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-04-29 09:00 +0200
        Re: [PATCH v2 0/6] Introduce ZONE_CMA Mel Gorman <mgorman@techsingularity.net> - 2016-04-29 11:30 +0200
          Re: [PATCH v2 0/6] Introduce ZONE_CMA Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-05-02 08:20 +0200
            Re: [PATCH v2 0/6] Introduce ZONE_CMA Vlastimil Babka <vbabka@suse.cz> - 2016-05-02 10:00 +0200
              Re: [PATCH v2 0/6] Introduce ZONE_CMA Joonsoo Kim <iamjoonsoo.kim@lge.com> - 2016-05-03 03:30 +0200

csiph-web