All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/thp: don't count ZONE_MOVABLE as the target for freepage reserving
@ 2018-04-05  7:27 js1304
  2018-04-05  7:57 ` Michal Hocko
  0 siblings, 1 reply; 5+ messages in thread
From: js1304 @ 2018-04-05  7:27 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Kirill A . Shutemov, Michal Hocko, Mel Gorman, Vlastimil Babka,
	linux-mm, linux-kernel, Joonsoo Kim

From: Joonsoo Kim <iamjoonsoo.kim@lge.com>

ZONE_MOVABLE only has movable pages so we don't need to keep enough
freepages to avoid or deal with fragmentation. So, don't count it.

This changes min_free_kbytes and thus min_watermark greatly
if ZONE_MOVABLE is used. It will make the user uses more memory.

o System
22GB ram, fakenuma, 2 nodes. 5 zones are used.

o Before
min_free_kbytes: 112640

zone_info (min_watermark):
Node 0, zone      DMA
        min      19
Node 0, zone    DMA32
        min      3778
Node 0, zone   Normal
        min      10191
Node 0, zone  Movable
        min      0
Node 0, zone   Device
        min      0
Node 1, zone      DMA
        min      0
Node 1, zone    DMA32
        min      0
Node 1, zone   Normal
        min      14043
Node 1, zone  Movable
        min      127
Node 1, zone   Device
        min      0

o After
min_free_kbytes: 90112

zone_info (min_watermark):
Node 0, zone      DMA
        min      15
Node 0, zone    DMA32
        min      3022
Node 0, zone   Normal
        min      8152
Node 0, zone  Movable
        min      0
Node 0, zone   Device
        min      0
Node 1, zone      DMA
        min      0
Node 1, zone    DMA32
        min      0
Node 1, zone   Normal
        min      11234
Node 1, zone  Movable
        min      102
Node 1, zone   Device
        min      0

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
 mm/khugepaged.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index 5de1c6f..92dd4e6 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1880,8 +1880,16 @@ static void set_recommended_min_free_kbytes(void)
 	int nr_zones = 0;
 	unsigned long recommended_min;
 
-	for_each_populated_zone(zone)
+	for_each_populated_zone(zone) {
+		/*
+		 * We don't need to worry about fragmentation of
+		 * ZONE_MOVABLE since it only has movable pages.
+		 */
+		if (zone_idx(zone) > gfp_zone(GFP_USER))
+			continue;
+
 		nr_zones++;
+	}
 
 	/* Ensure 2 pageblocks are free to assist fragmentation avoidance */
 	recommended_min = pageblock_nr_pages * nr_zones * 2;
-- 
2.7.4

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

* Re: [PATCH] mm/thp: don't count ZONE_MOVABLE as the target for freepage reserving
  2018-04-05  7:27 [PATCH] mm/thp: don't count ZONE_MOVABLE as the target for freepage reserving js1304
@ 2018-04-05  7:57 ` Michal Hocko
  2018-04-05  8:05   ` Joonsoo Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Hocko @ 2018-04-05  7:57 UTC (permalink / raw)
  To: js1304
  Cc: Andrew Morton, Kirill A . Shutemov, Mel Gorman, Vlastimil Babka,
	linux-mm, linux-kernel, Joonsoo Kim

On Thu 05-04-18 16:27:16, Joonsoo Kim wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> 
> ZONE_MOVABLE only has movable pages so we don't need to keep enough
> freepages to avoid or deal with fragmentation. So, don't count it.
> 
> This changes min_free_kbytes and thus min_watermark greatly
> if ZONE_MOVABLE is used. It will make the user uses more memory.

OK, but why does it matter. Has anybody seen this as an issue?

> o System
> 22GB ram, fakenuma, 2 nodes. 5 zones are used.
> 
> o Before
> min_free_kbytes: 112640
> 
> zone_info (min_watermark):
> Node 0, zone      DMA
>         min      19
> Node 0, zone    DMA32
>         min      3778
> Node 0, zone   Normal
>         min      10191
> Node 0, zone  Movable
>         min      0
> Node 0, zone   Device
>         min      0
> Node 1, zone      DMA
>         min      0
> Node 1, zone    DMA32
>         min      0
> Node 1, zone   Normal
>         min      14043
> Node 1, zone  Movable
>         min      127
> Node 1, zone   Device
>         min      0
> 
> o After
> min_free_kbytes: 90112
> 
> zone_info (min_watermark):
> Node 0, zone      DMA
>         min      15
> Node 0, zone    DMA32
>         min      3022
> Node 0, zone   Normal
>         min      8152
> Node 0, zone  Movable
>         min      0
> Node 0, zone   Device
>         min      0
> Node 1, zone      DMA
>         min      0
> Node 1, zone    DMA32
>         min      0
> Node 1, zone   Normal
>         min      11234
> Node 1, zone  Movable
>         min      102
> Node 1, zone   Device
>         min      0
> 
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> ---
>  mm/khugepaged.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> index 5de1c6f..92dd4e6 100644
> --- a/mm/khugepaged.c
> +++ b/mm/khugepaged.c
> @@ -1880,8 +1880,16 @@ static void set_recommended_min_free_kbytes(void)
>  	int nr_zones = 0;
>  	unsigned long recommended_min;
>  
> -	for_each_populated_zone(zone)
> +	for_each_populated_zone(zone) {
> +		/*
> +		 * We don't need to worry about fragmentation of
> +		 * ZONE_MOVABLE since it only has movable pages.
> +		 */
> +		if (zone_idx(zone) > gfp_zone(GFP_USER))
> +			continue;
> +
>  		nr_zones++;
> +	}
>  
>  	/* Ensure 2 pageblocks are free to assist fragmentation avoidance */
>  	recommended_min = pageblock_nr_pages * nr_zones * 2;
> -- 
> 2.7.4
> 

-- 
Michal Hocko
SUSE Labs

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

* Re: [PATCH] mm/thp: don't count ZONE_MOVABLE as the target for freepage reserving
  2018-04-05  7:57 ` Michal Hocko
