All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] mm: setting of min_free_kbytes
@ 2016-04-12 19:54 ` Jason Baron
  0 siblings, 0 replies; 8+ messages in thread
From: Jason Baron @ 2016-04-12 19:54 UTC (permalink / raw)
  To: akpm, kirill.shutemov
  Cc: rientjes, aarcange, mgorman, mhocko, hannes, vbabka, linux-mm,
	linux-kernel

Hi,

While updating a workload to a 4.1 kernel (from 3.14), I found that
min_free_kbytes was automatically set to 11365, whereas on 3.14 it was
67584. This is caused by a change to how min_free_kbytes is set when
CONFIG_TRANSPARENT_HUGEPAGE=y, which is detailed in the patch that
follows.

I was wondering as well if the setting of min_free_kbytes could be
improved in the following cases while looking at this code:

1) memory hotplug

we call init_per_zone_wmark_min() but not
set_recommended_min_free_kbytes() (for hugepages)

2) when khugepaged is stopped

Do we want to undo any settings thath khugepaged has done in that
case to restore the default settings

Thanks,

-Jason

Jason Baron (1):
  mm: update min_free_kbytes from khugepaged after core initialization

 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.6.1

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

* [PATCH 0/1] mm: setting of min_free_kbytes
@ 2016-04-12 19:54 ` Jason Baron
  0 siblings, 0 replies; 8+ messages in thread
From: Jason Baron @ 2016-04-12 19:54 UTC (permalink / raw)
  To: akpm, kirill.shutemov
  Cc: rientjes, aarcange, mgorman, mhocko, hannes, vbabka, linux-mm,
	linux-kernel

Hi,

While updating a workload to a 4.1 kernel (from 3.14), I found that
min_free_kbytes was automatically set to 11365, whereas on 3.14 it was
67584. This is caused by a change to how min_free_kbytes is set when
CONFIG_TRANSPARENT_HUGEPAGE=y, which is detailed in the patch that
follows.

I was wondering as well if the setting of min_free_kbytes could be
improved in the following cases while looking at this code:

1) memory hotplug

we call init_per_zone_wmark_min() but not
set_recommended_min_free_kbytes() (for hugepages)

2) when khugepaged is stopped

Do we want to undo any settings thath khugepaged has done in that
case to restore the default settings

Thanks,

-Jason

Jason Baron (1):
  mm: update min_free_kbytes from khugepaged after core initialization

 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.6.1

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

* [PATCH 1/1] mm: update min_free_kbytes from khugepaged after core initialization
  2016-04-12 19:54 ` Jason Baron
@ 2016-04-12 19:54   ` Jason Baron
  -1 siblings, 0 replies; 8+ messages in thread
From: Jason Baron @ 2016-04-12 19:54 UTC (permalink / raw)
  To: akpm, kirill.shutemov
  Cc: rientjes, aarcange, mgorman, mhocko, hannes, vbabka, linux-mm,
	linux-kernel

Khugepaged attempts to raise min_free_kbytes if its set too low. However,
on boot khugepaged sets min_free_kbytes first from subsys_initcall(), and
then the mm 'core' over-rides min_free_kbytes after from
init_per_zone_wmark_min(), via a module_init() call.

Khugepaged used to use a late_initcall() to set min_free_kbytes (such that
it occurred after the core initialization), however this was removed when
the initialization of min_free_kbytes was integrated into the starting of
the khugepaged thread.

The fix here is simply to invoke the core initialization using a
core_initcall() instead of module_init(), such that the previous
initialization ordering is restored. I didn't restore the late_initcall()
since start_stop_khugepaged() already sets min_free_kbytes via
set_recommended_min_free_kbytes().

This was noticed when we had a number of page allocation failures when
moving a workload to a kernel with this new initialization ordering. On an
8GB system this restores min_free_kbytes back to 67584 from 11365 when
CONFIG_TRANSPARENT_HUGEPAGE=y is set and either
CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y or
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y.

Fixes: 79553da293d3 ("thp: cleanup khugepaged startup")
Signed-off-by: Jason Baron <jbaron@akamai.com>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 59de90d5d3a3..c1069efcc4d7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6485,7 +6485,7 @@ int __meminit init_per_zone_wmark_min(void)
 	setup_per_zone_inactive_ratio();
 	return 0;
 }
