All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: js1304@gmail.com
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	mgorman@techsingularity.net, Laura Abbott <lauraa@codeaurora.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Michal Nazarewicz <mina86@mina86.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.vnet.ibm.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Russell King <linux@armlinux.org.uk>,
	Will Deacon <will.deacon@arm.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-team@lge.com, Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCH v7 1/7] mm/page_alloc: don't reserve ZONE_HIGHMEM for ZONE_MOVABLE request
Date: Mon, 17 Apr 2017 16:38:08 +0900	[thread overview]
Message-ID: <20170417073808.GA21354@bbox> (raw)
In-Reply-To: <1491880640-9944-2-git-send-email-iamjoonsoo.kim@lge.com>

Hi Joonsoo,

On Tue, Apr 11, 2017 at 12:17:14PM +0900, js1304@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> 
> Freepage on ZONE_HIGHMEM doesn't work for kernel memory so it's not that
> important to reserve. When ZONE_MOVABLE is used, this problem would
> theorectically cause to decrease usable memory for GFP_HIGHUSER_MOVABLE
> allocation request which is mainly used for page cache and anon page
> allocation. So, fix it.
> 
> And, defining sysctl_lowmem_reserve_ratio array by MAX_NR_ZONES - 1 size
> makes code complex. For example, if there is highmem system, following
> reserve ratio is activated for *NORMAL ZONE* which would be easyily
> misleading people.
> 
>  #ifdef CONFIG_HIGHMEM
>  32
>  #endif
> 
> This patch also fix this situation by defining sysctl_lowmem_reserve_ratio
> array by MAX_NR_ZONES and place "#ifdef" to right place.
> 
> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> ---
>  include/linux/mmzone.h |  2 +-
>  mm/page_alloc.c        | 11 ++++++-----
>  2 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index ebaccd4..96194bf 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -869,7 +869,7 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
>  					void __user *, size_t *, loff_t *);
>  int watermark_scale_factor_sysctl_handler(struct ctl_table *, int,
>  					void __user *, size_t *, loff_t *);
> -extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
> +extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES];
>  int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int,
>  					void __user *, size_t *, loff_t *);
>  int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int,
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 32b31d6..60ffa4e 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -203,17 +203,18 @@ static void __free_pages_ok(struct page *page, unsigned int order);
>   * TBD: should special case ZONE_DMA32 machines here - in those we normally
>   * don't need any ZONE_NORMAL reservation
>   */
> -int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
> +int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES] = {
>  #ifdef CONFIG_ZONE_DMA
> -	 256,
> +	[ZONE_DMA] = 256,
>  #endif
>  #ifdef CONFIG_ZONE_DMA32
> -	 256,
> +	[ZONE_DMA32] = 256,
>  #endif
> +	[ZONE_NORMAL] = 32,
>  #ifdef CONFIG_HIGHMEM
> -	 32,
> +	[ZONE_HIGHMEM] = INT_MAX,
>  #endif
> -	 32,
> +	[ZONE_MOVABLE] = INT_MAX,
>  };

We need to update lowmem_reserve_ratio in Documentation/sysctl/vm.txt.
And to me, INT_MAX is rather awkward.

# cat /proc/sys/vm/lowmem_reserve_ratio
        256     256     32      2147483647      2147483647

What do you think about to use 0 or -1 as special meaning
instead 2147483647?

Anyway, it could be separate patch regardless of zone_cma
so I hope Andrew to merge this patch regardless of other patches
in this patchset.

Thanks.

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

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: <js1304@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	<mgorman@techsingularity.net>,
	Laura Abbott <lauraa@codeaurora.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Michal Nazarewicz <mina86@mina86.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.vnet.ibm.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Russell King <linux@armlinux.org.uk>,
	Will Deacon <will.deacon@arm.com>, <linux-mm@kvack.org>,
	<linux-kernel@vger.kernel.org>, <kernel-team@lge.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCH v7 1/7] mm/page_alloc: don't reserve ZONE_HIGHMEM for ZONE_MOVABLE request
Date: Mon, 17 Apr 2017 16:38:08 +0900	[thread overview]
Message-ID: <20170417073808.GA21354@bbox> (raw)
In-Reply-To: <1491880640-9944-2-git-send-email-iamjoonsoo.kim@lge.com>

