mm/hugetlb: gigantic hugetlb page pools shrink supporting
Subsystems (6)
cover mm/hugetlb: gigantic hugetlb page pools shrink supporting
order >= MAX_ORDER pages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-way street(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.
Testcase:
boot: hugepagesz=1G hugepages=10
[root@localhost hugepages]# free -m
total used free shared buffers cached
Mem: 36269 10836 25432 0 11 288 -/+ buffers/cache: 10537 25732 Swap: 35999 0 35999
[root@localhost hugepages]# echo 0 > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages -bash: echo: write error: Invalid argument
[root@localhost hugepages]# echo 1 > /proc/sys/vm/hugetlb_shrink_gigantic_pool [root@localhost hugepages]# echo 0 > /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages [root@localhost hugepages]# free -m
total used free shared buffers cached
Mem: 36269 597 35672 0 11 288 -/+ buffers/cache: 297 35972 Swap: 35999 0 35999
Wanpeng Li (6):
introduce new sysctl knob which control gigantic page pools shrinking update_and_free_page gigantic pages awareness
enable gigantic hugetlb page pools shrinking
use already exist huge_page_order() instead of h->order remove redundant hugetlb_prefault
use already exist interface huge_page_shift
Documentation/sysctl/vm.txt | 13 +++++++ include/linux/hugetlb.h | 5 +-- kernel/sysctl.c | 7 ++++ mm/hugetlb.c | 83 +++++++++++++++++++++++++++++-------------- mm/internal.h | 1 + mm/page_alloc.c | 2 +- 6 files changed, 82 insertions(+), 29 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/6 mm/hugetlb: introduce new sysctl knob which control gigantic page pools shrinking
This patch introduces new sysctl knob to support gigantic hugetlb page pools shrinking. The default value is 0 since gigantic page pools aren't permitted shrinked by default, administrator can echo 1 to knob to enable gigantic page pools shrinking after they confirm they won't use them any more.
--- Documentation/sysctl/vm.txt | 13 +++++++++++++ include/linux/hugetlb.h | 3 +++ kernel/sysctl.c | 7 +++++++ mm/hugetlb.c | 9 +++++++++ 4 files changed, 32 insertions(+)
Documentation/sysctl/vm.txt +13 -0
@@ -30,6 +30,7 @@ Currently, these files are in /proc/sys/vm: - extfrag_threshold - hugepages_treat_as_movable - hugetlb_shm_group +- hugetlb_shrink_gigantic_pool - laptop_mode - legacy_va_layout - lowmem_reserve_ratio
@@ -211,6 +212,18 @@ shared memory segment using hugetlb page. ============================================================== +hugetlb_shrink_gigantic_pool + +order >= MAX_ORDER pages are only allocated at boot stage using the bootmem +allocator with the "hugepages=xxx" option. These pages are never free'd +by default since it would be a one-way street(>= MAX_ORDER pages cannot +be allocated later), but if administrator confirm not to use these gigantic +pages any more, these pinned pages will waste memory since other users +can't grab free pages from gigantic hugetlb pool even OOM. Administrator +can enable this parameter to permit to shrink gigantic hugetlb pool + +============================================================== + laptop_mode laptop_mode is a knob that controls "laptop mode". All the things that are
include/linux/hugetlb.h +3 -0
@@ -36,6 +36,8 @@ void reset_vma_resv_huge_pages(struct vm_area_struct *vma);int hugetlb_sysctl_handler (struct ctl_table *,int ,void __user *,size_t *,loff_t *);int hugetlb_overcommit_handler (struct ctl_table *,int ,void __user *,size_t *,loff_t *);int hugetlb_treat_movable_handler (struct ctl_table *,int ,void __user *,size_t *,loff_t *); +int hugetlb_shrink_gigantic_pool_handler (struct ctl_table *, +int ,void __user *,size_t *,loff_t *);#ifdef CONFIG_NUMA int hugetlb_mempolicy_sysctl_handler(struct ctl_table *, int,
@@ -73,6 +75,7 @@ extern unsigned long hugepages_treat_as_movable;extern const unsigned long hugetlb_zero, hugetlb_infinity;extern int sysctl_hugetlb_shm_group;extern struct list_head huge_boot_pages; +extern int hugetlb_shrink_gigantic_pool;/* arch callbacks */
kernel/sysctl.c +7 -0
@@ -1187,6 +1187,13 @@ static struct ctl_table vm_table[] = { .extra1 = (void *)&hugetlb_zero, .extra2 = (void *)&hugetlb_infinity, }, + { + .procname = "hugetlb_shrink_gigantic_pool", + .data = &hugetlb_shrink_gigantic_pool, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = hugetlb_shrink_gigantic_pool_handler, + }, #ifdef CONFIG_NUMA { .procname = "nr_hugepages_mempolicy",
mm/hugetlb.c +9 -0
@@ -35,6 +35,7 @@const unsigned long hugetlb_zero =0 , hugetlb_infinity = ~0UL ;static gfp_t htlb_alloc_mask =GFP_HIGHUSER ;unsigned long hugepages_treat_as_movable; +int hugetlb_shrink_gigantic_pool;int hugetlb_max_hstate__read_mostly ;unsigned int default_hstate_idx;
@@ -671,6 +672,14 @@ static void prep_compound_gigantic_page(struct page *page, unsigned long order) } } +int hugetlb_shrink_gigantic_pool_handler (struct ctl_table *table,int write, +void __user *buffer, +size_t *length,loff_t *ppos) +{ +proc_dointvec (table, write, buffer, length, ppos); +return 0 ; +} +/* * PageHuge() only returns true for hugetlbfs pages, but not for normal or * transparent huge pages. See the PageTransHuge() documentation for more
Signature · 7 lines
1.7.10.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/6 mm/hugetlb: update_and_free_page gigantic pages awareness
In reply to Wanpeng Liorder >= MAX_ORDER pages can't be freed to buddy system directly, this patch destroy the gigantic hugetlb page to normal order-0 pages and free them one by one.
--- mm/hugetlb.c | 39 +++++++++++++++++++++++++++++---------- mm/internal.h | 1 + mm/page_alloc.c | 2 +- 3 files changed, 31 insertions(+), 11 deletions(-)
mm/hugetlb.c +29 -10
@@ -579,25 +579,44 @@ err:return NULL ; } +static inline clear_page_flag(struct page *page) +{ + page->flags &= ~(1 << PG_locked |1 << PG_error | +1 << PG_referenced |1 << PG_dirty | +1 << PG_active |1 << PG_reserved | +1 << PG_private |1 << PG_writeback); +} +static void update_and_free_page (struct hstate *h,struct page *page) {int i; +struct page *p; +int order =huge_page_order (h); -VM_BUG_ON (h->order >=MAX_ORDER ); +VM_BUG_ON (!hugetlb_shrink_gigantic_pool && h->order >=MAX_ORDER ); h->nr_huge_pages--; h->nr_huge_pages_node[page_to_nid (page)]--; -for (i =0 ; i <pages_per_huge_page (h); i++) { - page[i].flags &= ~(1 << PG_locked |1 << PG_error | -1 << PG_referenced |1 << PG_dirty | -1 << PG_active |1 << PG_reserved | -1 << PG_private |1 << PG_writeback); - } -VM_BUG_ON (hugetlb_cgroup_from_page (page));set_compound_page_dtor (page,NULL ); -set_page_refcounted (page);arch_release_hugepage (page); -__free_pages (page,huge_page_order (h)); +VM_BUG_ON (hugetlb_cgroup_from_page (page)); + +if (order <MAX_ORDER ) { +for (i =0 ; i <pages_per_huge_page (h); i++) +clear_page_flag (page+i); +set_page_refcounted (page); +__free_pages (page,huge_page_order (h)); + }else { +int nr_pages =1 << order; +destroy_compound_page (page, order); +set_compound_order (page,0 ); +for (i =0 , p = page; i < nr_pages; i++, + p =mem_map_next (p, page, i)) { +clear_page_flag (p); +set_page_refcounted (p); +__free_pages (p,0 ); + } + } }struct hstate *size_to_hstate (unsigned long size)
mm/internal.h +1 -0
@@ -101,6 +101,7 @@ extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address);*/ extern void __free_pages_bootmem (struct page *page,unsigned int order);extern void prep_compound_page (struct page *page,unsigned long order); +extern int destroy_compound_page (struct page *page,unsigned long order);#ifdef CONFIG_MEMORY_FAILURE extern bool is_free_buddy_page (struct page *page);#endif
mm/page_alloc.c +1 -1
@@ -367,7 +367,7 @@ void prep_compound_page(struct page *page, unsigned long order) }/* update __split_huge_page_refcount if you change this function */ -static int destroy_compound_page (struct page *page,unsigned long order) +int destroy_compound_page (struct page *page,unsigned long order) {int i;int nr_pages =1 << order;
Signature · 7 lines
1.7.10.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/6 mm/hugetlb: enable gigantic hugetlb page pools shrinking
In reply to Wanpeng LiEnable gigantic hugetlb page pools shrinking.
--- mm/hugetlb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
mm/hugetlb.c +4 -3
@@ -1416,7 +1416,8 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count, {unsigned long min_count, ret; -if (h->order >=MAX_ORDER ) +if (h->order >=MAX_ORDER && (!hugetlb_shrink_gigantic_pool || + count >persistent_huge_pages (h)))return h->max_huge_pages;/*
@@ -1542,7 +1543,7 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy, goto out; h =kobj_to_hstate (kobj, &nid); -if (h->order >=MAX_ORDER ) { +if (h->order >=MAX_ORDER && !hugetlb_shrink_gigantic_pool) { err = -EINVAL ; goto out; }
@@ -2036,7 +2037,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy, tmp = h->max_huge_pages; -if (write && h->order >=MAX_ORDER ) +if (write && h->order >=MAX_ORDER && !hugetlb_shrink_gigantic_pool)return -EINVAL ; table->data = &tmp;
Signature · 7 lines
1.7.10.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/6 mm/hugetlb: use already exist huge_page_order() instead of h->order
In reply to Wanpeng LiUse already exist interface huge_page_order() instead of h->order to get huge page order.
--- mm/hugetlb.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-)
mm/hugetlb.c +19 -17
@@ -593,7 +593,8 @@ static void update_and_free_page(struct hstate *h, struct page *page)struct page *p;int order =huge_page_order (h); -VM_BUG_ON (!hugetlb_shrink_gigantic_pool && h->order >=MAX_ORDER ); +VM_BUG_ON (!hugetlb_shrink_gigantic_pool && +huge_page_order (h) >=MAX_ORDER ); h->nr_huge_pages--; h->nr_huge_pages_node[page_to_nid (page)]--;
@@ -722,7 +723,7 @@ static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid) {struct page *page; -if (h->order >=MAX_ORDER ) +if (huge_page_order (h) >=MAX_ORDER )return NULL ; page = alloc_pages_exact_node(nid,
@@ -876,7 +877,7 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, int nid)struct page *page;unsigned int r_nid; -if (h->order >=MAX_ORDER ) +if (huge_page_order (h) >=MAX_ORDER )return NULL ;/*
@@ -1071,7 +1072,7 @@ static void return_unused_surplus_pages(struct hstate *h, h->resv_huge_pages -= unused_resv_pages;/* Cannot return gigantic pages currently */ -if (h->order >=MAX_ORDER ) +if (huge_page_order (h) >=MAX_ORDER )return ; nr_pages =min (unused_resv_pages, h->surplus_huge_pages);
@@ -1265,7 +1266,7 @@ static void __init gather_bootmem_prealloc(void)#endif __ClearPageReserved (page);WARN_ON (page_count (page) !=1 ); -prep_compound_huge_page (page, h->order); +prep_compound_huge_page (page,huge_page_order (h));prep_new_huge_page (h, page,page_to_nid (page));/* * If we had gigantic hugepages allocated at boot time, we need
@@ -1273,8 +1274,8 @@ static void __init gather_bootmem_prealloc(void)* fix confusing memory reports from free(1) and another * side-effects, like CommitLimit going negative. */ -if (h->order > (MAX_ORDER -1 )) - totalram_pages +=1 << h->order; +if (huge_page_order (h) > (MAX_ORDER -1 )) + totalram_pages +=1 <<huge_page_order (h); } }
@@ -1283,7 +1284,7 @@ static void __init hugetlb_hstate_alloc_pages(struct hstate *h) unsigned long i; for (i = 0; i < h->max_huge_pages; ++i) { - if (h->order >= MAX_ORDER) { + if (huge_page_order(h) >= MAX_ORDER) { if (!alloc_bootmem_huge_page(h)) break; } else if (!alloc_fresh_huge_page(h,
@@ -1299,7 +1300,7 @@ static void __init hugetlb_init_hstates(void)for_each_hstate (h) {/* oversize hugepages were init'ed in early boot */ -if (h->order <MAX_ORDER ) +if (huge_page_order (h) <MAX_ORDER )hugetlb_hstate_alloc_pages (h); } }
@@ -1333,7 +1334,7 @@ static void try_to_free_low(struct hstate *h, unsigned long count, {int i; -if (h->order >=MAX_ORDER ) +if (huge_page_order (h) >=MAX_ORDER )return ;for_each_node_mask (i, *nodes_allowed) {
@@ -1416,8 +1417,8 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count, {unsigned long min_count, ret; -if (h->order >=MAX_ORDER && (!hugetlb_shrink_gigantic_pool || - count >persistent_huge_pages (h))) +if (huge_page_order (h) >=MAX_ORDER && (!hugetlb_shrink_gigantic_pool + || count >persistent_huge_pages (h)))return h->max_huge_pages;/*
@@ -1543,7 +1544,7 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy, goto out; h =kobj_to_hstate (kobj, &nid); -if (h->order >=MAX_ORDER && !hugetlb_shrink_gigantic_pool) { +if (huge_page_order (h) >=MAX_ORDER && !hugetlb_shrink_gigantic_pool) { err = -EINVAL ; goto out; }
@@ -1626,7 +1627,7 @@ static ssize_t nr_overcommit_hugepages_store(struct kobject *kobj,unsigned long input;struct hstate *h =kobj_to_hstate (kobj,NULL ); -if (h->order >=MAX_ORDER ) +if (huge_page_order (h) >=MAX_ORDER )return -EINVAL ; err =strict_strtoul (buf,10 , &input);
@@ -2037,7 +2038,8 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy, tmp = h->max_huge_pages; -if (write && h->order >=MAX_ORDER && !hugetlb_shrink_gigantic_pool) +if (write &&huge_page_order (h) >=MAX_ORDER && + !hugetlb_shrink_gigantic_pool)return -EINVAL ; table->data = &tmp;
@@ -2102,7 +2104,7 @@ int hugetlb_overcommit_handler(struct ctl_table *table, int write, tmp = h->nr_overcommit_huge_pages; -if (write && h->order >=MAX_ORDER ) +if (write &&huge_page_order (h) >=MAX_ORDER )return -EINVAL ; table->data = &tmp;
@@ -3093,7 +3095,7 @@ unsigned long hugetlb_change_protection(struct vm_area_struct *vma,flush_tlb_range (vma, start, end);mutex_unlock (&vma->vm_file->f_mapping->i_mmap_mutex); -return pages << h->order; +return pages <<huge_page_order (h); } int hugetlb_reserve_pages(struct inode *inode,
Signature · 7 lines
1.7.10.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 5/6 mm/hugetlb: remove redundant hugetlb_prefault
In reply to Wanpeng Lihugetlb_prefault is not used by any users. This patch remove redundant hugetlb_prefault.
--- include/linux/hugetlb.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/hugetlb.h +0 -2
@@ -57,7 +57,6 @@ void __unmap_hugepage_range_final(struct mmu_gather *tlb,void __unmap_hugepage_range (struct mmu_gather *tlb,struct vm_area_struct *vma,unsigned long start,unsigned long end,struct page *ref_page); -int hugetlb_prefault (struct address_space *,struct vm_area_struct *);void hugetlb_report_meminfo (struct seq_file *);int hugetlb_report_node_meminfo (int ,char *);void hugetlb_show_meminfo (void );
@@ -113,7 +112,6 @@ static inline unsigned long hugetlb_total_pages(void)#define follow_hugetlb_page (m,v,p,vs,a,b,i,w) ({ BUG(); 0; })#define follow_huge_addr (mm, addr, write) ERR_PTR(-EINVAL)#define copy_hugetlb_page_range (src, dst, vma) ({ BUG(); 0; }) -#define hugetlb_prefault (mapping, vma) ({ BUG(); 0; })static inline void hugetlb_report_meminfo (struct seq_file *m) { }
Signature · 7 lines
1.7.10.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 6/6 mm/hugetlb: use already exist interface huge_page_shift
In reply to Wanpeng LiUse already exist interface huge_page_shift instead of h->order + PAGE_SHIFT.
--- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hugetlb.c +1 -1
@@ -320,7 +320,7 @@ unsigned long vma_kernel_pagesize(struct vm_area_struct *vma) hstate =hstate_vma (vma); -return 1UL << (hstate->order +PAGE_SHIFT ); +return 1UL <<huge_page_shift (hstate); }EXPORT_SYMBOL_GPL (vma_kernel_pagesize);
Signature · 7 lines
1.7.10.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.
I am not sure I see why the new knob is needed. /sys/kernel/mm/hugepages/hugepages-*/nr_hugepages is root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.
Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
I could imagine nr_hugepages_mempolicy would make more sense to free pages from particular nodes so they could be offlined for example. Does the patchset handles this as well?
Quoted 42 lines
Testcase:
boot: hugepagesz=1G hugepages=10[root@localhost hugepages]# free -m
total used free shared buffers cachedMem: 36269 10836 25432 0 11 288 -/+ buffers/cache: 10537 25732 Swap: 35999 0 35999[root@localhost hugepages]# echo 0 >
/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages-bash: echo: write error: Invalid argument
[root@localhost hugepages]# echo 1 >/proc/sys/vm/hugetlb_shrink_gigantic_pool[root@localhost hugepages]# echo 0 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages[root@localhost hugepages]# free -m
total used free shared buffers cachedMem: 36269 597 35672 0 11 288 -/+ buffers/cache: 297 35972 Swap: 35999 0 35999Wanpeng Li (6):
introduce new sysctl knob which control gigantic page pools shrinkingupdate_and_free_pagegigantic pages awareness
enable gigantic hugetlb page pools shrinking
use already existhuge_page_order()instead ofh->orderremove redundanthugetlb_prefault
use already exist interfacehuge_page_shiftDocumentation/sysctl/vm.txt | 13 +++++++ include/linux/hugetlb.h | 5 +-- kernel/sysctl.c | 7 ++++ mm/hugetlb.c | 83 +++++++++++++++++++++++++++++-------------- mm/internal.h | 1 + mm/page_alloc.c | 2 +- 6 files changed, 82 insertions(+), 29 deletions(-)Signature · 7 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 16 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.
Quoted 7 lines
Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
I could imagine
nr_hugepages_mempolicywould make more sense to free pages from particular nodes so they could be offlined for example. Does the patchset handles this as well?
Ohh, I should have checked before asking. Both knobs use the same hugetlb_sysctl_handler_common and unless there is something hardcoded in the patches then it should be supproted.
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 21 lines · Michal Hocko
Quoted 20 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Quoted 7 lines
Quoted 3 lines
I could imagine
nr_hugepages_mempolicywould make more sense to free pages from particular nodes so they could be offlined for example. Does the patchset handles this as well?Ohh, I should have checked before asking. Both knobs use the same
hugetlb_sysctl_handler_commonand unless there is something hardcoded in the patches then it should be supproted.
I'm very happy if you can review this patchset in details, any comments are welcome. ;-)
Regards,
Wanpeng Li
Quoted 10 lines
Signature · 9 lines
-- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 21 lines · Michal Hocko
Quoted 20 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Quoted 7 lines
Quoted 3 lines
I could imagine
nr_hugepages_mempolicywould make more sense to free pages from particular nodes so they could be offlined for example. Does the patchset handles this as well?Ohh, I should have checked before asking. Both knobs use the same
hugetlb_sysctl_handler_commonand unless there is something hardcoded in the patches then it should be supproted.
I'm very happy if you can review this patchset in details, any comments are welcome. ;-)
Regards,
Wanpeng Li
Quoted 10 lines
Signature · 9 lines
-- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.
Quoted 8 lines
I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Gigantic huge pages in hugetlb means h->order >= MAX_ORDER instead of GB pages. ;-)
Regards,
Wanpeng Li
Quoted 39 lines
I could imagine
nr_hugepages_mempolicywould make more sense to free pages from particular nodes so they could be offlined for example. Does the patchset handles this as well?Quoted 34 lines
Testcase:
boot: hugepagesz=1G hugepages=10[root@localhost hugepages]# free -m
total used free shared buffers cachedMem: 36269 10836 25432 0 11 288 -/+ buffers/cache: 10537 25732 Swap: 35999 0 35999[root@localhost hugepages]# echo 0 >
/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages-bash: echo: write error: Invalid argument
[root@localhost hugepages]# echo 1 >/proc/sys/vm/hugetlb_shrink_gigantic_pool[root@localhost hugepages]# echo 0 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages[root@localhost hugepages]# free -m
total used free shared buffers cachedMem: 36269 597 35672 0 11 288 -/+ buffers/cache: 297 35972 Swap: 35999 0 35999Wanpeng Li (6):
introduce new sysctl knob which control gigantic page pools shrinkingupdate_and_free_pagegigantic pages awareness
enable gigantic hugetlb page pools shrinking
use already existhuge_page_order()instead ofh->orderremove redundanthugetlb_prefault
use already exist interfacehuge_page_shiftDocumentation/sysctl/vm.txt | 13 +++++++ include/linux/hugetlb.h | 5 +-- kernel/sysctl.c | 7 ++++ mm/hugetlb.c | 83 +++++++++++++++++++++++++++++-------------- mm/internal.h | 1 + mm/page_alloc.c | 2 +- 6 files changed, 82 insertions(+), 29 deletions(-)
Quoted 12 lines
Quoted 8 lines
Signature · 7 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/Signature · 2 lines
Michal Hocko SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 17 lines · Wanpeng Li
Quoted 16 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.
Quoted 6 lines
Quoted 3 lines
Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Gigantic huge pages in hugetlb means
h->order>=MAX_ORDERinstead of GB pages. ;-)
Yes, I am aware of that but the question remains the same (and unanswered). What is the use case?
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 22 lines · Michal Hocko
Quoted 21 lines · Wanpeng Li
Quoted 19 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Quoted 5 lines
Quoted 2 lines
Gigantic huge pages in hugetlb means
h->order>=MAX_ORDERinstead of GB pages. ;-)Yes, I am aware of that but the question remains the same (and unanswered). What is the use case?
The use case I can figure out is when memory pressure is serious and gigantic huge pages pools still pin large number of free pages.
Regards,
Wanpeng Li
Quoted 4 lines
Signature · 3 lines
-- Michal Hocko SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 23 lines · Wanpeng Li
Quoted 22 lines · Michal Hocko
Quoted 21 lines · Wanpeng Li
Quoted 19 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Gigantic huge pages in hugetlb means
h->order>=MAX_ORDERinstead of GB pages. ;-)Yes, I am aware of that but the question remains the same (and unanswered). What is the use case?
The use case I can figure out is when memory pressure is serious and gigantic huge pages pools still pin large number of free pages.
Then this is a configuration issue. I understand that reboot is lame way to fix it but the gigantic pages usage is so specific that I would be really surprise if this kind of problem would pop out. I would also find surprising if those pages were unused.
So the only use case I can figure out ATM is a hotplug scenario (after hugetlb migration patchset is ready) but even then I would find it more useful for in kernel usage (read hotplug).
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 22 lines · Michal Hocko
Quoted 21 lines · Wanpeng Li
Quoted 19 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Quoted 5 lines
Quoted 2 lines
Gigantic huge pages in hugetlb means
h->order>=MAX_ORDERinstead of GB pages. ;-)Yes, I am aware of that but the question remains the same (and unanswered). What is the use case?
The use case I can figure out is when memory pressure is serious and gigantic huge pages pools still pin large number of free pages.
Regards,
Wanpeng Li
Quoted 4 lines
Signature · 3 lines
-- Michal Hocko SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi Michal,
Quoted 17 lines · Michal Hocko
Quoted 16 lines · Wanpeng Li
Quoted 15 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Gigantic huge pages in hugetlb means
h->order>=MAX_ORDERinstead of GB pages. ;-)Yes, I am aware of that but the question remains the same (and unanswered). What is the use case?
As patch description, "if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM".
Quoted 1 line
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 24 lines · Simon Jeons
Hi Michal,
Quoted 22 lines · Michal Hocko
Quoted 21 lines · Wanpeng Li
Quoted 10 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.Quoted 8 lines
I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Gigantic huge pages in hugetlb means
h->order>=MAX_ORDERinstead of GB pages. ;-)
Quoted 7 lines
Quoted 2 lines
Yes, I am aware of that but the question remains the same (and unanswered). What is the use case?
As patch description, "if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM".
Is this a use case that we care about? How often something like that happens? I understand this is "nice to have" but I am interested whether somebody actually _needs_ this.
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Michal Hocko
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.
Quoted 8 lines
I am not sure I see why the new knob is needed.
/sys/kernel/mm/hugepages/hugepages-*/nr_hugepagesis root interface so an additional step to allow writing to the file doesn't make much sense to me to be honest.Support for shrinking gigantic huge pages makes some sense to me but I would be interested in the real world example. GB pages are usually used in very specific environments where the amount is usually well known.
Gigantic huge pages in hugetlb means h->order >= MAX_ORDER instead of GB pages. ;-)
Regards,
Wanpeng Li
Quoted 39 lines
I could imagine
nr_hugepages_mempolicywould make more sense to free pages from particular nodes so they could be offlined for example. Does the patchset handles this as well?Quoted 34 lines
Testcase:
boot: hugepagesz=1G hugepages=10[root@localhost hugepages]# free -m
total used free shared buffers cachedMem: 36269 10836 25432 0 11 288 -/+ buffers/cache: 10537 25732 Swap: 35999 0 35999[root@localhost hugepages]# echo 0 >
/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages-bash: echo: write error: Invalid argument
[root@localhost hugepages]# echo 1 >/proc/sys/vm/hugetlb_shrink_gigantic_pool[root@localhost hugepages]# echo 0 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages[root@localhost hugepages]# free -m
total used free shared buffers cachedMem: 36269 597 35672 0 11 288 -/+ buffers/cache: 297 35972 Swap: 35999 0 35999Wanpeng Li (6):
introduce new sysctl knob which control gigantic page pools shrinkingupdate_and_free_pagegigantic pages awareness
enable gigantic hugetlb page pools shrinking
use already existhuge_page_order()instead ofh->orderremove redundanthugetlb_prefault
use already exist interfacehuge_page_shiftDocumentation/sysctl/vm.txt | 13 +++++++ include/linux/hugetlb.h | 5 +-- kernel/sysctl.c | 7 ++++ mm/hugetlb.c | 83 +++++++++++++++++++++++++++++-------------- mm/internal.h | 1 + mm/page_alloc.c | 2 +- 6 files changed, 82 insertions(+), 29 deletions(-)
Quoted 12 lines
Quoted 8 lines
Signature · 7 lines
1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/Signature · 2 lines
Michal Hocko SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Cc Andi,
Quoted 36 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.Testcase:
boot: hugepagesz=1G hugepages=10[root@localhost hugepages]# free -m
total used free shared buffers cached Mem: 36269 10836 25432 0 11 288 -/+ buffers/cache: 10537 25732 Swap: 35999 0 35999[root@localhost hugepages]# echo 0 >
/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages-bash: echo: write error: Invalid argument
[root@localhost hugepages]# echo 1 >/proc/sys/vm/hugetlb_shrink_gigantic_pool[root@localhost hugepages]# echo 0 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages[root@localhost hugepages]# free -mtotal used free shared buffers cached Mem: 36269 597 35672 0 11 288 -/+ buffers/cache: 297 35972 Swap: 35999 0 35999Wanpeng Li (6):
introduce new sysctl knob which control gigantic page pools shrinkingupdate_and_free_pagegigantic pages awareness
enable gigantic hugetlb page pools shrinking
use already existhuge_page_order()instead ofh->orderremove redundanthugetlb_prefault
use already exist interfacehuge_page_shift
Quoted 10 lines
Documentation/sysctl/vm.txt | 13 +++++++ include/linux/hugetlb.h | 5 +-- kernel/sysctl.c | 7 ++++ mm/hugetlb.c | 83 +++++++++++++++++++++++++++++-------------- mm/internal.h | 1 + mm/page_alloc.c | 2 +- 6 files changed, 82 insertions(+), 29 deletions(-)Signature · 1 line
1.7.10.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Cc Andi,
Quoted 36 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.Testcase:
boot: hugepagesz=1G hugepages=10[root@localhost hugepages]# free -m
total used free shared buffers cached Mem: 36269 10836 25432 0 11 288 -/+ buffers/cache: 10537 25732 Swap: 35999 0 35999[root@localhost hugepages]# echo 0 >
/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages-bash: echo: write error: Invalid argument
[root@localhost hugepages]# echo 1 >/proc/sys/vm/hugetlb_shrink_gigantic_pool[root@localhost hugepages]# echo 0 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages[root@localhost hugepages]# free -mtotal used free shared buffers cached Mem: 36269 597 35672 0 11 288 -/+ buffers/cache: 297 35972 Swap: 35999 0 35999Wanpeng Li (6):
introduce new sysctl knob which control gigantic page pools shrinkingupdate_and_free_pagegigantic pages awareness
enable gigantic hugetlb page pools shrinking
use already existhuge_page_order()instead ofh->orderremove redundanthugetlb_prefault
use already exist interfacehuge_page_shift
Quoted 10 lines
Documentation/sysctl/vm.txt | 13 +++++++ include/linux/hugetlb.h | 5 +-- kernel/sysctl.c | 7 ++++ mm/hugetlb.c | 83 +++++++++++++++++++++++++++++-------------- mm/internal.h | 1 + mm/page_alloc.c | 2 +- 6 files changed, 82 insertions(+), 29 deletions(-)Signature · 1 line
1.7.10.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Ping Andi,
Quoted 36 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.Testcase:
boot: hugepagesz=1G hugepages=10[root@localhost hugepages]# free -m
total used free shared buffers cached Mem: 36269 10836 25432 0 11 288 -/+ buffers/cache: 10537 25732 Swap: 35999 0 35999[root@localhost hugepages]# echo 0 >
/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages-bash: echo: write error: Invalid argument
[root@localhost hugepages]# echo 1 >/proc/sys/vm/hugetlb_shrink_gigantic_pool[root@localhost hugepages]# echo 0 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages[root@localhost hugepages]# free -mtotal used free shared buffers cached Mem: 36269 597 35672 0 11 288 -/+ buffers/cache: 297 35972 Swap: 35999 0 35999Wanpeng Li (6):
introduce new sysctl knob which control gigantic page pools shrinkingupdate_and_free_pagegigantic pages awareness
enable gigantic hugetlb page pools shrinking
use already existhuge_page_order()instead ofh->orderremove redundanthugetlb_prefault
use already exist interfacehuge_page_shift
Quoted 10 lines
Documentation/sysctl/vm.txt | 13 +++++++ include/linux/hugetlb.h | 5 +-- kernel/sysctl.c | 7 ++++ mm/hugetlb.c | 83 +++++++++++++++++++++++++++++-------------- mm/internal.h | 1 + mm/page_alloc.c | 2 +- 6 files changed, 82 insertions(+), 29 deletions(-)Signature · 1 line
1.7.10.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Wanpeng Li
Ping Andi,
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.
I originally didn't allow this because it's only one way and it seemed dubious. I've been recently working on a new patchkit to allocate GB pages from CMA. With that freeing actually makes sense, as the pages can be reallocated.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi Andi,
Quoted 14 lines · Andi Kleen
Quoted 11 lines · Wanpeng Li
Ping Andi,
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.
Quoted 4 lines
I originally didn't allow this because it's only one way and it seemed dubious. I've been recently working on a new patchkit to allocate GB pages from CMA. With that freeing actually makes sense, as the pages can be reallocated.
How is your allocate hugetlb pages from CMA going on? If you don't have time I will have a try. ;-)
Regards,
Wanpeng Li
Quoted 8 lines
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi Andi,
Quoted 14 lines · Andi Kleen
Quoted 11 lines · Wanpeng Li
Ping Andi,
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.
Quoted 4 lines
I originally didn't allow this because it's only one way and it seemed dubious. I've been recently working on a new patchkit to allocate GB pages from CMA. With that freeing actually makes sense, as the pages can be reallocated.
How is your allocate hugetlb pages from CMA going on? If you don't have time I will have a try. ;-)
Regards,
Wanpeng Li
Quoted 8 lines
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi Andi,
Quoted 14 lines · Andi Kleen
Quoted 11 lines · Wanpeng Li
Ping Andi,
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.
Quoted 5 lines
I originally didn't allow this because it's only one way and it seemed dubious. I've been recently working on a new patchkit to allocate GB pages from CMA. With that freeing actually makes sense, as the pages can be reallocated.
More than one year past, If your allocate GB pages from CMA merged?
Regards,
Wanpeng Li
Quoted 7 lines
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hello Wanpeng
Quoted 16 lines · Wanpeng Li
Hi Andi,
Quoted 14 lines · Andi Kleen
Quoted 11 lines · Wanpeng Li
Ping Andi,
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.
Quoted 7 lines
Quoted 5 lines
I originally didn't allow this because it's only one way and it seemed dubious. I've been recently working on a new patchkit to allocate GB pages from CMA. With that freeing actually makes sense, as the pages can be reallocated.
More than one year past, If your allocate GB pages from CMA merged?
commit 944d9fec8d7aee3f2e16573e9b6a16634b33f403
Author: Luiz Capitulino <[email protected]> Date: Wed Jun 4 16:07:13 2014 -0700
hugetlb: add support for gigantic page allocation at runtime
Quoted 18 lines
Regards,
Wanpeng LiQuoted 7 lines
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
.
Signature · 2 lines
Thanks. Zhang Yanfei
Quoted 25 lines · Zhang Yanfei
Hello Wanpeng
Quoted 22 lines · Wanpeng Li
Hi Andi,
Quoted 19 lines · Andi Kleen
Quoted 11 lines · Wanpeng Li
Ping Andi,
Quoted 9 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.I originally didn't allow this because it's only one way and it seemed dubious. I've been recently working on a new patchkit to allocate GB pages from CMA. With that freeing actually makes sense, as the pages can be reallocated.
Quoted 9 lines
Quoted 1 line
More than one year past, If your allocate GB pages from CMA merged?
commit
944d9fec8d7aee3f2e16573e9b6a16634b33f403Author: Luiz Capitulino <[email protected]> Date: Wed Jun 4 16:07:13 2014 -0700hugetlb: add support for gigantic page allocation at runtime
Ah, thanks for your pointing out.
Regards,
Wanpeng Li
Quoted 11 lines
Quoted 11 lines
Regards,
Wanpeng LiQuoted 7 lines
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 18 lines
Quoted 7 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
.Signature · 8 lines
Thanks. Zhang Yanfei -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines
Quoted 7 lines
commit
944d9fec8d7aee3f2e16573e9b6a16634b33f403Author: Luiz Capitulino <[email protected]> Date: Wed Jun 4 16:07:13 2014 -0700hugetlb: add support for gigantic page allocation at runtime
Ah, thanks for your pointing out.
I should add the CMA allocation would still make sense, as CMA would do compaction and better pre-allocation while this does not. Should probably revisit the issue. But it's at least partially solved now.
-Andi
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Ping Andi,
Quoted 36 lines · Wanpeng Li
order >=
MAX_ORDERpages are only allocated at boot stage using the bootmem allocator with the "hugepages=xxx" option. These pages are never free after boot by default since it would be a one-waystreet(>= MAX_ORDER pages cannot be allocated later), but if administrator confirm not to use these gigantic pages any more, these pinned pages will waste memory since other users can't grab free pages from gigantic hugetlb pool even if OOM, it's not flexible. The patchset add hugetlb gigantic page pools shrink supporting. Administrator can enable knob exported in sysctl to permit to shrink gigantic hugetlb pool.Testcase:
boot: hugepagesz=1G hugepages=10[root@localhost hugepages]# free -m
total used free shared buffers cached Mem: 36269 10836 25432 0 11 288 -/+ buffers/cache: 10537 25732 Swap: 35999 0 35999[root@localhost hugepages]# echo 0 >
/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages-bash: echo: write error: Invalid argument
[root@localhost hugepages]# echo 1 >/proc/sys/vm/hugetlb_shrink_gigantic_pool[root@localhost hugepages]# echo 0 >/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages[root@localhost hugepages]# free -mtotal used free shared buffers cached Mem: 36269 597 35672 0 11 288 -/+ buffers/cache: 297 35972 Swap: 35999 0 35999Wanpeng Li (6):
introduce new sysctl knob which control gigantic page pools shrinkingupdate_and_free_pagegigantic pages awareness
enable gigantic hugetlb page pools shrinking
use already existhuge_page_order()instead ofh->orderremove redundanthugetlb_prefault
use already exist interfacehuge_page_shift
Quoted 10 lines
Documentation/sysctl/vm.txt | 13 +++++++ include/linux/hugetlb.h | 5 +-- kernel/sysctl.c | 7 ++++ mm/hugetlb.c | 83 +++++++++++++++++++++++++++++-------------- mm/internal.h | 1 + mm/page_alloc.c | 2 +- 6 files changed, 82 insertions(+), 29 deletions(-)Signature · 1 line
1.7.10.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>