view Documentation/kernel-doc-nano-HOWTO.txt @ 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
line source
1 kernel-doc nano-HOWTO
2 =====================
4 Many places in the source tree have extractable documentation in the
5 form of block comments above functions. The components of this system
6 are:
8 - scripts/kernel-doc
10 This is a perl script that hunts for the block comments and can mark
11 them up directly into DocBook, man, text, and HTML. (No, not
12 texinfo.)
14 - Documentation/DocBook/*.tmpl
16 These are SGML template files, which are normal SGML files with
17 special place-holders for where the extracted documentation should
18 go.
20 - scripts/docproc.c
22 This is a program for converting SGML template files into SGML
23 files. When a file is referenced it is searched for symbols
24 exported (EXPORT_SYMBOL), to be able to distinguish between internal
25 and external functions.
26 It invokes kernel-doc, giving it the list of functions that
27 are to be documented.
28 Additionally it is used to scan the SGML template files to locate
29 all the files referenced herein. This is used to generate dependency
30 information as used by make.
32 - Makefile
34 The targets 'sgmldocs', 'psdocs', 'pdfdocs', and 'htmldocs' are used
35 to build DocBook files, PostScript files, PDF files, and html files
36 in Documentation/DocBook.
38 - Documentation/DocBook/Makefile
40 This is where C files are associated with SGML templates.
43 How to extract the documentation
44 --------------------------------
46 If you just want to read the ready-made books on the various
47 subsystems (see Documentation/DocBook/*.tmpl), just type 'make
48 psdocs', or 'make pdfdocs', or 'make htmldocs', depending on your
49 preference. If you would rather read a different format, you can type
50 'make sgmldocs' and then use DocBook tools to convert
51 Documentation/DocBook/*.sgml to a format of your choice (for example,
52 'db2html ...' if 'make htmldocs' was not defined).
54 If you want to see man pages instead, you can do this:
56 $ cd linux
57 $ scripts/kernel-doc -man $(find -name '*.c') | split-man.pl /tmp/man
58 $ scripts/kernel-doc -man $(find -name '*.h') | split-man.pl /tmp/man
60 Here is split-man.pl:
62 -->
63 #!/usr/bin/perl
65 if ($#ARGV < 0) {
66 die "where do I put the results?\n";
67 }
69 mkdir $ARGV[0],0777;
70 $state = 0;
71 while (<STDIN>) {
72 if (/^\.TH \"[^\"]*\" 4 \"([^\"]*)\"/) {
73 if ($state == 1) { close OUT }
74 $state = 1;
75 $fn = "$ARGV[0]/$1.4";
76 print STDERR "Creating $fn\n";
77 open OUT, ">$fn" or die "can't open $fn: $!\n";
78 print OUT $_;
79 } elsif ($state != 0) {
80 print OUT $_;
81 }
82 }
84 close OUT;
85 <--
87 If you just want to view the documentation for one function in one
88 file, you can do this:
90 $ scripts/kernel-doc -man -function fn file | nroff -man | less
92 or this:
94 $ scripts/kernel-doc -text -function fn file
97 How to add extractable documentation to your source files
98 ---------------------------------------------------------
100 The format of the block comment is like this:
102 /**
103 * function_name(:)? (- short description)?
104 (* @parameterx: (description of parameter x)?)*
105 (* a blank line)?
106 * (Description:)? (Description of function)?
107 * (section header: (section description)? )*
108 (*)?*/
110 The short function description cannot be multiline, but the other
111 descriptions can be (and they can contain blank lines). Avoid putting a
112 spurious blank line after the function name, or else the description will
113 be repeated!
115 All descriptive text is further processed, scanning for the following special
116 patterns, which are highlighted appropriately.
118 'funcname()' - function
119 '$ENVVAR' - environment variable
120 '&struct_name' - name of a structure (up to two words including 'struct')
121 '@parameter' - name of a parameter
122 '%CONST' - name of a constant.
124 Take a look around the source tree for examples.
127 kernel-doc for structs, unions, enums, and typedefs
128 ---------------------------------------------------
130 Beside functions you can also write documentation for structs, unions,
131 enums and typedefs. Instead of the function name you must write the name
132 of the declaration; the struct/union/enum/typedef must always precede
133 the name. Nesting of declarations is not supported.
134 Use the argument mechanism to document members or constants.
136 Inside a struct description, you can use the "private:" and "public:"
137 comment tags. Structure fields that are inside a "private:" area
138 are not listed in the generated output documentation.
140 Example:
142 /**
143 * struct my_struct - short description
144 * @a: first member
145 * @b: second member
146 *
147 * Longer description
148 */
149 struct my_struct {
150 int a;
151 int b;
152 /* private: */
153 int c;
154 };
157 How to make new SGML template files
158 -----------------------------------
160 SGML template files (*.tmpl) are like normal SGML files, except that
161 they can contain escape sequences where extracted documentation should
162 be inserted.
164 !E<filename> is replaced by the documentation, in <filename>, for
165 functions that are exported using EXPORT_SYMBOL: the function list is
166 collected from files listed in Documentation/DocBook/Makefile.
168 !I<filename> is replaced by the documentation for functions that are
169 _not_ exported using EXPORT_SYMBOL.
171 !D<filename> is used to name additional files to search for functions
172 exported using EXPORT_SYMBOL.
174 !F<filename> <function [functions...]> is replaced by the
175 documentation, in <filename>, for the functions listed.
178 Tim.
179 */ <twaugh@redhat.com>