Hi Joonsoo,

On Tue, Apr 11, 2017 at 12:17:14PM +0900, js1304@gmail.com wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> 
> Freepage on ZONE_HIGHMEM doesn't work for kernel memory so it's not that
> important to reserve. When ZONE_MOVABLE is used, this problem would
> theorectically cause to decrease usable memory for GFP_HIGHUSER_MOVABLE
> allocation request which is mainly used for page cache and anon page
> allocation. So, fix it.
> 
> And, defining sysctl_lowmem_reserve_ratio array by MAX_NR_ZONES - 1 size
> makes code complex. For example, if there is highmem system, following
> reserve ratio is activated for *NORMAL ZONE* which would be easyily
> misleading people.
> 
>  #ifdef CONFIG_HIGHMEM
>  32
>  #endif
> 
> This patch also fix this situation by defining sysctl_lowmem_reserve_ratio
> array by MAX_NR_ZONES and place "#ifdef" to right place.
> 
> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> ---
>  include/linux/mmzone.h |  2 +-
>  mm/page_alloc.c        | 11 ++++++-----
>  2 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index ebaccd4..96194bf 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -869,7 +869,7 @@ int min_free_kbytes_sysctl_handler(struct ctl_table *, int,
>  					void __user *, size_t *, loff_t *);
>  int watermark_scale_factor_sysctl_handler(struct ctl_table *, int,
>  					void __user *, size_t *, loff_t *);
> -extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
> +extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES];
>  int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int,
>  					void __user *, size_t *, loff_t *);
>  int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int,
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 32b31d6..60ffa4e 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -203,17 +203,18 @@ static void __free_pages_ok(struct page *page, unsigned int order);
>   * TBD: should special case ZONE_DMA32 machines here - in those we normally
>   * don't need any ZONE_NORMAL reservation
>   */
> -int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
> +int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES] = {
>  #ifdef CONFIG_ZONE_DMA
> -	 256,
> +	[ZONE_DMA] = 256,
>  #endif
>  #ifdef CONFIG_ZONE_DMA32
> -	 256,
> +	[ZONE_DMA32] = 256,
>  #endif
> +	[ZONE_NORMAL] = 32,
>  #ifdef CONFIG_HIGHMEM
> -	 32,
> +	[ZONE_HIGHMEM] = INT_MAX,
>  #endif
> -	 32,
> +	[ZONE_MOVABLE] = INT_MAX,
>  };

We need to update lowmem_reserve_ratio in Documentation/sysctl/vm.txt.
And to me, INT_MAX is rather awkward.

# cat /proc/sys/vm/lowmem_reserve_ratio
        256     256     32      2147483647      2147483647

What do you think about to use 0 or -1 as special meaning
instead 2147483647?

Anyway, it could be separate patch regardless of zone_cma
so I hope Andrew to merge this patch regardless of other patches
in this patchset.

