* [PATCH] xen: actually release memory when shrinking domain
@ 2009-01-22 22:36 Jeremy Fitzhardinge
2009-01-22 22:42 ` Ingo Molnar
2009-01-23 14:09 ` [Xen-devel] " Ian Campbell
0 siblings, 2 replies; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2009-01-22 22:36 UTC (permalink / raw)
To: Ingo Molnar
Cc: dan.magenheimer@oracle.com, Linux Kernel Mailing List, Xen-devel,
Stable Kernel
From: Dan Magenheimer <dan.magenheimer@oracle.com>
Fix this:
> It appears that in the upstream balloon driver,
> > the call to HYPERVISOR_update_va_mapping is missing
> > from decrease_reservation. I think as a result,
> > the balloon driver is eating memory but not
> > releasing it to Xen, thus rendering the balloon
> > driver essentially useless. (Can be observed via xentop.)
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
drivers/xen/balloon.c | 5 +++++
1 file changed, 5 insertions(+)
===================================================================
--- linux-2.6.28/drivers/xen/balloon.c.orig
+++ linux-2.6.28/drivers/xen/balloon.c
@@ -296,6 +296,11 @@
frame_list[i] = pfn_to_mfn(pfn);
scrub_page(page);
+
+ ret = HYPERVISOR_update_va_mapping(
+ (unsigned long)__va(pfn << PAGE_SHIFT),
+ __pte_ma(0), 0);
+ BUG_ON(ret);
}
/* Ensure that ballooned highmem pages don't have kmaps. */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xen: actually release memory when shrinking domain
2009-01-22 22:36 [PATCH] xen: actually release memory when shrinking domain Jeremy Fitzhardinge
@ 2009-01-22 22:42 ` Ingo Molnar
2009-01-23 14:09 ` [Xen-devel] " Ian Campbell
1 sibling, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2009-01-22 22:42 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: dan.magenheimer@oracle.com, Linux Kernel Mailing List, Xen-devel,
Stable Kernel
* Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> From: Dan Magenheimer <dan.magenheimer@oracle.com>
>
> Fix this:
>
>> It appears that in the upstream balloon driver,
>> > the call to HYPERVISOR_update_va_mapping is missing
>> > from decrease_reservation. I think as a result,
>> > the balloon driver is eating memory but not
>> > releasing it to Xen, thus rendering the balloon
>> > driver essentially useless. (Can be observed via xentop.)
>
> Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> ---
> drivers/xen/balloon.c | 5 +++++
> 1 file changed, 5 insertions(+)
applied to tip/x86/urgent, thanks!
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xen-devel] [PATCH] xen: actually release memory when shrinking domain
2009-01-22 22:36 [PATCH] xen: actually release memory when shrinking domain Jeremy Fitzhardinge
2009-01-22 22:42 ` Ingo Molnar
@ 2009-01-23 14:09 ` Ian Campbell
2009-01-23 16:16 ` Jeremy Fitzhardinge
1 sibling, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2009-01-23 14:09 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: Ingo Molnar, dan.magenheimer@oracle.com, Xen-devel,
Linux Kernel Mailing List, Stable Kernel
On Thu, 2009-01-22 at 14:36 -0800, Jeremy Fitzhardinge wrote:
> From: Dan Magenheimer <dan.magenheimer@oracle.com>
>
> Fix this:
>
> > It appears that in the upstream balloon driver,
> > > the call to HYPERVISOR_update_va_mapping is missing
> > > from decrease_reservation. I think as a result,
> > > the balloon driver is eating memory but not
> > > releasing it to Xen, thus rendering the balloon
> > > driver essentially useless. (Can be observed via xentop.)
Fails on 32 bit with HighMem pages:
kernel BUG at /local/scratch/ianc/devel/kernels/paravirt/drivers/xen/balloon.c:298!
invalid opcode: 0000 [#1] SMP
last sysfs file: /sys/devices/system/xen_memory/xen_memory0/info/current_kb
Modules linked in:
Pid: 9, comm: events/0 Tainted: G W (2.6.29-rc1-x86_32p-xen0-tip #726)
EIP: 0061:[<c0266c57>] EFLAGS: 00010282 CPU: 0
EIP is at balloon_process+0x527/0x530
EAX: ffffffea EBX: deadbeef ECX: deadbeef EDX: deadbeef
ESI: deadbeef EDI: c1000000 EBP: 00000000 ESP: f64b5f44
DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0069
Process events/0 (pid: 9, ti=f64b4000 task=f642d830 task.ti=f64b4000)
Stack:
00000000 ffffa0c0 0000002e 00000192 0000019d 00000000 00000400 f6427a00
00000000 00000000 00000000 00000000 00007ff0 c04afcb0 f6427a00 c04afcac
c0266730 c0143cf1 c0106bc2 f6427a0c c0107810 f642020c f6427a04 f6427a0c
Call Trace:
[<c0266730>] balloon_process+0x0/0x530
[<c0143cf1>] run_workqueue+0x91/0x140
[<c0106bc2>] check_events+0x8/0x16
[<c0107810>] xen_spin_unlock+0x0/0x50
[<c01473e0>] autoremove_wake_function+0x0/0x50
[<c0144718>] worker_thread+0x98/0xf0
[<c01473e0>] autoremove_wake_function+0x0/0x50
[<c0144680>] worker_thread+0x0/0xf0
[<c01470c2>] kthread+0x42/0x70
[<c0147080>] kthread+0x0/0x70
[<c010a5f3>] kernel_thread_helper+0x7/0x10
Code: 00 00 00 00 e8 9b a1 f0 ff 31 f6 e8 e4 2f eb ff b8 e0 7b 54 c0 e8 1a 90 16 00 8b 6c 24 18 89 44 24 14 89 74 24 10 e9 eb fe ff ff <0f> 0b eb fe 90 8d 74 26 00 83 ec 04 b8 20 fc 4a c0 e8 13 dc ff
EIP: [<c0266c57>] balloon_process+0x527/0x530 SS:ESP 0069:f64b5f44
---[ end trace 4eaa2a86a8e2da28 ]---
diff -r b64a63f076cd drivers/xen/balloon.c
--- a/drivers/xen/balloon.c Fri Jan 23 13:29:48 2009 +0000
+++ b/drivers/xen/balloon.c Fri Jan 23 14:09:08 2009 +0000
@@ -292,10 +292,13 @@
scrub_page(page);
- ret = HYPERVISOR_update_va_mapping(
- (unsigned long)__va(pfn << PAGE_SHIFT),
- __pte_ma(0), 0);
- BUG_ON(ret);
+ if (!PageHighMem(page)) {
+ ret = HYPERVISOR_update_va_mapping(
+ (unsigned long)__va(pfn << PAGE_SHIFT),
+ __pte_ma(0), 0);
+ BUG_ON(ret);
+ }
+
}
/* Ensure that ballooned highmem pages don't have kmaps. */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xen-devel] [PATCH] xen: actually release memory when shrinking domain
2009-01-23 14:09 ` [Xen-devel] " Ian Campbell
@ 2009-01-23 16:16 ` Jeremy Fitzhardinge
0 siblings, 0 replies; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2009-01-23 16:16 UTC (permalink / raw)
To: Ian Campbell
Cc: Ingo Molnar, dan.magenheimer@oracle.com, Xen-devel,
Linux Kernel Mailing List, Stable Kernel
Ian Campbell wrote:
> On Thu, 2009-01-22 at 14:36 -0800, Jeremy Fitzhardinge wrote:
>
>> From: Dan Magenheimer <dan.magenheimer@oracle.com>
>>
>> Fix this:
>>
>>
>>> It appears that in the upstream balloon driver,
>>>
>>>> the call to HYPERVISOR_update_va_mapping is missing
>>>> from decrease_reservation. I think as a result,
>>>> the balloon driver is eating memory but not
>>>> releasing it to Xen, thus rendering the balloon
>>>> driver essentially useless. (Can be observed via xentop.)
>>>>
>
> Fails on 32 bit with HighMem pages:
>
> kernel BUG at /local/scratch/ianc/devel/kernels/paravirt/drivers/xen/balloon.c:298!
>
Ah, good point. Could you package this up into a proper patch for Ingo?
Thanks,
J
> invalid opcode: 0000 [#1] SMP
> last sysfs file: /sys/devices/system/xen_memory/xen_memory0/info/current_kb
> Modules linked in:
>
> Pid: 9, comm: events/0 Tainted: G W (2.6.29-rc1-x86_32p-xen0-tip #726)
> EIP: 0061:[<c0266c57>] EFLAGS: 00010282 CPU: 0
> EIP is at balloon_process+0x527/0x530
> EAX: ffffffea EBX: deadbeef ECX: deadbeef EDX: deadbeef
> ESI: deadbeef EDI: c1000000 EBP: 00000000 ESP: f64b5f44
> DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0069
> Process events/0 (pid: 9, ti=f64b4000 task=f642d830 task.ti=f64b4000)
> Stack:
> 00000000 ffffa0c0 0000002e 00000192 0000019d 00000000 00000400 f6427a00
> 00000000 00000000 00000000 00000000 00007ff0 c04afcb0 f6427a00 c04afcac
> c0266730 c0143cf1 c0106bc2 f6427a0c c0107810 f642020c f6427a04 f6427a0c
> Call Trace:
> [<c0266730>] balloon_process+0x0/0x530
> [<c0143cf1>] run_workqueue+0x91/0x140
> [<c0106bc2>] check_events+0x8/0x16
> [<c0107810>] xen_spin_unlock+0x0/0x50
> [<c01473e0>] autoremove_wake_function+0x0/0x50
> [<c0144718>] worker_thread+0x98/0xf0
> [<c01473e0>] autoremove_wake_function+0x0/0x50
> [<c0144680>] worker_thread+0x0/0xf0
> [<c01470c2>] kthread+0x42/0x70
> [<c0147080>] kthread+0x0/0x70
> [<c010a5f3>] kernel_thread_helper+0x7/0x10
> Code: 00 00 00 00 e8 9b a1 f0 ff 31 f6 e8 e4 2f eb ff b8 e0 7b 54 c0 e8 1a 90 16 00 8b 6c 24 18 89 44 24 14 89 74 24 10 e9 eb fe ff ff <0f> 0b eb fe 90 8d 74 26 00 83 ec 04 b8 20 fc 4a c0 e8 13 dc ff
> EIP: [<c0266c57>] balloon_process+0x527/0x530 SS:ESP 0069:f64b5f44
> ---[ end trace 4eaa2a86a8e2da28 ]---
>
> diff -r b64a63f076cd drivers/xen/balloon.c
> --- a/drivers/xen/balloon.c Fri Jan 23 13:29:48 2009 +0000
> +++ b/drivers/xen/balloon.c Fri Jan 23 14:09:08 2009 +0000
> @@ -292,10 +292,13 @@
>
> scrub_page(page);
>
> - ret = HYPERVISOR_update_va_mapping(
> - (unsigned long)__va(pfn << PAGE_SHIFT),
> - __pte_ma(0), 0);
> - BUG_ON(ret);
> + if (!PageHighMem(page)) {
> + ret = HYPERVISOR_update_va_mapping(
> + (unsigned long)__va(pfn << PAGE_SHIFT),
> + __pte_ma(0), 0);
> + BUG_ON(ret);
> + }
> +
> }
>
> /* Ensure that ballooned highmem pages don't have kmaps. */
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-01-23 16:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-22 22:36 [PATCH] xen: actually release memory when shrinking domain Jeremy Fitzhardinge
2009-01-22 22:42 ` Ingo Molnar
2009-01-23 14:09 ` [Xen-devel] " Ian Campbell
2009-01-23 16:16 ` Jeremy Fitzhardinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox