drivers: xen-selfballoon: consider slab pages
PATCH 1/1 drivers: xen-selfballoon: consider slab pages
Currently the goal_page in xen-selfballon doesn't consider much about pages used in kernel space.
A typical usage is slab pages, without consider slab pages the goal_page result may be too rough and lead extra memory pressure to guest os.
--- drivers/xen/xen-selfballoon.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/xen/xen-selfballoon.c +2 -0
@@ -191,6 +191,8 @@ static void selfballoon_process(struct work_struct *work) tgt_pages = cur_pages;/* default is no change */ goal_pages =vm_memory_committed () + totalreserve_pages + +global_page_state (NR_SLAB_RECLAIMABLE ) + +global_page_state (NR_SLAB_UNRECLAIMABLE ) +MB2PAGES (selfballoon_reserved_mb);#ifdef CONFIG_FRONTSWAP /* allow space for frontswap pages to be repatriated */
Signature · 1 line
1.7.10.4
Quoted 4 lines · Bob Liu
Currently the
goal_pagein xen-selfballon doesn't consider much about pages used in kernel space.
A typical usage is slab pages, without consider slab pages thegoal_pageresult may be too rough and lead extra memory pressure to guest os.
Does "lead extra memory pressure" mean OOM?
Quoted 22 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/xen/xen-selfballoon.c | 2 ++ 1 file changed, 2 insertions(+)drivers/xen/xen-selfballoon.c +2
-0@@ -191,6 +191,8 @@ static void selfballoon_process(struct work_struct *work) tgt_pages = cur_pages;/* default is no change */ goal_pages =vm_memory_committed () + totalreserve_pages + +global_page_state (NR_SLAB_RECLAIMABLE ) + +global_page_state (NR_SLAB_UNRECLAIMABLE ) +MB2PAGES (selfballoon_reserved_mb);#ifdef CONFIG_FRONTSWAP /* allow space for frontswap pages to be repatriated */ Signature · 1 line
1.7.10.4
Quoted 4 lines · Bob Liu
Currently the
goal_pagein xen-selfballon doesn't consider much about pages used in kernel space.
A typical usage is slab pages, without consider slab pages thegoal_pageresult may be too rough and lead extra memory pressure to guest os.
Does "lead extra memory pressure" mean OOM?
Quoted 22 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/xen/xen-selfballoon.c | 2 ++ 1 file changed, 2 insertions(+)drivers/xen/xen-selfballoon.c +2
-0@@ -191,6 +191,8 @@ static void selfballoon_process(struct work_struct *work) tgt_pages = cur_pages;/* default is no change */ goal_pages =vm_memory_committed () + totalreserve_pages + +global_page_state (NR_SLAB_RECLAIMABLE ) + +global_page_state (NR_SLAB_UNRECLAIMABLE ) +MB2PAGES (selfballoon_reserved_mb);#ifdef CONFIG_FRONTSWAP /* allow space for frontswap pages to be repatriated */ Signature · 1 line
1.7.10.4
Quoted 4 lines · Bob Liu
Currently the
goal_pagein xen-selfballon doesn't consider much about pages used in kernel space.
A typical usage is slab pages, without consider slab pages thegoal_pageresult may be too rough and lead extra memory pressure to guest os.
Can you provide some real world figures where the calculatation got it wrong? What was the resultant behavior? Swap death? OOM killer?
Quoted 10 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/xen/xen-selfballoon.c | 2 ++ 1 file changed, 2 insertions(+)drivers/xen/xen-selfballoon.c +0
-0
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 194
Quoted 4 lines
drivers/xen/xen-selfballoon.c +1
-0@@ -191,6 +191,8 @@ static void selfballoon_process(struct work_struct *work) tgt_pages = cur_pages;/* default is no change */ goal_pages =vm_memory_committed () + totalreserve_pages + + global_page_state(NR_SLAB_RECLAIMABLE) +
Does SLAB_RECLAIMABLE want to be included here? Unless I'm misunderstanding here, SLAB_RECLAIMABLE is effectively free.
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 195
Quoted 1 line
drivers/xen/xen-selfballoon.c +1
-0+ global_page_state(NR_SLAB_UNRECLAIMABLE) +
This bit looks fine to me.
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 198
Quoted 3 lines
drivers/xen/xen-selfballoon.c +0
-0MB2PAGES (selfballoon_reserved_mb);#ifdef CONFIG_FRONTSWAP /* allow space for frontswap pages to be repatriated */
David
Quoted 9 lines · David Vrabel
Quoted 4 lines · Bob Liu
Currently the
goal_pagein xen-selfballon doesn't consider much about pages used in kernel space.
A typical usage is slab pages, without consider slab pages thegoal_pageresult may be too rough and lead extra memory pressure to guest os.Can you provide some real world figures where the calculatation got it wrong? What was the resultant behavior? Swap death? OOM killer?
Sorry, I didn't run any testing I just think it's unreasonable while reading the source code.
vm_memory_committed() only calculate pages which mapped to process address space, but the kernel itself(like block, fs and network subsystem) may occupy some memory. And it's possible that those subsystem may occupy a significant amount of memory in some situation.
I'm afraid if we don't consider those kernel memory while calculating goal_pages, guest memory will be set lower than guest really needs.
Quoted 5 lines
Quoted 5 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/xen/xen-selfballoon.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 13 lines
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 194
Quoted 9 lines
drivers/xen/xen-selfballoon.c +1
-0@@ -191,6 +191,8 @@ static void selfballoon_process(struct work_struct *work) tgt_pages = cur_pages;/* default is no change */ goal_pages =vm_memory_committed () + totalreserve_pages + + global_page_state(NR_SLAB_RECLAIMABLE) +Does
SLAB_RECLAIMABLEwant to be included here? Unless I'm misunderstanding here,SLAB_RECLAIMABLEis effectively free.
SLAB_RECLAIMABLE isn't effectively free, it means the slab page is in used but can be reclaimed(freed) during memory pressure.
Quoted 10 lines
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 195
Quoted 1 line
drivers/xen/xen-selfballoon.c +1
-0+ global_page_state(NR_SLAB_UNRECLAIMABLE) +This bit looks fine to me.
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 198
Quoted 3 lines
drivers/xen/xen-selfballoon.c +0
-0MB2PAGES (selfballoon_reserved_mb);#ifdef CONFIG_FRONTSWAP /* allow space for frontswap pages to be repatriated */ David
Thanks for your review.
Signature · 2 lines
Regards, -Bob
Quoted 8 lines · Bob Liu
Quoted 6 lines · David Vrabel
Quoted 4 lines · Bob Liu
Currently the
goal_pagein xen-selfballon doesn't consider much about pages used in kernel space.
A typical usage is slab pages, without consider slab pages thegoal_pageresult may be too rough and lead extra memory pressure to guest os.
Quoted 6 lines
Quoted 3 lines
Can you provide some real world figures where the calculatation got it wrong? What was the resultant behavior? Swap death? OOM killer?
Sorry, I didn't run any testing I just think it's unreasonable while reading the source code.
I'm not keen on changes to heuristics without testing with real workloads and a demonstration that it is better in practice.
Quoted 27 lines
vm_memory_committed()only calculate pages which mapped to process address space, but the kernelitself(like block, fs and network subsystem)may occupy some memory. And it's possible that those subsystem may occupy a significant amount of memory in some situation.I'm afraid if we don't consider those kernel memory while calculating
goal_pages, guest memory will be set lower than guest really needs.Quoted 5 lines
Quoted 5 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/xen/xen-selfballoon.c | 2 ++ 1 file changed, 2 insertions(+)Quoted 13 lines
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 194
Quoted 9 lines
drivers/xen/xen-selfballoon.c +1
-0@@ -191,6 +191,8 @@ static void selfballoon_process(struct work_struct *work) tgt_pages = cur_pages;/* default is no change */ goal_pages =vm_memory_committed () + totalreserve_pages + + global_page_state(NR_SLAB_RECLAIMABLE) +Does
SLAB_RECLAIMABLEwant to be included here? Unless I'm misunderstanding here,SLAB_RECLAIMABLEis effectively free.
Quoted 2 lines
SLAB_RECLAIMABLEisn't effectively free, it means the slab page is in used but can be reclaimed(freed) during memory pressure.
Similarly to the pages used for the page cache, I think the intention is for the selfballoon_reserved_mb value to include this.
Quoted 7 lines
Quoted 7 lines
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 195
Quoted 1 line
drivers/xen/xen-selfballoon.c +1
-0+ global_page_state(NR_SLAB_UNRECLAIMABLE) +This bit looks fine to me.
Quoted 3 lines
drivers/xen/xen-selfballoon.c +0
-0MB2PAGES (selfballoon_reserved_mb);#ifdef CONFIG_FRONTSWAP /* allow space for frontswap pages to be repatriated */
David
Quoted 8 lines · Bob Liu
Quoted 6 lines · David Vrabel
Quoted 4 lines · Bob Liu
Currently the
goal_pagein xen-selfballon doesn't consider much about pages used in kernel space.
A typical usage is slab pages, without consider slab pages thegoal_pageresult may be too rough and lead extra memory pressure to guest os.
Quoted 6 lines
Quoted 3 lines
Can you provide some real world figures where the calculatation got it wrong? What was the resultant behavior? Swap death? OOM killer?
Sorry, I didn't run any testing I just think it's unreasonable while reading the source code.
I'm not keen on changes to heuristics without testing with real workloads and a demonstration that it is better in practice.
Quoted 27 lines
vm_memory_committed()only calculate pages which mapped to process address space, but the kernelitself(like block, fs and network subsystem)may occupy some memory. And it's possible that those subsystem may occupy a significant amount of memory in some situation.I'm afraid if we don't consider those kernel memory while calculating
goal_pages, guest memory will be set lower than guest really needs.Quoted 5 lines
Quoted 5 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/xen/xen-selfballoon.c | 2 ++ 1 file changed, 2 insertions(+)Quoted 13 lines
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 194
Quoted 9 lines
drivers/xen/xen-selfballoon.c +1
-0@@ -191,6 +191,8 @@ static void selfballoon_process(struct work_struct *work) tgt_pages = cur_pages;/* default is no change */ goal_pages =vm_memory_committed () + totalreserve_pages + + global_page_state(NR_SLAB_RECLAIMABLE) +Does
SLAB_RECLAIMABLEwant to be included here? Unless I'm misunderstanding here,SLAB_RECLAIMABLEis effectively free.
Quoted 2 lines
SLAB_RECLAIMABLEisn't effectively free, it means the slab page is in used but can be reclaimed(freed) during memory pressure.
Similarly to the pages used for the page cache, I think the intention is for the selfballoon_reserved_mb value to include this.
Quoted 7 lines
Quoted 7 lines
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 195
Quoted 1 line
drivers/xen/xen-selfballoon.c +1
-0+ global_page_state(NR_SLAB_UNRECLAIMABLE) +This bit looks fine to me.
Quoted 3 lines
drivers/xen/xen-selfballoon.c +0
-0MB2PAGES (selfballoon_reserved_mb);#ifdef CONFIG_FRONTSWAP /* allow space for frontswap pages to be repatriated */
David
Quoted 9 lines · David Vrabel
Quoted 4 lines · Bob Liu
Currently the
goal_pagein xen-selfballon doesn't consider much about pages used in kernel space.
A typical usage is slab pages, without consider slab pages thegoal_pageresult may be too rough and lead extra memory pressure to guest os.Can you provide some real world figures where the calculatation got it wrong? What was the resultant behavior? Swap death? OOM killer?
Sorry, I didn't run any testing I just think it's unreasonable while reading the source code.
vm_memory_committed() only calculate pages which mapped to process address space, but the kernel itself(like block, fs and network subsystem) may occupy some memory. And it's possible that those subsystem may occupy a significant amount of memory in some situation.
I'm afraid if we don't consider those kernel memory while calculating goal_pages, guest memory will be set lower than guest really needs.
Quoted 5 lines
Quoted 5 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/xen/xen-selfballoon.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 13 lines
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 194
Quoted 9 lines
drivers/xen/xen-selfballoon.c +1
-0@@ -191,6 +191,8 @@ static void selfballoon_process(struct work_struct *work) tgt_pages = cur_pages;/* default is no change */ goal_pages =vm_memory_committed () + totalreserve_pages + + global_page_state(NR_SLAB_RECLAIMABLE) +Does
SLAB_RECLAIMABLEwant to be included here? Unless I'm misunderstanding here,SLAB_RECLAIMABLEis effectively free.
SLAB_RECLAIMABLE isn't effectively free, it means the slab page is in used but can be reclaimed(freed) during memory pressure.
Quoted 10 lines
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 195
Quoted 1 line
drivers/xen/xen-selfballoon.c +1
-0+ global_page_state(NR_SLAB_UNRECLAIMABLE) +This bit looks fine to me.
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 198
Quoted 3 lines
drivers/xen/xen-selfballoon.c +0
-0MB2PAGES (selfballoon_reserved_mb);#ifdef CONFIG_FRONTSWAP /* allow space for frontswap pages to be repatriated */ David
Thanks for your review.
Signature · 2 lines
Regards, -Bob
Quoted 4 lines · Bob Liu
Currently the
goal_pagein xen-selfballon doesn't consider much about pages used in kernel space.
A typical usage is slab pages, without consider slab pages thegoal_pageresult may be too rough and lead extra memory pressure to guest os.
Can you provide some real world figures where the calculatation got it wrong? What was the resultant behavior? Swap death? OOM killer?
Quoted 10 lines
Signed-off-by Bob Liu <[email protected]>--- drivers/xen/xen-selfballoon.c | 2 ++ 1 file changed, 2 insertions(+)drivers/xen/xen-selfballoon.c +0
-0
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 194
Quoted 4 lines
drivers/xen/xen-selfballoon.c +1
-0@@ -191,6 +191,8 @@ static void selfballoon_process(struct work_struct *work) tgt_pages = cur_pages;/* default is no change */ goal_pages =vm_memory_committed () + totalreserve_pages + + global_page_state(NR_SLAB_RECLAIMABLE) +
Does SLAB_RECLAIMABLE want to be included here? Unless I'm misunderstanding here, SLAB_RECLAIMABLE is effectively free.
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 195
Quoted 1 line
drivers/xen/xen-selfballoon.c +1
-0+ global_page_state(NR_SLAB_UNRECLAIMABLE) +
This bit looks fine to me.
drivers/xen/xen-selfballoon.c static void selfballoon_process(struct work_struct *work) · line 198
Quoted 3 lines
drivers/xen/xen-selfballoon.c +0
-0MB2PAGES (selfballoon_reserved_mb);#ifdef CONFIG_FRONTSWAP /* allow space for frontswap pages to be repatriated */
David