Thanks.

  reply	other threads:[~2017-04-17  7:38 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11  3:17 [PATCH v7 0/7] Introduce ZONE_CMA js1304
2017-04-11  3:17 ` js1304
2017-04-11  3:17 ` [PATCH v7 1/7] mm/page_alloc: don't reserve ZONE_HIGHMEM for ZONE_MOVABLE request js1304
2017-04-11  3:17   ` js1304
2017-04-17  7:38   ` Minchan Kim [this message]
2017-04-17  7:38     ` Minchan Kim
2017-04-21  1:32     ` Joonsoo Kim
2017-04-21  1:32       ` Joonsoo Kim
2017-04-11  3:17 ` [PATCH v7 2/7] mm/cma: introduce new zone, ZONE_CMA js1304
2017-04-11  3:17   ` js1304
2017-04-11  3:17 ` [PATCH v7 3/7] mm/cma: populate ZONE_CMA js1304
2017-04-11  3:17   ` js1304
2017-04-11  3:17 ` [PATCH v7 4/7] mm/cma: remove ALLOC_CMA js1304
2017-04-11  3:17   ` js1304
2017-04-11  3:17 ` [PATCH v7 5/7] mm/cma: remove MIGRATE_CMA js1304
2017-04-11  3:17   ` js1304
2017-04-11  3:17 ` [PATCH v7 6/7] mm/cma: remove per zone CMA stat js1304
2017-04-11  3:17   ` js1304
2017-04-11  3:17 ` [PATCH v7 7/7] ARM: CMA: avoid re-mapping CMA region if CONFIG_HIGHMEM js1304
2017-04-11  3:17   ` js1304
2017-04-11 18:15 ` [PATCH v7 0/7] Introduce ZONE_CMA Michal Hocko
2017-04-11 18:15   ` Michal Hocko
2017-04-12  1:35   ` Joonsoo Kim
2017-04-12  1:35     ` Joonsoo Kim
2017-04-13 11:56     ` Michal Hocko
2017-04-13 11:56       ` Michal Hocko
2017-04-17  2:02       ` Joonsoo Kim
2017-04-17  2:02         ` Joonsoo Kim
2017-04-21  1:35         ` Joonsoo Kim
2017-04-21  1:35           ` Joonsoo Kim
2017-04-21  6:54           ` Michal Hocko
2017-04-21  6:54             ` Michal Hocko
2017-04-24 13:09         ` Michal Hocko
2017-04-24 13:09           ` Michal Hocko
2017-04-25  3:42           ` Joonsoo Kim
2017-04-25  3:42             ` Joonsoo Kim
2017-04-27 15:06             ` Michal Hocko
2017-04-27 15:06               ` Michal Hocko
2017-04-28  8:04               ` Generic approach to customizable zones - was: " Igor Stoppa
2017-04-28  8:04                 ` Igor Stoppa
2017-04-28  8:36                 ` Michal Hocko
2017-04-28  8:36                   ` Michal Hocko
2017-04-28  9:04                   ` Igor Stoppa
2017-04-28  9:04                     ` Igor Stoppa
2017-05-02  4:01               ` Joonsoo Kim
2017-05-02  4:01                 ` Joonsoo Kim
2017-05-02 13:32                 ` Michal Hocko
2017-05-02 13:32                   ` Michal Hocko
2017-05-11  2:12                   ` Joonsoo Kim
2017-05-11  2:12                     ` Joonsoo Kim
2017-05-11  9:13                     ` Michal Hocko
2017-05-11  9:13                       ` Michal Hocko
2017-05-12  2:00                       ` Joonsoo Kim
2017-05-12  2:00                         ` Joonsoo Kim
2017-05-12  6:38                         ` Michal Hocko
2017-05-12  6:38                           ` Michal Hocko
2017-05-15  3:57                           ` Joonsoo Kim
2017-05-15  3:57                             ` Joonsoo Kim
2017-05-16  8:47                             ` Michal Hocko
2017-05-16  8:47                               ` Michal Hocko
2017-05-17  7:44                               ` Joonsoo Kim
2017-05-17  7:44                                 ` Joonsoo Kim
2017-05-02  8:06               ` Vlastimil Babka
2017-05-02  8:06                 ` Vlastimil Babka
2017-05-02 13:03                 ` Michal Hocko
2017-05-02 13:03                   ` Michal Hocko
2017-05-02 13:41                   ` Igor Stoppa
2017-05-02 13:41                     ` Igor Stoppa
2017-05-04 12:33                   ` Vlastimil Babka
2017-05-04 12:33                     ` Vlastimil Babka
2017-05-04 12:46                     ` Michal Hocko
2017-05-04 12:46                       ` Michal Hocko
2017-05-11  8:51                       ` Vlastimil Babka
2017-05-11  8:51                         ` Vlastimil Babka
2017-04-12  1:39 ` Joonsoo Kim
2017-04-12  1:39   ` Joonsoo Kim
2017-04-24  4:08 ` Bob Liu
2017-04-24  4:08   ` Bob Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170417073808.GA21354@bbox \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=kernel-team@lge.com \
    --cc=lauraa@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@armlinux.org.uk \
    --cc=m.szyprowski@samsung.com \
    --cc=mgorman@techsingularity.net \
    --cc=mina86@mina86.com \
    --cc=riel@redhat.com \
    --cc=vbabka@suse.cz \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.