Drivers: hv
Subsystems (3)
cover Drivers: hv
Add a basic balloon driver to take advantage of the dynamic memory management functionality supported on Windows hosts. Windows requires the guests to support both memory hot add as well as ballooning. In this patch we are adding the basic balloon driver. Memory hot add will be added in a subsequent patch and this requires some changes yet to be made on the host side.
The policy engine on Windows hosts needs the guest to post memory status periodically and it looks like committed_as is what it is expecting. Since vm_committed_as is not currently an exported symbol, this patch set also exports this symbol.
K. Y. Srinivasan (2):
mm: Export vm_committed_as
Drivers: hv: Add Hyper-V balloon driver
drivers/hv/Kconfig | 6 + drivers/hv/Makefile | 1 + drivers/hv/hv_balloon.c | 1043 +++++++++++++++++++++++++++++++++++++++++++++++ mm/mmap.c | 1 + mm/nommu.c | 1 + 5 files changed, 1052 insertions(+), 0 deletions(-) create mode 100644 drivers/hv/hv_balloon.c
Signature · 1 line
1.7.4.1
PATCH 1/2 mm: Export vm_committed_as
The policy engine on the host expects the guest to report the committed_as. Since this variable is not exported, export this symbol.
--- mm/mmap.c | 1 + mm/nommu.c | 1 + 2 files changed, 2 insertions(+), 0 deletions(-)
mm/mmap.c +1 -0
@@ -87,6 +87,7 @@ int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;* other variables. It can be updated by several CPUs frequently. */ struct percpu_counter vm_committed_as____cacheline_aligned_in_smp ; +EXPORT_SYMBOL (vm_committed_as);/* * Check that a process has enough memory to allocate a new virtual
mm/nommu.c +1 -0
@@ -68,6 +68,7 @@ atomic_long_t mmap_pages_allocated;EXPORT_SYMBOL (mem_map);EXPORT_SYMBOL (num_physpages); +EXPORT_SYMBOL (vm_committed_as);/* list of mapped, potentially shareable regions */ static struct kmem_cache *vm_region_jar;
Signature · 1 line
1.7.4.1
PATCH 2/2 Drivers: hv: Add Hyper-V balloon driver
Add the basic balloon driver. Windows hosts dynamically manage the guest memory allocation via a combination memory hot add and ballooning. Memory hot add is used to grow the guest memory upto the maximum memory that can be allocatted to the guest. Ballooning is used to both shrink as well as expand up to the max memory. Supporting hot add needs additional support from the host. We will support hot add when this support is available. For now, by setting the VM startup memory to the VM max memory, we can use ballooning alone to dynamically manage memory allocation amongst competing guests on a given host.
--- drivers/hv/Kconfig | 6 + drivers/hv/Makefile | 1 + drivers/hv/hv_balloon.c | 1043 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1050 insertions(+), 0 deletions(-) create mode 100644 drivers/hv/hv_balloon.c
drivers/hv/Kconfig +6 -0
@@ -13,4 +13,10 @@ config HYPERV_UTILS help Select this option to enable the Hyper-V Utilities. +config HYPERV_BALLOON + tristate "Microsoft Hyper-V Balloon driver" + depends on HYPERV + help + Select this option to enable the Hyper-V Utilities. + endmenu
drivers/hv/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_HYPERV) += hv_vmbus.o obj-$(CONFIG_HYPERV_UTILS) += hv_utils.o +obj-$(CONFIG_HYPERV_BALLOON) += hv_balloon.o hv_vmbus-y := vmbus_drv.o \ hv.o connection.o channel.o \
drivers/hv/hv_balloon.c new file +1043 -0
1,043 lines not on this page · raw message
Signature · 1 line
1.7.4.1
Re: [PATCH 1/2] mm: Export vm_committed_as
In reply to K. Y. SrinivasanQuoted 3 lines · K. Y. Srinivasan
The policy engine on the host expects the guest to report the
committed_as. Since this variable is not exported, export this symbol.
Why are these symbols not needed by either Xen or KVM or vmware, which I think all support the same thing, right?
Quoted 15 lines
mm/mmap.c +1
-0@@ -87,6 +87,7 @@ int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;* other variables. It can be updated by several CPUs frequently. */ struct percpu_counter vm_committed_as____cacheline_aligned_in_smp ; +EXPORT_SYMBOL (vm_committed_as);/* * Check that a process has enough memory to allocate a new virtual mm/nommu.c +0
-0
mm/nommu.c atomic_long_t mmap_pages_allocated; · line 71
Quoted 4 lines
mm/nommu.c +1
-0@@ -68,6 +68,7 @@ atomic_long_t mmap_pages_allocated;EXPORT_SYMBOL (mem_map);EXPORT_SYMBOL (num_physpages); +EXPORT_SYMBOL (vm_committed_as);
EXPORT_SYMBOL_GPL() for these new ones?
greg k-h
Re: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
In reply to K. Y. Srinivasandrivers/hv/Kconfig config HYPERV_UTILS · line 20
Quoted 5 lines · K. Y. Srinivasan
drivers/hv/Kconfig +5
-0+config HYPERV_BALLOON + tristate "Microsoft Hyper-V Balloon driver" + depends on HYPERV + help + Select this option to enable the Hyper-V Utilities.
Your help text is wrong :(
Quoted 12 lines
drivers/hv/hv_balloon.c new file +9
-0@@ -0,0 +1,1043 @@ +/* +* Copyright (c) 2012, Microsoft Corporation. +* +* Author: +* K. Y. Srinivasan <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 as published +* by the Free Software Foundation.
drivers/hv/hv_balloon.c line 19
Quoted 10 lines
drivers/hv/hv_balloon.c new file +10
-0+* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or +* NON INFRINGEMENT. See the GNU General Public License for more +* details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Unless you promise to keep track of the FSF's office buildings for the next 40+ years, just drop this paragraph entirely.
greg k-h
RE: [PATCH 1/2] mm: Export vm_committed_as
In reply to Greg KHQuoted 10 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, October 07, 2012 8:44 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_as
Quoted 7 lines
Quoted 3 lines · K. Y. Srinivasan
The policy engine on the host expects the guest to report the
committed_as. Since this variable is not exported, export this symbol.Why are these symbols not needed by either Xen or KVM or vmware, which I think all support the same thing, right?
The basic balloon driver does not need this symbol since the basic balloon driver is not automatically driven by the host. On the Windows host we have a policy engine that drives the balloon driver based on both guest level memory pressure that the guest reports as well as other system level metrics the host maintains. We need this symbol to drive the policy engine on the host.
Regards,
K. Y
RE: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
In reply to Greg KHQuoted 10 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, October 07, 2012 8:45 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
Quoted 8 lines
drivers/hv/Kconfig config HYPERV_UTILS · line 20
Quoted 5 lines · K. Y. Srinivasan
drivers/hv/Kconfig +5
-0+config HYPERV_BALLOON + tristate "Microsoft Hyper-V Balloon driver" + depends on HYPERV + help + Select this option to enable the Hyper-V Utilities.Your help text is wrong :(
Sorry about that; I will fix it.
Quoted 25 lines
Quoted 7 lines
drivers/hv/hv_balloon.c new file +3
-0@@ -0,0 +1,1043 @@ +/* +* Copyright (c) 2012, Microsoft Corporation. +* drivers/hv/hv_balloon.c line 13
Quoted 10 lines
drivers/hv/hv_balloon.c new file +10
-0+* Author: +* K. Y. Srinivasan <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 as published +* by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
drivers/hv/hv_balloon.c line 19
Quoted 6 lines
drivers/hv/hv_balloon.c new file +6
-0+* NON INFRINGEMENT. See the GNU General Public License for more +* details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
Quoted 2 lines
Unless you promise to keep track of the FSF's office buildings for the next 40+ years, just drop this paragraph entirely.
Will do.
Thanks,
K. Y
Re: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
In reply to K. Y. Srinivasandrivers/hv/hv_balloon.c line 424
Quoted 4 lines · K. Y. Srinivasan
drivers/hv/hv_balloon.c new file +4
-0+static int hot_add; + +module_param (hot_add, int,S_IRUGO ); +MODULE_PARM_DESC (hot_add,"If set attempt memory hot_add" );
I think this should be a 'bool', but I can't tell, since it's not used in this patch.
Cheers,
Rusty.
Re: [PATCH 1/2] mm: Export vm_committed_as
In reply to KY SrinivasanQuoted 15 lines · KY Srinivasan
Quoted 15 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, October 07, 2012 8:44 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 3 lines · K. Y. Srinivasan
The policy engine on the host expects the guest to report the
committed_as. Since this variable is not exported, export this symbol.
Quoted 8 lines
Quoted 2 lines
Why are these symbols not needed by either Xen or KVM or vmware, which I think all support the same thing, right?
The basic balloon driver does not need this symbol since the basic balloon driver is not automatically driven by the host. On the Windows host we have a policy engine that drives the balloon driver based on both guest level memory pressure that the guest reports as well as other system level metrics the host maintains. We need this symbol to drive the policy engine on the host.
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
thanks,
greg k-h
RE: [PATCH 1/2] mm: Export vm_committed_as
Quoted 33 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, October 08, 2012 9:36 AM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 7 lines · KY Srinivasan
Quoted 7 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, October 07, 2012 8:44 PM
To: KY Srinivasan
Cc: [email protected]; [email protected];Quoted 8 lines
Quoted 8 lines
[email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 3 lines · K. Y. Srinivasan
The policy engine on the host expects the guest to report the
committed_as. Since this variable is not exported, export this symbol.Quoted 5 lines
Quoted 2 lines
Why are these symbols not needed by either Xen or KVM or vmware, which I think all support the same thing, right?
The basic balloon driver does not need this symbol since the basic balloon driver is not automatically driven by the host. On the Windows host we have a policy
engine that
Quoted 8 lines
Quoted 1 line
drives the balloon driver based on both guest level memory pressure that the
guest
Quoted 1 line
reports as well as other system level metrics the host maintains. We need this
symbol to
Quoted 1 line
drive the policy engine on the host.
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Andi Kleen suggested that I send the patch to Andrew Morton for acceptance. That is why I have included both Andrew Morton and Andi Kleen in the email list for these patches. Should I have sent that patch to a different email alias for acceptance by the mm developers.
Regards,
K. Y
RE: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
In reply to Rusty RussellQuoted 11 lines
-----Original Message-----
From: Rusty Russell [mailto:[email protected]]
Sent: Monday, October 08, 2012 1:46 AM
To: KY Srinivasan; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: KY Srinivasan
Subject: Re: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
Quoted 8 lines
drivers/hv/hv_balloon.c line 424
Quoted 4 lines · K. Y. Srinivasan
drivers/hv/hv_balloon.c new file +4
-0+static int hot_add; + +module_param (hot_add, int,S_IRUGO ); +MODULE_PARM_DESC (hot_add,"If set attempt memory hot_add" );I think this should be a 'bool', but I can't tell, since it's not used in this patch.
You are right; currently, I unconditionally fail the hot add request. Hopefully, I will soon be able to support hot add once I get the needed host side changes.
Regards,
K. Y
Andrew Morton
maintainerRe: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
In reply to K. Y. SrinivasanQuoted 1 line · On Sun, 7 Oct 2012 16:59:46 -0700 "K. Y. Srinivasan" <[email protected]> wrote:
Add the basic balloon driver.
hm, how many balloon drivers does one kernel need?
Although I see that the great majority of this code is hypervisor-specific.
Quoted 21 lines
Windows hosts dynamically manage the guest
memory allocation via a combination memory hot add and ballooning. Memory hot add is used to grow the guest memory upto the maximum memory that can be allocatted to the guest. Ballooning is used to both shrink as well as expand up to the max memory. Supporting hot add needs additional support from the host. We will support hot add when this support is available. For now, by setting the VM startup memory to the VM max memory, we can use ballooning alone to dynamically manage memory allocation amongst competing guests on a given host....
drivers/hv/hv_balloon.c new file +8
-0+static int alloc_balloon_pages (struct hv_dynmem_device *dm,int num_pages, +struct dm_balloon_response *bl_resp,int alloc_unit, +bool *alloc_error) +{ +int i =0 ; +struct page *pg; + +if (num_pages < alloc_unit)
drivers/hv/hv_balloon.c line 584
Quoted 10 lines
drivers/hv/hv_balloon.c new file +10
-0+return 0 ; + +for (i =0 ; (i * alloc_unit) < num_pages; i++) { +if (bl_resp->hdr.size +sizeof (union dm_mem_page_range ) > +PAGE_SIZE ) +return i * alloc_unit; + + pg =alloc_pages (GFP_HIGHUSER | __GFP_NORETRY |GFP_ATOMIC | + __GFP_NOMEMALLOC | __GFP_NOWARN, +get_order (alloc_unit <<PAGE_SHIFT ));
This choice of GFP flags is basically impossible to understand, so I suggest that a comment be added explaining it all.
I'm a bit surprised at the inclusion of GFP_ATOMIC as it will a) dip into page reserves, whcih might be undesirable and b) won't even reclaim clean pages, which seems desirable. I suggest this also be covered in the forthcoming code comment.
drivers/misc/vmw_balloon.c seems to me to have used better choices here.
drivers/hv/hv_balloon.c line 591
Quoted 6 lines
drivers/hv/hv_balloon.c new file +6
-0+if (!pg) { + *alloc_error = true; +return i * alloc_unit; + } + + totalram_pages -= alloc_unit;
Well, I'd consider totalram_pages to be an mm-private thing which drivers shouldn't muck with. Why is this done?
drivers/xen/balloon.c and drivers/virtio/virtio_balloon.c also alter totalram_pages, also without explaining why. drivers/misc/vmw_balloon.c does not.
Quoted 15 lines
drivers/hv/hv_balloon.c new file +12
-0+ dm->num_pages_ballooned += alloc_unit; + + bl_resp->range_count++; + bl_resp->range_array[i].finfo.start_page = +page_to_pfn (pg); + bl_resp->range_array[i].finfo.page_cnt = alloc_unit; + bl_resp->hdr.size +=sizeof (union dm_mem_page_range ); + + } + +return num_pages; +}
Andrew Morton
maintainerRe: [PATCH 1/2] mm: Export vm_committed_as
In reply to Greg KHQuoted 19 lines · On Mon, 8 Oct 2012 06:35:39 -0700 Greg KH <[email protected]> wrote:
Quoted 18 lines · KY Srinivasan
Quoted 17 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, October 07, 2012 8:44 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 3 lines · K. Y. Srinivasan
The policy engine on the host expects the guest to report the
committed_as. Since this variable is not exported, export this symbol.Why are these symbols not needed by either Xen or KVM or vmware, which I think all support the same thing, right?
Quoted 8 lines
Quoted 5 lines
The basic balloon driver does not need this symbol since the basic balloon driver is not automatically driven by the host. On the Windows host we have a policy engine that drives the balloon driver based on both guest level memory pressure that the guest reports as well as other system level metrics the host maintains. We need this symbol to drive the policy engine on the host.
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Well I guess it won't kill us.
I do wonder what relevance vm_committed_as has to processes which are running within a memcg container?
RE: [PATCH 1/2] mm: Export vm_committed_as
Quoted 39 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Tuesday, October 09, 2012 3:48 PM
To: Greg KH
Cc: KY Srinivasan; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 8 lines · On Mon, 8 Oct 2012 06:35:39 -0700 Greg KH <[email protected]> wrote:
Quoted 7 lines · KY Srinivasan
Quoted 7 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, October 07, 2012 8:44 PM
To: KY Srinivasan
Cc: [email protected]; [email protected];Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
[email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asOn Sun, Oct 07, 2012 at 04:59:45PM -0700, K. Y. Srinivasan wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
The policy engine on the host expects the guest to report the
committed_as. Since this variable is not exported, export this symbol.Why are these symbols not needed by either Xen or KVM or vmware, which I think all support the same thing, right?
The basic balloon driver does not need this symbol since the basic balloon
driver
Quoted 1 line
Quoted 1 line
is not automatically driven by the host. On the Windows host we have a policy
engine that
Quoted 1 line
Quoted 1 line
drives the balloon driver based on both guest level memory pressure that the
guest
Quoted 8 lines
Quoted 1 line
Quoted 1 line
reports as well as other system level metrics the host maintains. We need this
symbol to
Quoted 4 lines
Quoted 1 line
drive the policy engine on the host.
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Well I guess it won't kill us.
Thanks.
K. Y
RE: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
In reply to Andrew MortonQuoted 58 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Tuesday, October 09, 2012 3:45 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driverQuoted 1 line · On Sun, 7 Oct 2012 16:59:46 -0700 "K. Y. Srinivasan" <[email protected]> wrote:
Add the basic balloon driver.
hm, how many balloon drivers does one kernel need?
Although I see that the great majority of this code is hypervisor-specific.
Quoted 3 lines
Windows hosts dynamically manage the guest
memory allocation via a combination memory hot add and ballooning. Memory hot add is used to grow the guest memory upto the maximum memory that canbe
Quoted 11 lines
allocatted to the guest. Ballooning is used to both shrink as well as expand up to the max memory. Supporting hot add needs additional support from the host. We will support hot add when this support is available. For now, by setting the VM startup memory to the VM max memory, we can use ballooning alone to dynamically manage memory allocation amongst competing guests on a given host.
...
+static int alloc_balloon_pages(struct
hv_dynmem_device*dm, int
num_pages,Quoted 5 lines
drivers/hv/hv_balloon.c new file +5
-0+ struct dm_balloon_response *bl_resp, int alloc_unit, + bool *alloc_error) +{ + int i = 0; +struct page *pg;drivers/hv/hv_balloon.c
Quoted 10 lines
drivers/hv/hv_balloon.c new file +10
-0+ +if (num_pages < alloc_unit) +return 0 ; + +for (i =0 ; (i * alloc_unit) < num_pages; i++) { +if (bl_resp->hdr.size +sizeof (union dm_mem_page_range ) > +PAGE_SIZE ) +return i * alloc_unit; + + pg = alloc_pages(GFP_HIGHUSER | __GFP_NORETRY |
GFP_ATOMIC|drivers/hv/hv_balloon.c line 584
Quoted 2 lines
drivers/hv/hv_balloon.c new file +2
-0+ __GFP_NOMEMALLOC | __GFP_NOWARN, + get_order(alloc_unit << PAGE_SHIFT));This choice of GFP flags is basically impossible to understand, so I suggest that a comment be added explaining it all.
Quoted 4 lines
I'm a bit surprised at the inclusion of
GFP_ATOMICas it will a) dip into page reserves, whcih might be undesirable and b) won't even reclaim clean pages, which seems desirable. I suggest this also be covered in the forthcoming code comment.
I will rework these flags and add appropriate comments.
Quoted 12 lines
drivers/misc/vmw_balloon.cseems to me to have used better choices here.drivers/hv/hv_balloon.c line 591
Quoted 6 lines
drivers/hv/hv_balloon.c new file +6
-0+if (!pg) { + *alloc_error = true; +return i * alloc_unit; + } + + totalram_pages -= alloc_unit;Well, I'd consider
totalram_pagesto be an mm-private thing which drivers shouldn't muck with. Why is this done?
By modifying the totalram_pages, the information presented in /proc/meminfo correctly reflects what is currently assigned to the guest (MemTotal).
Quoted 18 lines
drivers/xen/balloon.canddrivers/virtio/virtio_balloon.calso altertotalram_pages, also without explaining why.drivers/misc/vmw_balloon.cdoes not.Quoted 13 lines
drivers/hv/hv_balloon.c new file +12
-0+ dm->num_pages_ballooned += alloc_unit; + + bl_resp->range_count++; + bl_resp->range_array[i].finfo.start_page = +page_to_pfn (pg); + bl_resp->range_array[i].finfo.page_cnt = alloc_unit; + bl_resp->hdr.size +=sizeof (union dm_mem_page_range ); + + } + +return num_pages; +}
Quoted 5 lines
Quoted 2 lines
...
Thanks for the prompt review. I will address your comments and repost the patches soon. If it is ok with you, I am going to keep the code that manipulates totalram_pages (for reasons I listed above).
Regards,
K. Y
Andrew Morton
maintainerRe: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
Quoted 10 lines · On Wed, 10 Oct 2012 00:09:12 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 9 lines
drivers/hv/hv_balloon.c line 591
Quoted 6 lines
drivers/hv/hv_balloon.c new file +6
-0+if (!pg) { + *alloc_error = true; +return i * alloc_unit; + } + + totalram_pages -= alloc_unit;Well, I'd consider
totalram_pagesto be an mm-private thing which drivers shouldn't muck with. Why is this done?
Quoted 2 lines
By modifying the
totalram_pages, the information presented in/proc/meminfocorrectly reflects what is currently assigned to the guest (MemTotal).
eh? /proc/meminfo:MemTotal tells you the total memory in the machine. The only thing which should change it after boot is memory hotplug.
Modifying it in this manner puts the statistic into a state know as "wrong". And temporarily modifying it in this fashion will cause the tremendous amount of initialisation code which relies upon totalram_pages for sizing to also enter the "wrong" state.
Why on earth do balloon drivers do this? If the amount of memory which is consumed by balloons is interesting then it should be exported via a standalone metric, not by mucking with totalram_pages.
Andrew Morton
maintainerRe: [PATCH 1/2] mm: Export vm_committed_as
In reply to KY SrinivasanQuoted 43 lines · On Wed, 10 Oct 2012 00:11:28 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 43 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Tuesday, October 09, 2012 3:48 PM
To: Greg KH
Cc: KY Srinivasan; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 8 lines · On Mon, 8 Oct 2012 06:35:39 -0700 Greg KH <[email protected]> wrote:
Quoted 7 lines · KY Srinivasan
Quoted 7 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, October 07, 2012 8:44 PM
To: KY Srinivasan
Cc: [email protected]; [email protected];Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
[email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asOn Sun, Oct 07, 2012 at 04:59:45PM -0700, K. Y. Srinivasan wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
The policy engine on the host expects the guest to report the
committed_as. Since this variable is not exported, export this symbol.Why are these symbols not needed by either Xen or KVM or vmware, which I think all support the same thing, right?
The basic balloon driver does not need this symbol since the basic balloon
driver
Quoted 1 line
Quoted 1 line
is not automatically driven by the host. On the Windows host we have a policy
engine that
Quoted 1 line
Quoted 1 line
drives the balloon driver based on both guest level memory pressure that the
guest
Quoted 1 line
Quoted 1 line
reports as well as other system level metrics the host maintains. We need this
symbol to
Quoted 2 lines
Quoted 1 line
drive the policy engine on the host.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Well I guess it won't kill us.
Thanks.
The other part of my email seems to have vanished. Which makes me sad, because I was rather interested in the answer.
RE: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
In reply to Andrew MortonQuoted 29 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Tuesday, October 09, 2012 9:15 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driverQuoted 10 lines · On Wed, 10 Oct 2012 00:09:12 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 9 lines
drivers/hv/hv_balloon.c line 591
Quoted 6 lines
drivers/hv/hv_balloon.c new file +6
-0+if (!pg) { + *alloc_error = true; +return i * alloc_unit; + } + + totalram_pages -= alloc_unit;Well, I'd consider
totalram_pagesto be an mm-private thing which drivers shouldn't muck with. Why is this done?Quoted 2 lines
By modifying the
totalram_pages, the information presented in/proc/meminfocorrectly reflects what is currently assigned to the guest (MemTotal).eh? /proc/meminfo:MemTotal tells you the total memory in the machine. The only thing which should change it after boot is memory hotplug.
Quoted 8 lines
Modifying it in this manner puts the statistic into a state know as "wrong". And temporarily modifying it in this fashion will cause the tremendous amount of initialisation code which relies upon
totalram_pagesfor sizing to also enter the "wrong" state.Why on earth do balloon drivers do this? If the amount of memory which is consumed by balloons is interesting then it should be exported via a standalone metric, not by mucking with
totalram_pages.
I see your point. I will get rid of the code that manipulates the totalram_pages.
Regards,
K. Y
RE: [PATCH 1/2] mm: Export vm_committed_as
In reply to Andrew MortonQuoted 62 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Tuesday, October 09, 2012 9:17 PM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 25 lines · On Wed, 10 Oct 2012 00:11:28 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 25 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Tuesday, October 09, 2012 3:48 PM
To: Greg KH
Cc: KY Srinivasan; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 8 lines · On Mon, 8 Oct 2012 06:35:39 -0700 Greg KH <[email protected]> wrote:
Quoted 7 lines · KY Srinivasan
Quoted 7 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, October 07, 2012 8:44 PM
To: KY Srinivasan
Cc: [email protected]; [email protected];Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
[email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines · K. Y. Srinivasan
Quoted 3 lines
The policy engine on the host expects the guest to report the
committed_as. Since this variable is not exported, export this symbol.Why are these symbols not needed by either Xen or KVM or vmware,
which
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
I think all support the same thing, right?
The basic balloon driver does not need this symbol since the basic balloon
driver
Quoted 1 line
Quoted 1 line
is not automatically driven by the host. On the Windows host we have a
policy
Quoted 2 lines
Quoted 2 lines
engine that
Quoted 1 line
Quoted 1 line
drives the balloon driver based on both guest level memory pressure that
the
Quoted 2 lines
Quoted 2 lines
guest
Quoted 1 line
Quoted 1 line
reports as well as other system level metrics the host maintains. We need
this
Quoted 6 lines
Quoted 6 lines
symbol to
Quoted 4 lines
Quoted 1 line
drive the policy engine on the host.
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Well I guess it won't kill us.
Thanks.
The other part of my email seems to have vanished. Which makes me sad, because I was rather interested in the answer.
Andrew,
I am truly sorry for not answering your question. To be honest, I was not quite sure what the issue was, given from what I can tell, the vm_committed_as is maintained globally and would represent the overall memory commitment of the system. Is this not the case.
Regards,
K. Y
Re: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
In reply to Andrew MortonQuoted 8 lines · Andrew Morton
Quoted 1 line · On Sun, 7 Oct 2012 16:59:46 -0700 "K. Y. Srinivasan" <[email protected]> wrote:
Add the basic balloon driver.
hm, how many balloon drivers does one kernel need?
Although I see that the great majority of this code is hypervisor-specific.
Much like each network driver is NIC specific.
You could think up a framework into which hypervisor specific balloon drivers plug in, but you'll find that in each driver 85% of the code is devoted to talking to the hypervisor, 15% is outdated comments, and the rest is a call to alloc_pages() and a call to free_pages().
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
In reply to Andrew MortonQuoted 14 lines · Andrew Morton
Quoted 10 lines · On Wed, 10 Oct 2012 00:09:12 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 8 lines
drivers/hv/hv_balloon.c line 591
Quoted 6 lines
drivers/hv/hv_balloon.c new file +6
-0+if (!pg) { + *alloc_error = true; +return i * alloc_unit; + } + + totalram_pages -= alloc_unit;Well, I'd consider
totalram_pagesto be an mm-private thing which drivers shouldn't muck with. Why is this done?By modifying the
totalram_pages, the information presented in/proc/meminfocorrectly reflects what is currently assigned to the guest (MemTotal).eh? /proc/meminfo:MemTotal tells you the total memory in the machine. The only thing which should change it after boot is memory hotplug.
[...]
Quoted 3 lines
Why on earth do balloon drivers do this? If the amount of memory which is consumed by balloons is interesting then it should be exported via a standalone metric, not by mucking with
totalram_pages.
Balloon drivers are trying to fake a form of page-by-page memory hotplug. When they allocate memory from the kernel, they're actually giving the pages back to the hypervisor to redistribute to other guests. They reduce totalram_pages to try and reflect that the memory is no longer the kernel (in Xen, at least, the pfns will no longer have any physical page underlying them).
I agree this is pretty ugly; it would be nice to have some better interface to indicate what's going on. At one point I tried to use the memory hotplug interfaces for larger-scale dynamic transfers of memory between a domain and the host, but when I last looked at it, it was too coarse grained and heavyweight to replace the balloon mechanism.
J
Andrew Morton
maintainerRe: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
Quoted 27 lines · On Wed, 10 Oct 2012 16:34:37 -0700 Jeremy Fitzhardinge <[email protected]> wrote:
Quoted 14 lines · Andrew Morton
Quoted 10 lines · On Wed, 10 Oct 2012 00:09:12 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 8 lines
drivers/hv/hv_balloon.c line 591
Quoted 6 lines
drivers/hv/hv_balloon.c new file +6
-0+if (!pg) { + *alloc_error = true; +return i * alloc_unit; + } + + totalram_pages -= alloc_unit;Well, I'd consider
totalram_pagesto be an mm-private thing which drivers shouldn't muck with. Why is this done?By modifying the
totalram_pages, the information presented in/proc/meminfocorrectly reflects what is currently assigned to the guest (MemTotal).eh? /proc/meminfo:MemTotal tells you the total memory in the machine. The only thing which should change it after boot is memory hotplug.
[...]
Quoted 3 lines
Why on earth do balloon drivers do this? If the amount of memory which is consumed by balloons is interesting then it should be exported via a standalone metric, not by mucking with
totalram_pages.Balloon drivers are trying to fake a form of page-by-page memory hotplug. When they allocate memory from the kernel, they're actually giving the pages back to the hypervisor to redistribute to other guests. They reduce
totalram_pagesto try and reflect that the memory is no longer the kernel (in Xen, at least, the pfns will no longer have any physical page underlying them).
Quoted 6 lines
I agree this is pretty ugly; it would be nice to have some better interface to indicate what's going on. At one point I tried to use the memory hotplug interfaces for larger-scale dynamic transfers of memory between a domain and the host, but when I last looked at it, it was too coarse grained and heavyweight to replace the balloon mechanism.
urgh.
I suppose the least we can do here would be to stop directly dinking with totalram_pages and create some sort of interface for this operation. That interface would run the memory hotplug notifier so that code which cares about changes in the amount of physical memory can take appropriate steps. The implications would be that the balloon drivers would need to call this interface at low frequency (ie: batch the pages) and in some reasonably lock-free context.
I guess that's solving a non-problem at this stage.
Re: [PATCH 2/2] Drivers: hv: Add Hyper-V balloon driver
Quoted 47 lines · Andrew Morton
Quoted 27 lines · On Wed, 10 Oct 2012 16:34:37 -0700 Jeremy Fitzhardinge <[email protected]> wrote:
Quoted 14 lines · Andrew Morton
Quoted 10 lines · On Wed, 10 Oct 2012 00:09:12 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 8 lines
drivers/hv/hv_balloon.c line 591
Quoted 6 lines
drivers/hv/hv_balloon.c new file +6
-0+if (!pg) { + *alloc_error = true; +return i * alloc_unit; + } + + totalram_pages -= alloc_unit;Well, I'd consider
totalram_pagesto be an mm-private thing which drivers shouldn't muck with. Why is this done?By modifying the
totalram_pages, the information presented in/proc/meminfocorrectly reflects what is currently assigned to the guest (MemTotal).eh? /proc/meminfo:MemTotal tells you the total memory in the machine. The only thing which should change it after boot is memory hotplug.
[...]
Quoted 3 lines
Why on earth do balloon drivers do this? If the amount of memory which is consumed by balloons is interesting then it should be exported via a standalone metric, not by mucking with
totalram_pages.Balloon drivers are trying to fake a form of page-by-page memory hotplug. When they allocate memory from the kernel, they're actually giving the pages back to the hypervisor to redistribute to other guests. They reduce
totalram_pagesto try and reflect that the memory is no longer the kernel (in Xen, at least, the pfns will no longer have any physical page underlying them).Quoted 6 lines
I agree this is pretty ugly; it would be nice to have some better interface to indicate what's going on. At one point I tried to use the memory hotplug interfaces for larger-scale dynamic transfers of memory between a domain and the host, but when I last looked at it, it was too coarse grained and heavyweight to replace the balloon mechanism.
urgh.
I suppose the least we can do here would be to stop directly dinking with
totalram_pagesand create some sort of interface for this operation. That interface would run the memory hotplug notifier so that code which cares about changes in the amount of physical memory can take appropriate steps. The implications would be that the balloon drivers would need to call this interface at low frequency (ie: batch the pages) and in some reasonably lock-free context.
Quoted 1 line
I guess that's solving a non-problem at this stage.
Yep. drivers/virtio/virtio_balloon manipulates it too. This, it's best practice!
Cheers,
Rusty.
RE: [PATCH 1/2] mm: Export vm_committed_as
In reply to Andrew MortonQuoted 39 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Tuesday, October 09, 2012 3:48 PM
To: Greg KH
Cc: KY Srinivasan; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 8 lines · On Mon, 8 Oct 2012 06:35:39 -0700 Greg KH <[email protected]> wrote:
Quoted 7 lines · KY Srinivasan
Quoted 7 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, October 07, 2012 8:44 PM
To: KY Srinivasan
Cc: [email protected]; [email protected];Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
[email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asOn Sun, Oct 07, 2012 at 04:59:45PM -0700, K. Y. Srinivasan wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
The policy engine on the host expects the guest to report the
committed_as. Since this variable is not exported, export this symbol.Why are these symbols not needed by either Xen or KVM or vmware, which I think all support the same thing, right?
The basic balloon driver does not need this symbol since the basic balloon
driver
Quoted 1 line
Quoted 1 line
is not automatically driven by the host. On the Windows host we have a policy
engine that
Quoted 1 line
Quoted 1 line
drives the balloon driver based on both guest level memory pressure that the
guest
Quoted 8 lines
Quoted 1 line
Quoted 1 line
reports as well as other system level metrics the host maintains. We need this
symbol to
Quoted 4 lines
Quoted 1 line
drive the policy engine on the host.
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Well I guess it won't kill us.
Andrew,
I presumed this was an Ack from you with regards to exporting the symbol. Looks like Greg is waiting to hear from you before he can check these patches in. Could you provide an explicit Ack.
Regards,
K. Y
Quoted 6 lines
I do wonder what relevance
vm_committed_ashas to processes which are running within a memcg container?
Andrew Morton
maintainerRe: [PATCH 1/2] mm: Export vm_committed_as
Quoted 6 lines · On Sat, 3 Nov 2012 14:09:38 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 6 lines
Quoted 5 lines
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Quoted 8 lines
Quoted 1 line
Well I guess it won't kill us.
Andrew,
I presumed this was an Ack from you with regards to exporting the symbol. Looks like Greg is waiting to hear from you before he can check these patches in. Could you provide an explicit Ack.
Well, I do have some qualms about exporting vm_committed_as to modules.
vm_committed_as is a global thing and only really makes sense in a non-containerised system. If the application is running within a memory cgroup then vm_enough_memory() and the global overcommit policy are at best irrelevant and misleading.
If use of vm_committed_as is indeed a bad thing, then exporting it to modules might increase the amount of badness in the kernel.
I don't think these qualms are serious enough to stand in the way of this patch, but I'd be interested in hearing the memcg developers' thoughts on the matter?
Perhaps you could provide a detailed description of why your module actually needs this? Precisely what information is it looking for and why? If we know that then perhaps a more comfortable alternative can be found.
--
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>
RE: [PATCH 1/2] mm: Export vm_committed_as
Quoted 45 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Monday, November 05, 2012 4:45 PM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Hiroyuki Kamezawa; Michal Hocko; Johannes Weiner; Ying Han
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 6 lines · On Sat, 3 Nov 2012 14:09:38 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 6 lines
Quoted 5 lines
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Quoted 8 lines
Quoted 1 line
Well I guess it won't kill us.
Andrew,
I presumed this was an Ack from you with regards to exporting the symbol. Looks like Greg is waiting to hear from you before he can check these patches in. Could you provide an explicit Ack.
Well, I do have some qualms about exporting
vm_committed_asto modules.
vm_committed_asis a global thing and only really makes sense in a non-containerised system. If the application is running within a memory cgroup thenvm_enough_memory()and the global overcommit policy are at best irrelevant and misleading.If use of
vm_committed_asis indeed a bad thing, then exporting it to modules might increase the amount of badness in the kernel.I don't think these qualms are serious enough to stand in the way of this patch, but I'd be interested in hearing the memcg developers' thoughts on the matter?
Quoted 4 lines
Perhaps you could provide a detailed description of why your module actually needs this? Precisely what information is it looking for and why? If we know that then perhaps a more comfortable alternative can be found.
The Hyper-V host has a policy engine for managing available physical memory across competing virtual machines. This policy decision is based on a number of parameters including the memory pressure reported by the guest. Currently, the pressure calculation is based on the memory commitment made by the guest. From what I can tell, the ratio of currently allocated physical memory to the current memory commitment made by the guest (vm_committed_as) is used as one of the parameters in making the memory balancing decision on the host. This is what Windows guests report to the host. So, I need some measure of memory commitments made by the Linux guest. This is the reason I want export vm_committed_as.
Regards,
K. Y
RE: [PATCH 1/2] mm: Export vm_committed_as
Quoted 9 lines · KY Srinivasan
The Hyper-V host has a policy engine for managing available physical memory across competing virtual machines. This policy decision is based on a number of parameters including the memory pressure reported by the guest. Currently, the pressure calculation is based on the memory commitment made by the guest. From what I can tell, the ratio of currently allocated physical memory to the current memory commitment made by the guest (
vm_committed_as) is used as one of the parameters in making the memory balancing decision on the host. This is what Windows guests report to the host. So, I need some measure of memory commitments made by the Linux guest. This is the reason I want exportvm_committed_as.
I don't think you should export the symbol itself to modules but rather a helper function that returns s64 that just wraps percpu_counter_read_positive() which your driver could use instead.
(And why percpu_counter_read_positive() returns a signed type is a mystery.)
--
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>
Re: [PATCH 1/2] mm: Export vm_committed_as
In reply to KY SrinivasanQuoted 50 lines · KY Srinivasan
Quoted 45 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Monday, November 05, 2012 4:45 PM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Hiroyuki Kamezawa; Michal Hocko; Johannes Weiner; Ying Han
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 6 lines · On Sat, 3 Nov 2012 14:09:38 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 6 lines
Quoted 5 lines
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Quoted 8 lines
Quoted 1 line
Well I guess it won't kill us.
Andrew,
I presumed this was an Ack from you with regards to exporting the symbol. Looks like Greg is waiting to hear from you before he can check these patches in. Could you provide an explicit Ack.
Well, I do have some qualms about exporting
vm_committed_asto modules.
vm_committed_asis a global thing and only really makes sense in a non-containerised system. If the application is running within a memory cgroup thenvm_enough_memory()and the global overcommit policy are at best irrelevant and misleading.If use of
vm_committed_asis indeed a bad thing, then exporting it to modules might increase the amount of badness in the kernel.I don't think these qualms are serious enough to stand in the way of this patch, but I'd be interested in hearing the memcg developers' thoughts on the matter?
Quoted 4 lines
Perhaps you could provide a detailed description of why your module actually needs this? Precisely what information is it looking for and why? If we know that then perhaps a more comfortable alternative can be found.
Quoted 11 lines
The Hyper-V host has a policy engine for managing available physical memory across competing virtual machines. This policy decision is based on a number of parameters including the memory pressure reported by the guest. Currently, the pressure calculation is based on the memory commitment made by the guest. From what I can tell, the ratio of currently allocated physical memory to the current memory commitment made by the guest (
vm_committed_as) is used as one of the parameters in making the memory balancing decision on the host. This is what Windows guests report to the host. So, I need some measure of memory commitments made by the Linux guest. This is the reason I want exportvm_committed_as.
So IIUC it will be guest who reports the value and the guest runs in the ring-0 so it is not in any user process context, right?
If this is correct then memcg doesn't play any role here.
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>
RE: [PATCH 1/2] mm: Export vm_committed_as
Quoted 76 lines
-----Original Message-----
From: Michal Hocko [mailto:[email protected]] On Behalf Of Michal Hocko
Sent: Tuesday, November 06, 2012 4:06 AM
To: KY Srinivasan
Cc: Andrew Morton; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; Hiroyuki Kamezawa; Johannes Weiner; Ying Han
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 7 lines · KY Srinivasan
Quoted 7 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Monday, November 05, 2012 4:45 PM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected];Quoted 22 lines
Quoted 22 lines
[email protected]; [email protected]; [email protected]; Hiroyuki Kamezawa; Michal Hocko; Johannes Weiner; Ying Han
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 14 lines · On Sat, 3 Nov 2012 14:09:38 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 7 lines
Quoted 5 lines
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Well I guess it won't kill us.
Andrew,
I presumed this was an Ack from you with regards to exporting the symbol. Looks like Greg is waiting to hear from you before he can check these patches in. Could you provide an explicit Ack.
Quoted 5 lines
Quoted 5 lines
Well, I do have some qualms about exporting
vm_committed_asto modules.
vm_committed_asis a global thing and only really makes sense in a non-containerised system. If the application is running within a memory cgroup thenvm_enough_memory()and the global overcommitpolicy
Quoted 16 lines
Quoted 11 lines
are at best irrelevant and misleading.
If use of
vm_committed_asis indeed a bad thing, then exporting it to modules might increase the amount of badness in the kernel.I don't think these qualms are serious enough to stand in the way of this patch, but I'd be interested in hearing the memcg developers' thoughts on the matter?
Quoted 4 lines
Perhaps you could provide a detailed description of why your module actually needs this? Precisely what information is it looking for and why? If we know that then perhaps a more comfortable alternative can be found.
Quoted 11 lines
The Hyper-V host has a policy engine for managing available physical memory across competing virtual machines. This policy decision is based on a number of parameters including the memory pressure reported by the guest. Currently, the pressure calculation is based on the memory commitment made by the guest. From what I can tell, the ratio of currently allocated physical memory to the current memory commitment made by the guest (
vm_committed_as) is used as one of the parameters in making the memory balancing decision on the host. This is what Windows guests report to the host. So, I need some measure of memory commitments made by the Linux guest. This is the reason I want exportvm_committed_as.
Quoted 3 lines
So IIUC it will be guest who reports the value and the guest runs in the ring-0 so it is not in any user process context, right?
If this is correct then memcg doesn't play any role here.
Thanks Michal. Yes, the kernel driver reports this metric to the host. Andrew, let me know how I should proceed here.
Thanks,
K. Y
--
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>
Re: [PATCH 1/2] mm: Export vm_committed_as
In reply to David RientjesQuoted 12 lines · David Rientjes
Quoted 9 lines · KY Srinivasan
The Hyper-V host has a policy engine for managing available physical memory across competing virtual machines. This policy decision is based on a number of parameters including the memory pressure reported by the guest. Currently, the pressure calculation is based on the memory commitment made by the guest. From what I can tell, the ratio of currently allocated physical memory to the current memory commitment made by the guest (
vm_committed_as) is used as one of the parameters in making the memory balancing decision on the host. This is what Windows guests report to the host. So, I need some measure of memory commitments made by the Linux guest. This is the reason I want exportvm_committed_as.
Quoted 3 lines
I don't think you should export the symbol itself to modules but rather a helper function that returns s64 that just wraps
percpu_counter_read_positive()which your driver could use instead.
Agreed, we should rather make sure that nobody can manipulate the value from modules.
Quoted 2 lines
(And why
percpu_counter_read_positive()returns a signed type is a mystery.)
Strange indeed. The last commit changed it from long to s64 to suport values bigger than 2^31 but even the original long doesn't make much sense to me.
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>
RE: [PATCH 1/2] mm: Export vm_committed_as
In reply to Michal HockoQuoted 88 lines
-----Original Message-----
From: KY Srinivasan
Sent: Tuesday, November 06, 2012 7:53 AM
To: 'Michal Hocko'
Cc: Andrew Morton; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; Hiroyuki Kamezawa; Johannes Weiner; Ying Han
Subject: RE: [PATCH 1/2] mm: Exportvm_committed_asQuoted 12 lines
-----Original Message-----
From: Michal Hocko [mailto:[email protected]] On Behalf Of Michal Hocko
Sent: Tuesday, November 06, 2012 4:06 AM
To: KY Srinivasan
Cc: Andrew Morton; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; Hiroyuki Kamezawa; Johannes Weiner; Ying Han
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 2 lines · KY Srinivasan
Quoted 29 lines
Quoted 5 lines
Quoted 5 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Monday, November 05, 2012 4:45 PM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected];Quoted 23 lines
Quoted 23 lines
[email protected]; [email protected]; [email protected]; Hiroyuki Kamezawa; Michal Hocko; Johannes Weiner; Ying Han
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 6 lines · On Sat, 3 Nov 2012 14:09:38 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 6 lines
Quoted 5 lines
Ok, but you're going to have to get the -mm developers to agree that this is ok before I can accept it.
Quoted 8 lines
Quoted 1 line
Well I guess it won't kill us.
Andrew,
I presumed this was an Ack from you with regards to exporting the symbol. Looks like Greg is waiting to hear from you before he can check these patches in. Could you provide an explicit Ack.
Well, I do have some qualms about exporting
vm_committed_astomodules.
Quoted 33 lines
Quoted 4 lines
Quoted 4 lines
vm_committed_asis a global thing and only really makes sense in a non-containerised system. If the application is running within a memory cgroup thenvm_enough_memory()and the global overcommitpolicy
Quoted 27 lines
Quoted 11 lines
are at best irrelevant and misleading.
If use of
vm_committed_asis indeed a bad thing, then exporting it to modules might increase the amount of badness in the kernel.I don't think these qualms are serious enough to stand in the way of this patch, but I'd be interested in hearing the memcg developers' thoughts on the matter?
Quoted 4 lines
Perhaps you could provide a detailed description of why your module actually needs this? Precisely what information is it looking for and why? If we know that then perhaps a more comfortable alternative can be found.
The Hyper-V host has a policy engine for managing available physical memory across competing virtual machines. This policy decision is based on a number of parameters including the memory pressure reported by the guest. Currently, the pressure calculation is based on the memory commitment made by the guest. From what I can tell, the ratio of currently allocated physical memory to the current memory commitment made by the guest (
vm_committed_as) is used as one of the parameters in making the memory balancing decision on the host. This is what Windows guests report to the host. So, I need some measure of memory commitments made by the Linux guest. This is the reason I want exportvm_committed_as.
Quoted 6 lines
Quoted 3 lines
So IIUC it will be guest who reports the value and the guest runs in the ring-0 so it is not in any user process context, right?
If this is correct then memcg doesn't play any role here.Thanks Michal. Yes, the kernel driver reports this metric to the host. Andrew, let me know how I should proceed here.
Ping.
Regards,
K. Y
Quoted 4 lines
Thanks,
K. Y
--
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>
RE: [PATCH 1/2] mm: Export vm_committed_as
Quoted 5 lines · KY Srinivasan
Quoted 2 lines
Thanks Michal. Yes, the kernel driver reports this metric to the host. Andrew, let me know how I should proceed here.
Ping.
Could you respond to my email in this thread?
--
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>
RE: [PATCH 1/2] mm: Export vm_committed_as
In reply to David RientjesQuoted 31 lines
-----Original Message-----
From: David Rientjes [mailto:[email protected]]
Sent: Monday, November 05, 2012 5:33 PM
To: KY Srinivasan
Cc: Andrew Morton; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; Hiroyuki Kamezawa; Michal Hocko; Johannes Weiner; Ying Han
Subject: RE: [PATCH 1/2] mm: Exportvm_committed_asQuoted 1 line · KY Srinivasan
The Hyper-V host has a policy engine for managing available physical memory
across
Quoted 1 line
competing virtual machines. This policy decision is based on a number of
parameters
Quoted 1 line
including the memory pressure reported by the guest. Currently, the pressure
calculation is
Quoted 1 line
based on the memory commitment made by the guest. From what I can tell,
the ratio of
Quoted 1 line
currently allocated physical memory to the current memory commitment made
by the guest
Quoted 1 line
(
vm_committed_as) is used as one of the parameters in making the memorybalancing decision on
Quoted 1 line
the host. This is what Windows guests report to the host. So, I need some
measure of memory
Quoted 1 line
commitments made by the Linux guest. This is the reason I want export
vm_committed_as.Quoted 1 line
Quoted 6 lines
I don't think you should export the symbol itself to modules but rather a helper function that returns s64 that just wraps
percpu_counter_read_positive()which your driver could use instead.(And why
percpu_counter_read_positive()returns a signed type is a mystery.)
Yes, this makes sense. I just want to access (read) this metric. Andrew, if you are willing to take this patch, I could send one.
Regards,
K. Y
--
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>
Andrew Morton
maintainerRe: [PATCH 1/2] mm: Export vm_committed_as
Quoted 35 lines · On Thu, 8 Nov 2012 22:01:33 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 35 lines
-----Original Message-----
From: David Rientjes [mailto:[email protected]]
Sent: Monday, November 05, 2012 5:33 PM
To: KY Srinivasan
Cc: Andrew Morton; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; Hiroyuki Kamezawa; Michal Hocko; Johannes Weiner; Ying Han
Subject: RE: [PATCH 1/2] mm: Exportvm_committed_asQuoted 1 line · KY Srinivasan
The Hyper-V host has a policy engine for managing available physical memory
across
Quoted 1 line
competing virtual machines. This policy decision is based on a number of
parameters
Quoted 1 line
including the memory pressure reported by the guest. Currently, the pressure
calculation is
Quoted 1 line
based on the memory commitment made by the guest. From what I can tell,
the ratio of
Quoted 1 line
currently allocated physical memory to the current memory commitment made
by the guest
Quoted 1 line
(
vm_committed_as) is used as one of the parameters in making the memorybalancing decision on
Quoted 1 line
the host. This is what Windows guests report to the host. So, I need some
measure of memory
Quoted 1 line
commitments made by the Linux guest. This is the reason I want export
vm_committed_as.Quoted 1 line
I don't think you should export the symbol itself to modules but rather a helper function that returns s64 that just wraps
percpu_counter_read_positive()which your driver could use instead.
Quoted 5 lines
Quoted 2 lines
(And why
percpu_counter_read_positive()returns a signed type is a mystery.)Yes, this makes sense. I just want to access (read) this metric. Andrew, if you are willing to take this patch, I could send one.
Sure. I suppose that's better, although any module which modifies committed_as would never pass review (rofl).
--
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>
RE: [PATCH 1/2] mm: Export vm_committed_as
Quoted 59 lines
-----Original Message-----
From: Andrew Morton [mailto:[email protected]]
Sent: Thursday, November 08, 2012 5:05 PM
To: KY Srinivasan
Cc: David Rientjes; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; linux- [email protected]; Hiroyuki Kamezawa; Michal Hocko; Johannes Weiner; Ying Han
Subject: Re: [PATCH 1/2] mm: Exportvm_committed_asQuoted 8 lines · On Thu, 8 Nov 2012 22:01:33 +0000 KY Srinivasan <[email protected]> wrote:
Quoted 8 lines
-----Original Message-----
From: David Rientjes [mailto:[email protected]]
Sent: Monday, November 05, 2012 5:33 PM
To: KY Srinivasan
Cc: Andrew Morton; Greg KH; [email protected]; [email protected]; [email protected]; [email protected]; [email protected];linux-
Quoted 1 line
Quoted 1 line
[email protected]; Hiroyuki Kamezawa; Michal Hocko; Johannes Weiner; Ying
Han
Quoted 5 lines
Quoted 5 lines
Subject: RE: [PATCH 1/2] mm: Export
vm_committed_asQuoted 1 line · KY Srinivasan
The Hyper-V host has a policy engine for managing available physical
memory
Quoted 4 lines
Quoted 4 lines
across
Quoted 1 line
competing virtual machines. This policy decision is based on a number of
parameters
Quoted 1 line
including the memory pressure reported by the guest. Currently, the
pressure
Quoted 2 lines
Quoted 2 lines
calculation is
Quoted 1 line
based on the memory commitment made by the guest. From what I can
tell,
Quoted 2 lines
Quoted 2 lines
the ratio of
Quoted 1 line
currently allocated physical memory to the current memory commitment
made
Quoted 2 lines
Quoted 2 lines
by the guest
Quoted 1 line
(
vm_committed_as) is used as one of the parameters in making thememory
Quoted 14 lines
Quoted 13 lines
balancing decision on
Quoted 1 line
the host. This is what Windows guests report to the host. So, I need some
measure of memory
Quoted 1 line
commitments made by the Linux guest. This is the reason I want export
vm_committed_as.Quoted 1 line
I don't think you should export the symbol itself to modules but rather a helper function that returns s64 that just wraps
percpu_counter_read_positive()which your driver could use instead.(And why
percpu_counter_read_positive()returns a signed type is a mystery.)
Quoted 6 lines
Quoted 1 line
Yes, this makes sense. I just want to access (read) this metric. Andrew, if you
are willing to
Quoted 1 line
take this patch, I could send one.
Sure. I suppose that's better, although any module which modifies
committed_aswould never pass review (rofl).
Thanks Andrew; I will send the patch out along with the appropriately modified balloon driver patch.
Regards,
K. Y
Quoted 2 lines
--
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>
Re: [PATCH 1/2] mm: Export vm_committed_as
In reply to Andrew MortonQuoted 4 lines · Andrew Morton
Quoted 4 lines
Quoted 4 lines
I don't think you should export the symbol itself to modules but rather a helper function that returns s64 that just wraps
percpu_counter_read_positive()which your driver could use instead.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
(And why
percpu_counter_read_positive()returns a signed type is a mystery.)Yes, this makes sense. I just want to access (read) this metric. Andrew, if you are willing to take this patch, I could send one.
Sure. I suppose that's better, although any module which modifies
committed_aswould never pass review (rofl).
I was thinking of a function that all hypervisors can use (since xen also uses it) that can be well documented and maintain the semantics that they expect, whether that relines on vm_commited_as in the future or not.
--
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>
Andrew Morton
maintainerRe: [PATCH 1/2] mm: Export vm_committed_as
Quoted 12 lines · On Thu, 8 Nov 2012 14:14:35 -0800 (PST) David Rientjes <[email protected]>…
Quoted 10 lines · Andrew Morton
Quoted 9 lines
Quoted 6 lines
I don't think you should export the symbol itself to modules but rather a helper function that returns s64 that just wraps
percpu_counter_read_positive()which your driver could use instead.(And why
percpu_counter_read_positive()returns a signed type is a mystery.)Yes, this makes sense. I just want to access (read) this metric. Andrew, if you are willing to take this patch, I could send one.
Quoted 7 lines
Quoted 3 lines
Sure. I suppose that's better, although any module which modifies
committed_aswould never pass review (rofl).I was thinking of a function that all hypervisors can use (since xen also uses it) that can be well documented and maintain the semantics that they expect, whether that relines on
vm_commited_asin the future or not.
Yes, it would be nice to have some central site where people can go to understand what's happening here.
It's still unclear to me that committed_as is telling the hypervisors precisely what they want to know.
--
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>