| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: balloon.c,v 1.12 2011/12/26 20:26:38 jym Exp $ */ | | 1 | /* $NetBSD: balloon.c,v 1.13 2012/01/05 18:11:50 jym Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2010 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Cherry G. Mathew <cherry@zyx.in> and | | 8 | * by Cherry G. Mathew <cherry@zyx.in> and |
9 | * Jean-Yves Migeon <jym@NetBSD.org> | | 9 | * Jean-Yves Migeon <jym@NetBSD.org> |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -61,27 +61,27 @@ | | | @@ -61,27 +61,27 @@ |
61 | * XXX Pages used by balloon are tracked through entries stored in a SLIST. | | 61 | * XXX Pages used by balloon are tracked through entries stored in a SLIST. |
62 | * This allows driver to conveniently add/remove wired pages from memory | | 62 | * This allows driver to conveniently add/remove wired pages from memory |
63 | * without the need to support these "memory gaps" inside uvm(9). Still, the | | 63 | * without the need to support these "memory gaps" inside uvm(9). Still, the |
64 | * driver does not currently "plug" new pages into uvm(9) when more memory | | 64 | * driver does not currently "plug" new pages into uvm(9) when more memory |
65 | * is available than originally managed by balloon. For example, deflating | | 65 | * is available than originally managed by balloon. For example, deflating |
66 | * balloon with a total number of pages above physmem is not supported for | | 66 | * balloon with a total number of pages above physmem is not supported for |
67 | * now. See balloon_deflate() for more details. | | 67 | * now. See balloon_deflate() for more details. |
68 | * | | 68 | * |
69 | */ | | 69 | */ |
70 | | | 70 | |
71 | #define BALLOONDEBUG 0 | | 71 | #define BALLOONDEBUG 0 |
72 | | | 72 | |
73 | #include <sys/cdefs.h> | | 73 | #include <sys/cdefs.h> |
74 | __KERNEL_RCSID(0, "$NetBSD: balloon.c,v 1.12 2011/12/26 20:26:38 jym Exp $"); | | 74 | __KERNEL_RCSID(0, "$NetBSD: balloon.c,v 1.13 2012/01/05 18:11:50 jym Exp $"); |
75 | | | 75 | |
76 | #include <sys/inttypes.h> | | 76 | #include <sys/inttypes.h> |
77 | #include <sys/device.h> | | 77 | #include <sys/device.h> |
78 | #include <sys/param.h> | | 78 | #include <sys/param.h> |
79 | | | 79 | |
80 | #include <sys/atomic.h> | | 80 | #include <sys/atomic.h> |
81 | #include <sys/condvar.h> | | 81 | #include <sys/condvar.h> |
82 | #include <sys/kernel.h> | | 82 | #include <sys/kernel.h> |
83 | #include <sys/kmem.h> | | 83 | #include <sys/kmem.h> |
84 | #include <sys/kthread.h> | | 84 | #include <sys/kthread.h> |
85 | #include <sys/mutex.h> | | 85 | #include <sys/mutex.h> |
86 | #include <sys/pool.h> | | 86 | #include <sys/pool.h> |
87 | #include <sys/queue.h> | | 87 | #include <sys/queue.h> |
| @@ -682,27 +682,27 @@ sysctl_kern_xen_balloon_min(SYSCTLFN_ARG | | | @@ -682,27 +682,27 @@ sysctl_kern_xen_balloon_min(SYSCTLFN_ARG |
682 | "cannot set min below minimum safe value (%d)\n", | | 682 | "cannot set min below minimum safe value (%d)\n", |
683 | XEN_RESERVATION_MIN); | | 683 | XEN_RESERVATION_MIN); |
684 | return EPERM; | | 684 | return EPERM; |
685 | } | | 685 | } |
686 | | | 686 | |
687 | mutex_enter(&balloon_sc->balloon_mtx); | | 687 | mutex_enter(&balloon_sc->balloon_mtx); |
688 | if (balloon_sc->balloon_res_min != newval) | | 688 | if (balloon_sc->balloon_res_min != newval) |
689 | balloon_sc->balloon_res_min = newval; | | 689 | balloon_sc->balloon_res_min = newval; |
690 | mutex_exit(&balloon_sc->balloon_mtx); | | 690 | mutex_exit(&balloon_sc->balloon_mtx); |
691 | | | 691 | |
692 | return 0; | | 692 | return 0; |
693 | } | | 693 | } |
694 | | | 694 | |
695 | /* Returns the current memory reservation of the domain */ | | 695 | /* Returns the maximum memory reservation of the domain */ |
696 | static int | | 696 | static int |
697 | sysctl_kern_xen_balloon_max(SYSCTLFN_ARGS) | | 697 | sysctl_kern_xen_balloon_max(SYSCTLFN_ARGS) |
698 | { | | 698 | { |
699 | struct sysctlnode node; | | 699 | struct sysctlnode node; |
700 | u_quad_t node_val; | | 700 | u_quad_t node_val; |
701 | | | 701 | |
702 | node = *rnode; | | 702 | node = *rnode; |
703 | | | 703 | |
704 | node_val = BALLOON_PAGES_TO_KB(xenmem_get_maxreservation()); | | 704 | node_val = BALLOON_PAGES_TO_KB(xenmem_get_maxreservation()); |
705 | node.sysctl_data = &node_val; | | 705 | node.sysctl_data = &node_val; |
706 | return sysctl_lookup(SYSCTLFN_CALL(&node)); | | 706 | return sysctl_lookup(SYSCTLFN_CALL(&node)); |
707 | } | | 707 | } |
708 | | | 708 | |