diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-19 14:41:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-19 14:41:26 -0400 |
commit | b5d72dda8976e878be47415b94bca8465d1fa22d (patch) | |
tree | 67dfaf0120febff148ec18824bf1d08ac9ecf7e5 /drivers/xen/balloon.c | |
parent | 26473f83703e6bc56114ce4b045000de6efcfff7 (diff) | |
parent | a1078e821b605813b63bf6bca414a85f804d5c66 (diff) |
Merge tag 'for-linus-5.3a-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen updates from Juergen Gross:
"Fixes and features:
- A series to introduce a common command line parameter for disabling
paravirtual extensions when running as a guest in virtualized
environment
- A fix for int3 handling in Xen pv guests
- Removal of the Xen-specific tmem driver as support of tmem in Xen
has been dropped (and it was experimental only)
- A security fix for running as Xen dom0 (XSA-300)
- A fix for IRQ handling when offlining cpus in Xen guests
- Some small cleanups"
* tag 'for-linus-5.3a-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
xen: let alloc_xenballooned_pages() fail if not enough memory free
xen/pv: Fix a boot up hang revealed by int3 self test
x86/xen: Add "nopv" support for HVM guest
x86/paravirt: Remove const mark from x86_hyper_xen_hvm variable
xen: Map "xen_nopv" parameter to "nopv" and mark it obsolete
x86: Add "nopv" parameter to disable PV extensions
x86/xen: Mark xen_hvm_need_lapic() and xen_x2apic_para_available() as __init
xen: remove tmem driver
Revert "x86/paravirt: Set up the virt_spin_lock_key after static keys get initialized"
xen/events: fix binding user event channels to cpus
Diffstat (limited to 'drivers/xen/balloon.c')
-rw-r--r-- | drivers/xen/balloon.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 37a36c6b9f93..4e11de6cde81 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -535,8 +535,15 @@ static void balloon_process(struct work_struct *work) | |||
535 | state = reserve_additional_memory(); | 535 | state = reserve_additional_memory(); |
536 | } | 536 | } |
537 | 537 | ||
538 | if (credit < 0) | 538 | if (credit < 0) { |
539 | state = decrease_reservation(-credit, GFP_BALLOON); | 539 | long n_pages; |
540 | |||
541 | n_pages = min(-credit, si_mem_available()); | ||
542 | state = decrease_reservation(n_pages, GFP_BALLOON); | ||
543 | if (state == BP_DONE && n_pages != -credit && | ||
544 | n_pages < totalreserve_pages) | ||
545 | state = BP_EAGAIN; | ||
546 | } | ||
540 | 547 | ||
541 | state = update_schedule(state); | 548 | state = update_schedule(state); |
542 | 549 | ||
@@ -575,6 +582,9 @@ static int add_ballooned_pages(int nr_pages) | |||
575 | } | 582 | } |
576 | } | 583 | } |
577 | 584 | ||
585 | if (si_mem_available() < nr_pages) | ||
586 | return -ENOMEM; | ||
587 | |||
578 | st = decrease_reservation(nr_pages, GFP_USER); | 588 | st = decrease_reservation(nr_pages, GFP_USER); |
579 | if (st != BP_DONE) | 589 | if (st != BP_DONE) |
580 | return -ENOMEM; | 590 | return -ENOMEM; |
@@ -707,7 +717,7 @@ static int __init balloon_init(void) | |||
707 | balloon_stats.schedule_delay = 1; | 717 | balloon_stats.schedule_delay = 1; |
708 | balloon_stats.max_schedule_delay = 32; | 718 | balloon_stats.max_schedule_delay = 32; |
709 | balloon_stats.retry_count = 1; | 719 | balloon_stats.retry_count = 1; |
710 | balloon_stats.max_retry_count = RETRY_UNLIMITED; | 720 | balloon_stats.max_retry_count = 4; |
711 | 721 | ||
712 | #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG | 722 | #ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG |
713 | set_online_page_callback(&xen_online_page); | 723 | set_online_page_callback(&xen_online_page); |