| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: balloon.c,v 1.4 2010/07/10 11:20:48 cherry Exp $ */ | | 1 | /* $NetBSD: balloon.c,v 1.5 2010/08/11 11:32:58 pgoyette 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 |
| @@ -45,27 +45,27 @@ | | | @@ -45,27 +45,27 @@ |
45 | * xen.balloon.low-balloon: In Progress | | 45 | * xen.balloon.low-balloon: In Progress |
46 | * xen.balloon.high-balloon: In Progress | | 46 | * xen.balloon.high-balloon: In Progress |
47 | * xen.balloon.limit: XXX | | 47 | * xen.balloon.limit: XXX |
48 | * | | 48 | * |
49 | * sysctl labels = { 'current' : 'Current allocation', | | 49 | * sysctl labels = { 'current' : 'Current allocation', |
50 | * 'target' : 'Requested target', | | 50 | * 'target' : 'Requested target', |
51 | * 'low-balloon' : 'Low-mem balloon', | | 51 | * 'low-balloon' : 'Low-mem balloon', |
52 | * 'high-balloon' : 'High-mem balloon', | | 52 | * 'high-balloon' : 'High-mem balloon', |
53 | * 'limit' : 'Xen hard limit' } | | 53 | * 'limit' : 'Xen hard limit' } |
54 | * | | 54 | * |
55 | */ | | 55 | */ |
56 | | | 56 | |
57 | #include <sys/cdefs.h> | | 57 | #include <sys/cdefs.h> |
58 | __KERNEL_RCSID(0, "$NetBSD: balloon.c,v 1.4 2010/07/10 11:20:48 cherry Exp $"); | | 58 | __KERNEL_RCSID(0, "$NetBSD: balloon.c,v 1.5 2010/08/11 11:32:58 pgoyette Exp $"); |
59 | | | 59 | |
60 | #include <sys/inttypes.h> | | 60 | #include <sys/inttypes.h> |
61 | #include <sys/param.h> | | 61 | #include <sys/param.h> |
62 | | | 62 | |
63 | #include <sys/condvar.h> | | 63 | #include <sys/condvar.h> |
64 | #include <sys/kernel.h> | | 64 | #include <sys/kernel.h> |
65 | #include <sys/kmem.h> | | 65 | #include <sys/kmem.h> |
66 | #include <sys/kthread.h> | | 66 | #include <sys/kthread.h> |
67 | #include <sys/mutex.h> | | 67 | #include <sys/mutex.h> |
68 | #include <sys/queue.h> | | 68 | #include <sys/queue.h> |
69 | #include <sys/sysctl.h> | | 69 | #include <sys/sysctl.h> |
70 | | | 70 | |
71 | #include <xen/xen.h> | | 71 | #include <xen/xen.h> |
| @@ -697,27 +697,27 @@ balloon_xenbus_setup(void) | | | @@ -697,27 +697,27 @@ balloon_xenbus_setup(void) |
697 | | | 697 | |
698 | size_t currentpages; | | 698 | size_t currentpages; |
699 | | | 699 | |
700 | /* Allocate list of MFNs for inflating/deflating balloon */ | | 700 | /* Allocate list of MFNs for inflating/deflating balloon */ |
701 | mfn_lista = kmem_alloc(BALLOON_DELTA * sizeof *mfn_lista, KM_NOSLEEP); | | 701 | mfn_lista = kmem_alloc(BALLOON_DELTA * sizeof *mfn_lista, KM_NOSLEEP); |
702 | if (mfn_lista == NULL) { | | 702 | if (mfn_lista == NULL) { |
703 | aprint_error("%s: could not allocate mfn_lista\n", __func__); | | 703 | aprint_error("%s: could not allocate mfn_lista\n", __func__); |
704 | return; | | 704 | return; |
705 | } | | 705 | } |
706 | | | 706 | |
707 | /* Setup flaglocks, condvars et. al */ | | 707 | /* Setup flaglocks, condvars et. al */ |
708 | mutex_init(&balloon_conf.flaglock, MUTEX_DEFAULT, IPL_NONE); | | 708 | mutex_init(&balloon_conf.flaglock, MUTEX_DEFAULT, IPL_NONE); |
709 | mutex_init(&balloon_conf.tgtlock, MUTEX_DEFAULT, IPL_HIGH); | | 709 | mutex_init(&balloon_conf.tgtlock, MUTEX_DEFAULT, IPL_HIGH); |
710 | cv_init(&balloon_conf.cv_memchanged, "ballooning"); | | 710 | cv_init(&balloon_conf.cv_memchanged, "balloon"); |
711 | | | 711 | |
712 | SLIST_INIT(&balloon_conf.balloon_page_entries); | | 712 | SLIST_INIT(&balloon_conf.balloon_page_entries); |
713 | balloon_conf.balloon_num_page_entries = 0; | | 713 | balloon_conf.balloon_num_page_entries = 0; |
714 | | | 714 | |
715 | /* Deliberately not-constified for future extensibility */ | | 715 | /* Deliberately not-constified for future extensibility */ |
716 | balloon_conf.xen_res_min = XEN_RESERVATION_MIN; | | 716 | balloon_conf.xen_res_min = XEN_RESERVATION_MIN; |
717 | balloon_conf.xen_res_max = XEN_RESERVATION_MAX; | | 717 | balloon_conf.xen_res_max = XEN_RESERVATION_MAX; |
718 | | | 718 | |
719 | #if BALLOONDEBUG | | 719 | #if BALLOONDEBUG |
720 | printf("uvmexp.freemin == %d\n", uvmexp.freemin); | | 720 | printf("uvmexp.freemin == %d\n", uvmexp.freemin); |
721 | printf("xen_res_min == %zu\n", balloon_conf.xen_res_min); | | 721 | printf("xen_res_min == %zu\n", balloon_conf.xen_res_min); |
722 | printf("xen_res_max == %zu\n", balloon_conf.xen_res_max); | | 722 | printf("xen_res_max == %zu\n", balloon_conf.xen_res_max); |
723 | #endif | | 723 | #endif |