annotate Documentation/SubmittingDrivers @ 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
rev   line source
ian@0 1 Submitting Drivers For The Linux Kernel
ian@0 2 ---------------------------------------
ian@0 3
ian@0 4 This document is intended to explain how to submit device drivers to the
ian@0 5 various kernel trees. Note that if you are interested in video card drivers
ian@0 6 you should probably talk to XFree86 (http://www.xfree86.org/) and/or X.Org
ian@0 7 (http://x.org/) instead.
ian@0 8
ian@0 9 Also read the Documentation/SubmittingPatches document.
ian@0 10
ian@0 11
ian@0 12 Allocating Device Numbers
ian@0 13 -------------------------
ian@0 14
ian@0 15 Major and minor numbers for block and character devices are allocated
ian@0 16 by the Linux assigned name and number authority (currently this is
ian@0 17 Torben Mathiasen). The site is http://www.lanana.org/. This
ian@0 18 also deals with allocating numbers for devices that are not going to
ian@0 19 be submitted to the mainstream kernel.
ian@0 20 See Documentation/devices.txt for more information on this.
ian@0 21
ian@0 22 If you don't use assigned numbers then when your device is submitted it will
ian@0 23 be given an assigned number even if that is different from values you may
ian@0 24 have shipped to customers before.
ian@0 25
ian@0 26 Who To Submit Drivers To
ian@0 27 ------------------------
ian@0 28
ian@0 29 Linux 2.0:
ian@0 30 No new drivers are accepted for this kernel tree.
ian@0 31
ian@0 32 Linux 2.2:
ian@0 33 No new drivers are accepted for this kernel tree.
ian@0 34
ian@0 35 Linux 2.4:
ian@0 36 If the code area has a general maintainer then please submit it to
ian@0 37 the maintainer listed in MAINTAINERS in the kernel file. If the
ian@0 38 maintainer does not respond or you cannot find the appropriate
ian@0 39 maintainer then please contact Marcelo Tosatti
ian@0 40 <marcelo.tosatti@cyclades.com>.
ian@0 41
ian@0 42 Linux 2.6:
ian@0 43 The same rules apply as 2.4 except that you should follow linux-kernel
ian@0 44 to track changes in API's. The final contact point for Linux 2.6
ian@0 45 submissions is Andrew Morton <akpm@osdl.org>.
ian@0 46
ian@0 47 What Criteria Determine Acceptance
ian@0 48 ----------------------------------
ian@0 49
ian@0 50 Licensing: The code must be released to us under the
ian@0 51 GNU General Public License. We don't insist on any kind
ian@0 52 of exclusive GPL licensing, and if you wish the driver
ian@0 53 to be useful to other communities such as BSD you may well
ian@0 54 wish to release under multiple licenses.
ian@0 55 See accepted licenses at include/linux/module.h
ian@0 56
ian@0 57 Copyright: The copyright owner must agree to use of GPL.
ian@0 58 It's best if the submitter and copyright owner
ian@0 59 are the same person/entity. If not, the name of
ian@0 60 the person/entity authorizing use of GPL should be
ian@0 61 listed in case it's necessary to verify the will of
ian@0 62 the copright owner.
ian@0 63
ian@0 64 Interfaces: If your driver uses existing interfaces and behaves like
ian@0 65 other drivers in the same class it will be much more likely
ian@0 66 to be accepted than if it invents gratuitous new ones.
ian@0 67 If you need to implement a common API over Linux and NT
ian@0 68 drivers do it in userspace.
ian@0 69
ian@0 70 Code: Please use the Linux style of code formatting as documented
ian@0 71 in Documentation/CodingStyle. If you have sections of code
ian@0 72 that need to be in other formats, for example because they
ian@0 73 are shared with a windows driver kit and you want to
ian@0 74 maintain them just once separate them out nicely and note
ian@0 75 this fact.
ian@0 76
ian@0 77 Portability: Pointers are not always 32bits, not all computers are little
ian@0 78 endian, people do not all have floating point and you
ian@0 79 shouldn't use inline x86 assembler in your driver without
ian@0 80 careful thought. Pure x86 drivers generally are not popular.
ian@0 81 If you only have x86 hardware it is hard to test portability
ian@0 82 but it is easy to make sure the code can easily be made
ian@0 83 portable.
ian@0 84
ian@0 85 Clarity: It helps if anyone can see how to fix the driver. It helps
ian@0 86 you because you get patches not bug reports. If you submit a
ian@0 87 driver that intentionally obfuscates how the hardware works
ian@0 88 it will go in the bitbucket.
ian@0 89
ian@0 90 Control: In general if there is active maintainance of a driver by
ian@0 91 the author then patches will be redirected to them unless
ian@0 92 they are totally obvious and without need of checking.
ian@0 93 If you want to be the contact and update point for the
ian@0 94 driver it is a good idea to state this in the comments,
ian@0 95 and include an entry in MAINTAINERS for your driver.
ian@0 96
ian@0 97 What Criteria Do Not Determine Acceptance
ian@0 98 -----------------------------------------
ian@0 99
ian@0 100 Vendor: Being the hardware vendor and maintaining the driver is
ian@0 101 often a good thing. If there is a stable working driver from
ian@0 102 other people already in the tree don't expect 'we are the
ian@0 103 vendor' to get your driver chosen. Ideally work with the
ian@0 104 existing driver author to build a single perfect driver.
ian@0 105
ian@0 106 Author: It doesn't matter if a large Linux company wrote the driver,
ian@0 107 or you did. Nobody has any special access to the kernel
ian@0 108 tree. Anyone who tells you otherwise isn't telling the
ian@0 109 whole story.
ian@0 110
ian@0 111
ian@0 112 Resources
ian@0 113 ---------
ian@0 114
ian@0 115 Linux kernel master tree:
ian@0 116 ftp.??.kernel.org:/pub/linux/kernel/...
ian@0 117 ?? == your country code, such as "us", "uk", "fr", etc.
ian@0 118
ian@0 119 Linux kernel mailing list:
ian@0 120 linux-kernel@vger.kernel.org
ian@0 121 [mail majordomo@vger.kernel.org to subscribe]
ian@0 122
ian@0 123 Linux Device Drivers, Third Edition (covers 2.6.10):
ian@0 124 http://lwn.net/Kernel/LDD3/ (free version)
ian@0 125
ian@0 126 Kernel traffic:
ian@0 127 Weekly summary of kernel list activity (much easier to read)
ian@0 128 http://www.kerneltraffic.org/kernel-traffic/
ian@0 129
ian@0 130 LWN.net:
ian@0 131 Weekly summary of kernel development activity - http://lwn.net/
ian@0 132 2.6 API changes:
ian@0 133 http://lwn.net/Articles/2.6-kernel-api/
ian@0 134 Porting drivers from prior kernels to 2.6:
ian@0 135 http://lwn.net/Articles/driver-porting/
ian@0 136
ian@0 137 KernelTrap:
ian@0 138 Occasional Linux kernel articles and developer interviews
ian@0 139 http://kerneltrap.org/
ian@0 140
ian@0 141 KernelNewbies:
ian@0 142 Documentation and assistance for new kernel programmers
ian@0 143 http://kernelnewbies.org/
ian@0 144
ian@0 145 Linux USB project:
ian@0 146 http://www.linux-usb.org/
ian@0 147
ian@0 148 How to NOT write kernel driver by arjanv@redhat.com
ian@0 149 http://people.redhat.com/arjanv/olspaper.pdf
ian@0 150
ian@0 151 Kernel Janitor:
ian@0 152 http://janitor.kernelnewbies.org/
ian@0 153
ian@0 154 --
ian@0 155 Last updated on 17 Nov 2005.