-module_init(init_per_zone_wmark_min)
+core_initcall(init_per_zone_wmark_min)
 
 /*
  * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so
-- 
2.6.1

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

* [PATCH 1/1] mm: update min_free_kbytes from khugepaged after core initialization
@ 2016-04-12 19:54   ` Jason Baron
  0 siblings, 0 replies; 8+ messages in thread
From: Jason Baron @ 2016-04-12 19:54 UTC (permalink / raw)
  To: akpm, kirill.shutemov
  Cc: rientjes, aarcange, mgorman, mhocko, hannes, vbabka, linux-mm,
	linux-kernel

Khugepaged attempts to raise min_free_kbytes if its set too low. However,
on boot khugepaged sets min_free_kbytes first from subsys_initcall(), and
then the mm 'core' over-rides min_free_kbytes after from
init_per_zone_wmark_min(), via a module_init() call.

Khugepaged used to use a late_initcall() to set min_free_kbytes (such that
it occurred after the core initialization), however this was removed when
the initialization of min_free_kbytes was integrated into the starting of
the khugepaged thread.

The fix here is simply to invoke the core initialization using a
core_initcall() instead of module_init(), such that the previous
initialization ordering is restored. I didn't restore the late_initcall()
since start_stop_khugepaged() already sets min_free_kbytes via
set_recommended_min_free_kbytes().

This was noticed when we had a number of page allocation failures when
moving a workload to a kernel with this new initialization ordering. On an
8GB system this restores min_free_kbytes back to 67584 from 11365 when
CONFIG_TRANSPARENT_HUGEPAGE=y is set and either
CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y or
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y.

Fixes: 79553da293d3 ("thp: cleanup khugepaged startup")
Signed-off-by: Jason Baron <jbaron@akamai.com>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 59de90d5d3a3..c1069efcc4d7 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6485,7 +6485,7 @@ int __meminit init_per_zone_wmark_min(void)
 	setup_per_zone_inactive_ratio();
 	return 0;
 }
-module_init(init_per_zone_wmark_min)
+core_initcall(init_per_zone_wmark_min)
 
 /*
  * min_free_kbytes_sysctl_handler - just a wrapper around proc_dointvec() so
-- 
2.6.1

--
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 related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] mm: update min_free_kbytes from khugepaged after core initialization
  2016-04-12 19:54   ` Jason Baron
@ 2016-04-13 10:36     ` Kirill A. Shutemov
  -1 siblings, 0 replies; 8+ messages in thread
From: Kirill A. Shutemov @ 2016-04-13 10:36 UTC (permalink / raw)
  To: Jason Baron
  Cc: akpm, kirill.shutemov, rientjes, aarcange, mgorman, mhocko,
	hannes, vbabka, linux-mm, linux-kernel

On Tue, Apr 12, 2016 at 03:54:37PM -0400, Jason Baron wrote:
> Khugepaged attempts to raise min_free_kbytes if its set too low. However,
> on boot khugepaged sets min_free_kbytes first from subsys_initcall(), and
> then the mm 'core' over-rides min_free_kbytes after from
> init_per_zone_wmark_min(), via a module_init() call.
> 
> Khugepaged used to use a late_initcall() to set min_free_kbytes (such that
> it occurred after the core initialization), however this was removed when
> the initialization of min_free_kbytes was integrated into the starting of
> the khugepaged thread.
> 
> The fix here is simply to invoke the core initialization using a
> core_initcall() instead of module_init(), such that the previous
> initialization ordering is restored. I didn't restore the late_initcall()
> since start_stop_khugepaged() already sets min_free_kbytes via
> set_recommended_min_free_kbytes().
> 
> This was noticed when we had a number of page allocation failures when
> moving a workload to a kernel with this new initialization ordering. On an
> 8GB system this restores min_free_kbytes back to 67584 from 11365 when
> CONFIG_TRANSPARENT_HUGEPAGE=y is set and either
> CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y or
> CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y.
> 
> Fixes: 79553da293d3 ("thp: cleanup khugepaged startup")
> Signed-off-by: Jason Baron <jbaron@akamai.com>

Looks good to me:

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

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

* Re: [PATCH 1/1] mm: update min_free_kbytes from khugepaged after core initialization
@ 2016-04-13 10:36     ` Kirill A. Shutemov
  0 siblings, 0 replies; 8+ messages in thread
From: Kirill A. Shutemov @ 2016-04-13 10:36 UTC (permalink / raw)
  To: Jason Baron
  Cc: akpm, kirill.shutemov, rientjes, aarcange, mgorman, mhocko,
	hannes, vbabka, linux-mm, linux-kernel

On Tue, Apr 12, 2016 at 03:54:37PM -0400, Jason Baron wrote:
> Khugepaged attempts to raise min_free_kbytes if its set too low. However,
> on boot khugepaged sets min_free_kbytes first from subsys_initcall(), and
> then the mm 'core' over-rides min_free_kbytes after from
> init_per_zone_wmark_min(), via a module_init() call.
> 
> Khugepaged used to use a late_initcall() to set min_free_kbytes (such that
> it occurred after the core initialization), however this was removed when
> the initialization of min_free_kbytes was integrated into the starting of
> the khugepaged thread.
> 
> The fix here is simply to invoke the core initialization using a
> core_initcall() instead of module_init(), such that the previous
> initialization ordering is restored. I didn't restore the late_initcall()
> since start_stop_khugepaged() already sets min_free_kbytes via
> set_recommended_min_free_kbytes().
> 
> This was noticed when we had a number of page allocation failures when
> moving a workload to a kernel with this new initialization ordering. On an
> 8GB system this restores min_free_kbytes back to 67584 from 11365 when
> CONFIG_TRANSPARENT_HUGEPAGE=y is set and either
> CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y or
> CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y.
> 
> Fixes: 79553da293d3 ("thp: cleanup khugepaged startup")
> Signed-off-by: Jason Baron <jbaron@akamai.com>

Looks good to me:

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

-- 
 Kirill A. Shutemov

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

* Re: [PATCH 1/1] mm: update min_free_kbytes from khugepaged after core initialization
  2016-04-12 19:54   ` Jason Baron
@ 2016-04-14 20:08     ` David Rientjes
  -1 siblings, 0 replies; 8+ messages in thread
From: David Rientjes @ 2016-04-14 20:08 UTC (permalink / raw)
  To: Jason Baron
  Cc: akpm, kirill.shutemov, aarcange, mgorman, mhocko, hannes, vbabka,
	linux-mm, linux-kernel

On Tue, 12 Apr 2016, Jason Baron wrote:

> Khugepaged attempts to raise min_free_kbytes if its set too low. However,
> on boot khugepaged sets min_free_kbytes first from subsys_initcall(), and
> then the mm 'core' over-rides min_free_kbytes after from
> init_per_zone_wmark_min(), via a module_init() call.
> 
> Khugepaged used to use a late_initcall() to set min_free_kbytes (such that
> it occurred after the core initialization), however this was removed when
> the initialization of min_free_kbytes was integrated into the starting of
> the khugepaged thread.
> 
> The fix here is simply to invoke the core initialization using a
> core_initcall() instead of module_init(), such that the previous
> initialization ordering is restored. I didn't restore the late_initcall()
> since start_stop_khugepaged() already sets min_free_kbytes via
> set_recommended_min_free_kbytes().
> 
> This was noticed when we had a number of page allocation failures when
> moving a workload to a kernel with this new initialization ordering. On an
> 8GB system this restores min_free_kbytes back to 67584 from 11365 when
> CONFIG_TRANSPARENT_HUGEPAGE=y is set and either
> CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y or
> CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y.
> 
> Fixes: 79553da293d3 ("thp: cleanup khugepaged startup")
> Signed-off-by: Jason Baron <jbaron@akamai.com>

Acked-by: David Rientjes <rientjes@google.com>

I assume it could also be fixed by not setting min_free_kbytes lower in 
init_per_zone_wmark_min(), but if the ordering is correct this is less 
code.

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

* Re: [PATCH 1/1] mm: update min_free_kbytes from khugepaged after core initialization
@ 2016-04-14 20:08     ` David Rientjes
  0 siblings, 0 replies; 8+ messages in thread
From: David Rientjes @ 2016-04-14 20:08 UTC (permalink / raw)
  To: Jason Baron
  Cc: akpm, kirill.shutemov, aarcange, mgorman, mhocko, hannes, vbabka,
	linux-mm, linux-kernel

On Tue, 12 Apr 2016, Jason Baron wrote:

> Khugepaged attempts to raise min_free_kbytes if its set too low. However,
> on boot khugepaged sets min_free_kbytes first from subsys_initcall(), and
> then the mm 'core' over-rides min_free_kbytes after from
> init_per_zone_wmark_min(), via a module_init() call.
> 
> Khugepaged used to use a late_initcall() to set min_free_kbytes (such that
> it occurred after the core initialization), however this was removed when
> the initialization of min_free_kbytes was integrated into the starting of
> the khugepaged thread.
> 
> The fix here is simply to invoke the core initialization using a
> core_initcall() instead of module_init(), such that the previous
> initialization ordering is restored. I didn't restore the late_initcall()
> since start_stop_khugepaged() already sets min_free_kbytes via
> set_recommended_min_free_kbytes().
> 
> This was noticed when we had a number of page allocation failures when
> moving a workload to a kernel with this new initialization ordering. On an
> 8GB system this restores min_free_kbytes back to 67584 from 11365 when
> CONFIG_TRANSPARENT_HUGEPAGE=y is set and either
> CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS=y or
> CONFIG_TRANSPARENT_HUGEPAGE_MADVISE=y.
> 
> Fixes: 79553da293d3 ("thp: cleanup khugepaged startup")
> Signed-off-by: Jason Baron <jbaron@akamai.com>

Acked-by: David Rientjes <rientjes@google.com>

I assume it could also be fixed by not setting min_free_kbytes lower in 
init_per_zone_wmark_min(), but if the ordering is correct this is less 
code.

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

end of thread, other threads:[~2016-04-14 20:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12 19:54 [PATCH 0/1] mm: setting of min_free_kbytes Jason Baron
2016-04-12 19:54 ` Jason Baron
2016-04-12 19:54 ` [PATCH 1/1] mm: update min_free_kbytes from khugepaged after core initialization Jason Baron
2016-04-12 19:54   ` Jason Baron
2016-04-13 10:36   ` Kirill A. Shutemov
2016-04-13 10:36     ` Kirill A. Shutemov
2016-04-14 20:08   ` David Rientjes
2016-04-14 20:08     ` David Rientjes

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.