linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] mm, hugetlb: drop hugepages_treat_as_movable sysctl
@ 2017-10-03  7:26 Michal Hocko
  2017-10-03  7:53 ` Mel Gorman
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Hocko @ 2017-10-03  7:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Alexandru Moise, Mike Kravetz, linux-mm, LKML,
	linux-api, Michal Hocko

From: Michal Hocko <mhocko@suse.com>

hugepages_treat_as_movable has been introduced by 396faf0303d2 ("Allow
huge page allocations to use GFP_HIGH_MOVABLE") to allow hugetlb
allocations from ZONE_MOVABLE even when hugetlb pages were not
migrateable. The purpose of the movable zone was different at the time.
It aimed at reducing memory fragmentation and hugetlb pages being long
lived and large werre not contributing to the fragmentation so it was
acceptable to use the zone back then.

Things have changed though and the primary purpose of the zone became
migratability guarantee. If we allow non migrateable hugetlb pages to
be in ZONE_MOVABLE memory hotplug might fail to offline the memory.

Remove the knob and only rely on hugepage_migration_supported to allow
movable zones.

Signed-off-by: Michal Hocko <mhocko@suse.com>
---

Hi,
Alexandru Moise has noticed that hugepages_treat_as_movable has a weird
semantic [1] and tried to fix it. I think that the sysctl is a relict
which should go away finaly because assumptions which it was based on
no longer hold.

What do you think?

[1] http://lkml.kernel.org/r/20171001225111.GA16432@gmail.com

 Documentation/sysctl/vm.txt | 25 -------------------------
 include/linux/hugetlb.h     |  1 -
 kernel/sysctl.c             |  7 -------
 mm/hugetlb.c                |  4 +---
 4 files changed, 1 insertion(+), 36 deletions(-)

diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index 0752430d4562..44a6c7f226f5 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -30,7 +30,6 @@ files can be found in mm/swap.c.
 - dirty_writeback_centisecs
 - drop_caches
 - extfrag_threshold
-- hugepages_treat_as_movable
 - hugetlb_shm_group
 - laptop_mode
 - legacy_va_layout
@@ -268,30 +267,6 @@ any throttling.
 
 ==============================================================
 
-hugepages_treat_as_movable
-
-This parameter controls whether we can allocate hugepages from ZONE_MOVABLE
-or not. If set to non-zero, hugepages can be allocated from ZONE_MOVABLE.
-ZONE_MOVABLE is created when kernel boot parameter kernelcore= is specified,
-so this parameter has no effect if used without kernelcore=.
-
-Hugepage migration is now available in some situations which depend on the
-architecture and/or the hugepage size. If a hugepage supports migration,
-allocation from ZONE_MOVABLE is always enabled for the hugepage regardless
-of the value of this parameter.
-IOW, this parameter affects only non-migratable hugepages.
-
-Assuming that hugepages are not migratable in your system, one usecase of
-this parameter is that users can make hugepage pool more extensible by
-enabling the allocation from ZONE_MOVABLE. This is because on ZONE_MOVABLE
-page reclaim/migration/compaction work more and you can get contiguous
-memory more likely. Note that using ZONE_MOVABLE for non-migratable
-hugepages can do harm to other features like memory hotremove (because
-memory hotremove expects that memory blocks on ZONE_MOVABLE are always
-removable,) so it's a trade-off responsible for the users.
-
-==============================================================
-
 hugetlb_shm_group
 
 hugetlb_shm_group contains group id that is allowed to create SysV
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index 19a3ed54a1b7..c78654421e7d 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -128,7 +128,6 @@ u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm,
 
 pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud);
 
-extern int hugepages_treat_as_movable;
 extern int sysctl_hugetlb_shm_group;
 extern struct list_head huge_boot_pages;
 
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c848c3652472..50c813ef1747 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1389,13 +1389,6 @@ static struct ctl_table vm_table[] = {
 		.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	 },
-	 {
-		.procname	= "hugepages_treat_as_movable",
-		.data		= &hugepages_treat_as_movable,
-		.maxlen		= sizeof(int),
-		.mode		= 0644,
-		.proc_handler	= proc_dointvec,
-	},
 	{
 		.procname	= "nr_overcommit_hugepages",
 		.data		= NULL,
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 34625b257128..ab7f665b83e6 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -36,8 +36,6 @@
 #include <linux/userfaultfd_k.h>
 #include "internal.h"
 
-int hugepages_treat_as_movable;
-
 int hugetlb_max_hstate __read_mostly;
 unsigned int default_hstate_idx;
 struct hstate hstates[HUGE_MAX_HSTATE];
@@ -926,7 +924,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
 /* Movability of hugepages depends on migration support. */
 static inline gfp_t htlb_alloc_mask(struct hstate *h)
 {
-	if (hugepages_treat_as_movable || hugepage_migration_supported(h))
+	if (hugepage_migration_supported(h))
 		return GFP_HIGHUSER_MOVABLE;
 	else
 		return GFP_HIGHUSER;
-- 
2.14.2

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

* Re: [RFC PATCH] mm, hugetlb: drop hugepages_treat_as_movable sysctl
  2017-10-03  7:26 [RFC PATCH] mm, hugetlb: drop hugepages_treat_as_movable sysctl Michal Hocko
@ 2017-10-03  7:53 ` Mel Gorman
  0 siblings, 0 replies; 2+ messages in thread
From: Mel Gorman @ 2017-10-03  7:53 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Alexandru Moise, Mike Kravetz, linux-mm, LKML,
	linux-api, Michal Hocko

On Tue, Oct 03, 2017 at 09:26:19AM +0200, Michal Hocko wrote:
> From: Michal Hocko <mhocko@suse.com>
> 
> hugepages_treat_as_movable has been introduced by 396faf0303d2 ("Allow
> huge page allocations to use GFP_HIGH_MOVABLE") to allow hugetlb
> allocations from ZONE_MOVABLE even when hugetlb pages were not
> migrateable. The purpose of the movable zone was different at the time.
> It aimed at reducing memory fragmentation and hugetlb pages being long
> lived and large werre not contributing to the fragmentation so it was
> acceptable to use the zone back then.
> 

Well, primarily it was aimed at allowing the hugetlb pool to safely shrink
with the ability to grow it again. The use case was for batched jobs,
some of which needed huge pages and others that did not but didn't want
the memory useless pinned in the huge pages pool.

> Things have changed though and the primary purpose of the zone became
> migratability guarantee. If we allow non migrateable hugetlb pages to
> be in ZONE_MOVABLE memory hotplug might fail to offline the memory.
> 
> Remove the knob and only rely on hugepage_migration_supported to allow
> movable zones.
> 
> Signed-off-by: Michal Hocko <mhocko@suse.com>

I suspect that more users rely on THP than hugetlbfs for flexible use
of huge pages with fallback options so I think that removing the option
should be ok.

Acked-by: Mel Gorman <mgorman@suse.de>

-- 
Mel Gorman
SUSE Labs

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

end of thread, other threads:[~2017-10-03  7:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03  7:26 [RFC PATCH] mm, hugetlb: drop hugepages_treat_as_movable sysctl Michal Hocko
2017-10-03  7:53 ` Mel Gorman

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