ia64/linux-2.6.18-xen.hg

view drivers/md/dm-hw-handler.h @ 897:329ea0ccb344

balloon: try harder to balloon up under memory pressure.

Currently if the balloon driver is unable to increase the guest's
reservation it assumes the failure was due to reaching its full
allocation, gives up on the ballooning operation and records the limit
it reached as the "hard limit". The driver will not try again until
the target is set again (even to the same value).

However it is possible that ballooning has in fact failed due to
memory pressure in the host and therefore it is desirable to keep
attempting to reach the target in case memory becomes available. The
most likely scenario is that some guests are ballooning down while
others are ballooning up and therefore there is temporary memory
pressure while things stabilise. You would not expect a well behaved
toolstack to ask a domain to balloon to more than its allocation nor
would you expect it to deliberately over-commit memory by setting
balloon targets which exceed the total host memory.

This patch drops the concept of a hard limit and causes the balloon
driver to retry increasing the reservation on a timer in the same
manner as when decreasing the reservation.

Also if we partially succeed in increasing the reservation
(i.e. receive less pages than we asked for) then we may as well keep
those pages rather than returning them to Xen.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 05 14:01:20 2009 +0100 (2009-06-05)
parents 831230e53067
children
line source
1 /*
2 * Copyright (C) 2004 Red Hat, Inc. All rights reserved.
3 *
4 * This file is released under the GPL.
5 *
6 * Multipath hardware handler registration.
7 */
9 #ifndef DM_HW_HANDLER_H
10 #define DM_HW_HANDLER_H
12 #include <linux/device-mapper.h>
14 #include "dm-mpath.h"
16 struct hw_handler_type;
17 struct hw_handler {
18 struct hw_handler_type *type;
19 void *context;
20 };
22 /*
23 * Constructs a hardware handler object, takes custom arguments
24 */
25 /* Information about a hardware handler type */
26 struct hw_handler_type {
27 char *name;
28 struct module *module;
30 int (*create) (struct hw_handler *handler, unsigned int argc,
31 char **argv);
32 void (*destroy) (struct hw_handler *hwh);
34 void (*pg_init) (struct hw_handler *hwh, unsigned bypassed,
35 struct path *path);
36 unsigned (*error) (struct hw_handler *hwh, struct bio *bio);
37 int (*status) (struct hw_handler *hwh, status_type_t type,
38 char *result, unsigned int maxlen);
39 };
41 /* Register a hardware handler */
42 int dm_register_hw_handler(struct hw_handler_type *type);
44 /* Unregister a hardware handler */
45 int dm_unregister_hw_handler(struct hw_handler_type *type);
47 /* Returns a registered hardware handler type */
48 struct hw_handler_type *dm_get_hw_handler(const char *name);
50 /* Releases a hardware handler */
51 void dm_put_hw_handler(struct hw_handler_type *hwht);
53 /* Default err function */
54 unsigned dm_scsi_err_handler(struct hw_handler *hwh, struct bio *bio);
56 /* Error flags for err and dm_pg_init_complete */
57 #define MP_FAIL_PATH 1
58 #define MP_BYPASS_PG 2
59 #define MP_ERROR_IO 4 /* Don't retry this I/O */
61 #endif