@ 2018-04-05  8:05   ` Joonsoo Kim
  2018-04-05  8:10     ` Joonsoo Kim
  2018-04-05  8:27     ` Michal Hocko
  0 siblings, 2 replies; 5+ messages in thread
From: Joonsoo Kim @ 2018-04-05  8:05 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Kirill A . Shutemov, Mel Gorman, Vlastimil Babka,
	linux-mm, linux-kernel

On Thu, Apr 05, 2018 at 09:57:53AM +0200, Michal Hocko wrote:
> On Thu 05-04-18 16:27:16, Joonsoo Kim wrote:
> > From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > 
> > ZONE_MOVABLE only has movable pages so we don't need to keep enough
> > freepages to avoid or deal with fragmentation. So, don't count it.
> > 
> > This changes min_free_kbytes and thus min_watermark greatly
> > if ZONE_MOVABLE is used. It will make the user uses more memory.
> 
> OK, but why does it matter. Has anybody seen this as an issue?

There was a regression report for CMA patchset and I think that it is
related to this problem. CMA patchset makes the system uses one more
zone (ZONE_MOVABLE) and then increase min_free_kbytes. It reduces
usable memory and it could cause regression.

http://lkml.kernel.org/r/20180102063528.GG30397@yexl-desktop

Thanks.

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

* Re: [PATCH] mm/thp: don't count ZONE_MOVABLE as the target for freepage reserving
  2018-04-05  8:05   ` Joonsoo Kim
@ 2018-04-05  8:10     ` Joonsoo Kim
  2018-04-05  8:27     ` Michal Hocko
  1 sibling, 0 replies; 5+ messages in thread
From: Joonsoo Kim @ 2018-04-05  8:10 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Kirill A . Shutemov, Mel Gorman, Vlastimil Babka,
	linux-mm, linux-kernel

On Thu, Apr 05, 2018 at 05:05:39PM +0900, Joonsoo Kim wrote:
> On Thu, Apr 05, 2018 at 09:57:53AM +0200, Michal Hocko wrote:
> > On Thu 05-04-18 16:27:16, Joonsoo Kim wrote:
> > > From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > > 
> > > ZONE_MOVABLE only has movable pages so we don't need to keep enough
> > > freepages to avoid or deal with fragmentation. So, don't count it.
> > > 
> > > This changes min_free_kbytes and thus min_watermark greatly
> > > if ZONE_MOVABLE is used. It will make the user uses more memory.

Oops.. s/more/less

> > 
> > OK, but why does it matter. Has anybody seen this as an issue?
> 
> There was a regression report for CMA patchset and I think that it is
> related to this problem. CMA patchset makes the system uses one more
> zone (ZONE_MOVABLE) and then increase min_free_kbytes. It reduces
> usable memory and it could cause regression.
> 
> http://lkml.kernel.org/r/20180102063528.GG30397@yexl-desktop

Thanks.

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

* Re: [PATCH] mm/thp: don't count ZONE_MOVABLE as the target for freepage reserving
  2018-04-05  8:05   ` Joonsoo Kim
  2018-04-05  8:10     ` Joonsoo Kim
@ 2018-04-05  8:27     ` Michal Hocko
  1 sibling, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2018-04-05  8:27 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: Andrew Morton, Kirill A . Shutemov, Mel Gorman, Vlastimil Babka,
	linux-mm, linux-kernel

On Thu 05-04-18 17:05:39, Joonsoo Kim wrote:
> On Thu, Apr 05, 2018 at 09:57:53AM +0200, Michal Hocko wrote:
> > On Thu 05-04-18 16:27:16, Joonsoo Kim wrote:
> > > From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> > > 
> > > ZONE_MOVABLE only has movable pages so we don't need to keep enough
> > > freepages to avoid or deal with fragmentation. So, don't count it.
> > > 
> > > This changes min_free_kbytes and thus min_watermark greatly
> > > if ZONE_MOVABLE is used. It will make the user uses more memory.
> > 
> > OK, but why does it matter. Has anybody seen this as an issue?
> 
> There was a regression report for CMA patchset and I think that it is
> related to this problem. CMA patchset makes the system uses one more
> zone (ZONE_MOVABLE) and then increase min_free_kbytes. It reduces
> usable memory and it could cause regression.
> 
> http://lkml.kernel.org/r/20180102063528.GG30397@yexl-desktop

Then this should be a part of the changelog along with some reproducible
results, please.
-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2018-04-05  8:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-05  7:27 [PATCH] mm/thp: don't count ZONE_MOVABLE as the target for freepage reserving js1304
2018-04-05  7:57 ` Michal Hocko
2018-04-05  8:05   ` Joonsoo Kim
2018-04-05  8:10     ` Joonsoo Kim
2018-04-05  8:27     ` Michal Hocko

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.