├── COPYING
├── Kernel
├── README
└── debug-optionally-skip-clearpage-2.6.29-rc8-mmotm-090323.patch
├── Libnuma
└── lts-01-libnuma-fix-numa_num_thread_cpus+nodes.patch
├── Makefile
├── README
├── Scripts
├── README
├── fmt_vmstats
├── pft-multirun
├── pft_lockstats
├── pft_per_node
├── pft_plot.py
├── pft_profile
├── pft_task_thread
├── pft_vmstats
├── rmshm
└── runpft
├── TODO
├── pft.c
└── version.h
/COPYING:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
676 |
--------------------------------------------------------------------------------
/Kernel/README:
--------------------------------------------------------------------------------
1 | Pft Kernel patches:
2 |
3 | Optional kernel patches for certain features of pft_mpol
4 |
--------------------------------------------------------------------------------
/Kernel/debug-optionally-skip-clearpage-2.6.29-rc8-mmotm-090323.patch:
--------------------------------------------------------------------------------
1 | N.B., this patch must not be merged! It opens a big security hole
2 | by mapping unzeroed pages into user space.
3 |
4 | Temp hack to allow the page fault test program to disable __GFP_ZERO
5 | for allocating the test memory [anon, shmem]. This will eliminate
6 | clear_page() which dominates the profiles, exposing more of the
7 | allocator behavior [we hope].
8 |
9 | This version atop 2.6.29-rc8-mmotm-090323-2234
10 |
11 | Signed-off-by: Lee Schermerhorn
12 |
13 | arch/x86/include/asm/page.h | 2 +-
14 | include/linux/mempolicy.h | 3 ++-
15 | include/linux/mm.h | 2 ++
16 | include/linux/pagemap.h | 13 +++++++++++++
17 | mm/mempolicy.c | 19 ++++++++++++++++++-
18 | mm/shmem.c | 3 +++
19 | 6 files changed, 39 insertions(+), 3 deletions(-)
20 |
21 | Index: linux-2.6.29-rc8-mmotm-090323-2234/mm/mempolicy.c
22 | ===================================================================
23 | --- linux-2.6.29-rc8-mmotm-090323-2234.orig/mm/mempolicy.c 2009-04-03 11:20:35.000000000 -0400
24 | +++ linux-2.6.29-rc8-mmotm-090323-2234/mm/mempolicy.c 2009-04-03 11:29:17.000000000 -0400
25 | @@ -926,6 +926,17 @@ static struct page *new_vma_page(struct
26 | }
27 | #endif
28 |
29 | +static void vma_set_no_clear(unsigned long addr)
30 | +{
31 | + struct vm_area_struct *vma = find_vma_intersection(current->mm,
32 | + addr, addr+1);
33 | + if (vma) {
34 | + vma->vm_flags |= VM_NOCLEAR;
35 | + if (vma->vm_file)
36 | + mapping_set_no_clear(vma->vm_file->f_mapping);
37 | + }
38 | +}
39 | +
40 | static long do_mbind(unsigned long start, unsigned long len,
41 | unsigned short mode, unsigned short mode_flags,
42 | nodemask_t *nmask, unsigned long flags)
43 | @@ -937,9 +948,15 @@ static long do_mbind(unsigned long start
44 | int err;
45 | LIST_HEAD(pagelist);
46 |
47 | - if (flags & ~(unsigned long)(MPOL_MF_STRICT |
48 | + if (flags & ~(unsigned long)(MPOL_MF_STRICT | MPOL_MF_NOCLEAR |
49 | MPOL_MF_MOVE | MPOL_MF_MOVE_ALL))
50 | return -EINVAL;
51 | +
52 | + if (flags & MPOL_MF_NOCLEAR) {
53 | + vma_set_no_clear(start);
54 | + return 0;
55 | + }
56 | +
57 | if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_NICE))
58 | return -EPERM;
59 |
60 | Index: linux-2.6.29-rc8-mmotm-090323-2234/mm/shmem.c
61 | ===================================================================
62 | --- linux-2.6.29-rc8-mmotm-090323-2234.orig/mm/shmem.c 2009-04-03 11:20:35.000000000 -0400
63 | +++ linux-2.6.29-rc8-mmotm-090323-2234/mm/shmem.c 2009-04-03 11:32:13.000000000 -0400
64 | @@ -1149,6 +1149,9 @@ static struct page *shmem_alloc_page(gfp
65 | pvma.vm_ops = NULL;
66 | pvma.vm_policy = mpol_shared_policy_lookup(&info->policy, idx);
67 |
68 | + if (mapping_no_clear(info->vfs_inode.i_mapping))
69 | + gfp &= ~__GFP_ZERO;
70 | +
71 | /*
72 | * alloc_page_vma() will drop the shared policy reference
73 | */
74 | Index: linux-2.6.29-rc8-mmotm-090323-2234/include/linux/pagemap.h
75 | ===================================================================
76 | --- linux-2.6.29-rc8-mmotm-090323-2234.orig/include/linux/pagemap.h 2009-04-03 11:20:35.000000000 -0400
77 | +++ linux-2.6.29-rc8-mmotm-090323-2234/include/linux/pagemap.h 2009-04-03 11:21:00.000000000 -0400
78 | @@ -25,8 +25,21 @@ enum mapping_flags {
79 | #ifdef CONFIG_UNEVICTABLE_LRU
80 | AS_UNEVICTABLE = __GFP_BITS_SHIFT + 3, /* e.g., ramdisk, SHM_LOCK */
81 | #endif
82 | + AS_NO_CLEAR = __GFP_BITS_SHIFT + 4, // temp for page fault testing
83 | };
84 |
85 | +static inline void mapping_set_no_clear(struct address_space *mapping)
86 | +{
87 | + set_bit(AS_NO_CLEAR, &mapping->flags);
88 | +}
89 | +
90 | +static inline int mapping_no_clear(struct address_space *mapping)
91 | +{
92 | + if (likely(mapping))
93 | + return test_bit(AS_NO_CLEAR, &mapping->flags);
94 | + return !mapping;
95 | +}
96 | +
97 | static inline void mapping_set_error(struct address_space *mapping, int error)
98 | {
99 | if (unlikely(error)) {
100 | Index: linux-2.6.29-rc8-mmotm-090323-2234/arch/x86/include/asm/page.h
101 | ===================================================================
102 | --- linux-2.6.29-rc8-mmotm-090323-2234.orig/arch/x86/include/asm/page.h 2009-04-03 11:20:35.000000000 -0400
103 | +++ linux-2.6.29-rc8-mmotm-090323-2234/arch/x86/include/asm/page.h 2009-04-03 11:23:13.000000000 -0400
104 | @@ -30,7 +30,7 @@ static inline void copy_user_page(void *
105 | }
106 |
107 | #define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \
108 | - alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr)
109 | + alloc_page_vma(GFP_HIGHUSER | (vma_noclear(vma) ? 0 : __GFP_ZERO) | movableflags, vma, vaddr)
110 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
111 |
112 | #define __pa(x) __phys_addr((unsigned long)(x))
113 | Index: linux-2.6.29-rc8-mmotm-090323-2234/include/linux/mm.h
114 | ===================================================================
115 | --- linux-2.6.29-rc8-mmotm-090323-2234.orig/include/linux/mm.h 2009-04-03 11:15:14.000000000 -0400
116 | +++ linux-2.6.29-rc8-mmotm-090323-2234/include/linux/mm.h 2009-04-03 11:24:03.000000000 -0400
117 | @@ -104,6 +104,8 @@ extern unsigned int kobjsize(const void
118 | #define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
119 | #define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
120 | #define VM_SAO 0x20000000 /* Strong Access Ordering (powerpc) */
121 | +#define VM_NOCLEAR 0x80000000 /* Debug: don't zero/clear pages in this vma */
122 | +#define vma_noclear(VMA) ((VMA)->vm_flags & VM_NOCLEAR)
123 |
124 | #ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
125 | #define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
126 | Index: linux-2.6.29-rc8-mmotm-090323-2234/include/linux/mempolicy.h
127 | ===================================================================
128 | --- linux-2.6.29-rc8-mmotm-090323-2234.orig/include/linux/mempolicy.h 2009-04-03 11:19:46.000000000 -0400
129 | +++ linux-2.6.29-rc8-mmotm-090323-2234/include/linux/mempolicy.h 2009-04-03 11:25:26.000000000 -0400
130 | @@ -42,7 +42,8 @@ enum {
131 | #define MPOL_MF_STRICT (1<<0) /* Verify existing pages in the mapping */
132 | #define MPOL_MF_MOVE (1<<1) /* Move pages owned by this process to conform to mapping */
133 | #define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
134 | -#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */
135 | +#define MPOL_MF_NOCLEAR (1<<3) /* Debug: don't clear pages in vma */
136 | +#define MPOL_MF_INTERNAL (1<<4) /* Internal flags start here */
137 |
138 | /*
139 | * Internal flags that share the struct mempolicy flags word with
140 |
--------------------------------------------------------------------------------
/Libnuma/lts-01-libnuma-fix-numa_num_thread_cpus+nodes.patch:
--------------------------------------------------------------------------------
1 | Against: numactl-2.0.3 package
2 |
3 | libnuma in the 2.0.3 numactl package contained a mismatch between the
4 | names of the "numa_num_*_{cpus|nodes}()" functions used in the source
5 | code and man page, and the names used in the version.ldscript and the
6 | numa.h header. This rendered the functions inaccessible.
7 |
8 | This patch resolves the mismatch. We had to choose one of the names,
9 | "*_task_*" or "*_thread_*", for all usage. The man page and source
10 | code had used the "thread" variant, while the header and ldscript used
11 | the "task" variant. By using "task" in place of thread everywhere,
12 | including the man page, function descriptions therein become true
13 | independent of thread model: "system scope" vs "process scope" in
14 | Pthreads terminology.
15 |
16 | Because libnuma provides a Linux-specific API, the term "task"
17 | should be well understood by programmers, and should cause no
18 | portability concerns. Because the "numa_num_*_{cpus|nodes}()"
19 | functions are inaccessible in the current version of the library
20 | and these are the only exported functions whose name was
21 | changed, there should be no compatiblity concerns.
22 |
23 |
24 | libnuma.c | 22 ++++++-------
25 | numa.3 | 98 ++++++++++++++++++++++++++++++++++----------------------------
26 | 2 files changed, 66 insertions(+), 54 deletions(-)
27 |
28 | Index: numactl-2.0.3/libnuma.c
29 | ===================================================================
30 | --- numactl-2.0.3.orig/libnuma.c 2009-06-10 08:30:03.000000000 -0400
31 | +++ numactl-2.0.3/libnuma.c 2010-04-02 10:03:58.000000000 -0400
32 | @@ -431,7 +431,7 @@ read_mask(char *s, struct bitmask *bmp)
33 | * /proc/self/status.
34 | */
35 | static void
36 | -set_thread_constraints(void)
37 | +set_task_constraints(void)
38 | {
39 | int hicpu = sysconf(_SC_NPROCESSORS_CONF)-1;
40 | int i;
41 | @@ -567,7 +567,7 @@ set_sizes(void)
42 | set_nodemask_size(); /* size of kernel nodemask_t */
43 | set_numa_max_cpu(); /* size of kernel cpumask_t */
44 | set_configured_cpus(); /* cpus listed in /sys/devices/system/cpu */
45 | - set_thread_constraints(); /* cpus and nodes for current thread */
46 | + set_task_constraints(); /* cpus and nodes for current thread */
47 | }
48 |
49 | int
50 | @@ -596,13 +596,13 @@ numa_num_possible_cpus(void)
51 | }
52 |
53 | int
54 | -numa_num_thread_nodes(void)
55 | +numa_num_task_nodes(void)
56 | {
57 | return maxprocnode+1;
58 | }
59 |
60 | int
61 | -numa_num_thread_cpus(void)
62 | +numa_num_task_cpus(void)
63 | {
64 | return maxproccpu+1;
65 | }
66 | @@ -1667,7 +1667,7 @@ numa_parse_nodestring(char *s)
67 | int maxnode = numa_max_node();
68 | int invert = 0, relative = 0;
69 | int conf_nodes = numa_num_configured_nodes();
70 | - int thread_nodes = numa_num_thread_nodes();
71 | + int task_nodes = numa_num_task_nodes();
72 | char *end;
73 | struct bitmask *mask;
74 |
75 | @@ -1690,7 +1690,7 @@ numa_parse_nodestring(char *s)
76 | int i;
77 | if (!strcmp(s,"all")) {
78 | int i;
79 | - for (i = 0; i < thread_nodes; i++)
80 | + for (i = 0; i < task_nodes; i++)
81 | numa_bitmask_setbit(mask, i);
82 | s+=4;
83 | break;
84 | @@ -1715,7 +1715,7 @@ numa_parse_nodestring(char *s)
85 | numa_warn(W_nodeparse, "missing node argument %s\n", s);
86 | goto err;
87 | }
88 | - if (arg2 >= thread_nodes) {
89 | + if (arg2 >= task_nodes) {
90 | numa_warn(W_nodeparse, "node argument %d out of range\n", arg2);
91 | goto err;
92 | }
93 | @@ -1763,7 +1763,7 @@ numa_parse_cpustring(char *s)
94 | {
95 | int invert = 0, relative=0;
96 | int conf_cpus = numa_num_configured_cpus();
97 | - int thread_cpus = numa_num_thread_cpus();
98 | + int task_cpus = numa_num_task_cpus();
99 | char *end;
100 | struct bitmask *mask;
101 |
102 | @@ -1785,7 +1785,7 @@ numa_parse_cpustring(char *s)
103 |
104 | if (!strcmp(s,"all")) {
105 | int i;
106 | - for (i = 0; i < thread_cpus; i++)
107 | + for (i = 0; i < task_cpus; i++)
108 | numa_bitmask_setbit(mask, i);
109 | s+=4;
110 | break;
111 | @@ -1795,7 +1795,7 @@ numa_parse_cpustring(char *s)
112 | numa_warn(W_cpuparse, "unparseable cpu description `%s'\n", s);
113 | goto err;
114 | }
115 | - if (arg >= thread_cpus) {
116 | + if (arg >= task_cpus) {
117 | numa_warn(W_cpuparse, "cpu argument %s is out of range\n", s);
118 | goto err;
119 | }
120 | @@ -1811,7 +1811,7 @@ numa_parse_cpustring(char *s)
121 | numa_warn(W_cpuparse, "missing cpu argument %s\n", s);
122 | goto err;
123 | }
124 | - if (arg2 >= thread_cpus) {
125 | + if (arg2 >= task_cpus) {
126 | numa_warn(W_cpuparse, "cpu argument %s out of range\n", s);
127 | goto err;
128 | }
129 | Index: numactl-2.0.3/numa.3
130 | ===================================================================
131 | --- numactl-2.0.3.orig/numa.3 2009-06-10 08:30:03.000000000 -0400
132 | +++ numactl-2.0.3/numa.3 2010-04-02 10:27:40.000000000 -0400
133 | @@ -44,9 +44,9 @@ numa \- NUMA policy library
134 | .br
135 | .BI "struct bitmask *numa_all_cpus_ptr;"
136 | .sp
137 | -.BI "int numa_num_thread_cpus();"
138 | +.BI "int numa_num_task_cpus();"
139 | .br
140 | -.BI "int numa_num_thread_nodes();"
141 | +.BI "int numa_num_task_nodes();"
142 | .sp
143 | .BI "int numa_parse_bitmap(char *" line " , struct bitmask *" mask ");
144 | .br
145 | @@ -177,16 +177,16 @@ page interleaving (i.e., allocate in a r
146 | or a subset, of the nodes on the system),
147 | preferred node allocation (i.e., preferably allocate on a particular node),
148 | local allocation (i.e., allocate on the node on which
149 | -the thread is currently executing),
150 | +the task is currently executing),
151 | or allocation only on specific nodes (i.e., allocate on
152 | some subset of the available nodes).
153 | -It is also possible to bind threads to specific nodes.
154 | +It is also possible to bind tasks to specific nodes.
155 |
156 | -Numa memory allocation policy may be specified as a per-thread attribute,
157 | -that is inherited by children threads and processes, or as an attribute
158 | +Numa memory allocation policy may be specified as a per-task attribute,
159 | +that is inherited by children tasks and processes, or as an attribute
160 | of a range of process virtual address space.
161 | Numa memory policies specified for a range of virtual address space are
162 | -shared by all threads in the process.
163 | +shared by all tasks in the process.
164 | Further more, memory policies specified for a range of a shared memory
165 | attached using
166 | .I shmat(2)
167 | @@ -195,8 +195,8 @@ or
168 | from shmfs/hugetlbfs are shared by all processes that attach to that region.
169 | Memory policies for shared disk backed file mappings are currently ignored.
170 |
171 | -The default memory allocation policy for threads and all memory range
172 | -is local allocation.
173 | +The default memory allocation policy for tasks is local allocation.
174 | +The default policy for all memory ranges is the task's memory allocation policy.
175 | This assumes that no ancestor has installed a non-default policy.
176 |
177 | For setting a specific policy globally for all memory allocations
178 | @@ -282,7 +282,7 @@ numbers in /sys/devices/system/cpu. If t
179 |
180 | .BR numa_all_nodes_ptr
181 | points to a bitmask that is allocated by the library with bits
182 | -representing all nodes on which the calling thread may allocate memory.
183 | +representing all nodes on which the calling task may allocate memory.
184 | This set may be up to all nodes on the system, or up to the nodes in
185 | the current cpuset.
186 | The bitmask is allocated by a call to
187 | @@ -302,7 +302,7 @@ The user should not alter this bitmask.
188 |
189 | .BR numa_all_cpus_ptr
190 | points to a bitmask that is allocated by the library with bits
191 | -representing all cpus on which the calling thread may execute.
192 | +representing all cpus on which the calling task may execute.
193 | This set may be up to all cpus on the system, or up to the cpus in
194 | the current cpuset.
195 | The bitmask is allocated by a call to
196 | @@ -312,14 +312,14 @@ using size
197 | The set of cpus to record is derived from /proc/self/status, field
198 | "Cpus_allowed". The user should not alter this bitmask.
199 |
200 | -.BR numa_num_thread_cpus()
201 | -returns the number of cpus that the calling thread is allowed
202 | +.BR numa_num_task_cpus()
203 | +returns the number of cpus that the calling task is allowed
204 | to use. This count is derived from the map /proc/self/status, field
205 | "Cpus_allowed". Also see the bitmask
206 | .BR numa_all_cpus_ptr.
207 |
208 | -.BR numa_num_thread_nodes()
209 | -returns the number of nodes on which the calling thread is
210 | +.BR numa_num_task_nodes()
211 | +returns the number of nodes on which the calling task is
212 | allowed to allocate memory. This count is derived from the map
213 | /proc/self/status, field "Mems_allowed".
214 | Also see the bitmask
215 | @@ -346,9 +346,9 @@ The bit mask is allocated by
216 | The string is a comma-separated list of node numbers or node ranges.
217 | A leading ! can be used to indicate "not" this list (in other words, all
218 | nodes except this list), and a leading + can be used to indicate that the
219 | -node numbers in the list are relative to the thread's cpuset. The string can
220 | +node numbers in the list are relative to the task's cpuset. The string can
221 | be "all" to specify all (
222 | -.BR numa_num_thread_nodes()
223 | +.BR numa_num_task_nodes()
224 | ) nodes. Node numbers are limited by the number in the system. See
225 | .BR numa_max_node()
226 | and
227 | @@ -367,12 +367,12 @@ The bit mask is allocated by
228 | The string is a comma-separated list of cpu numbers or cpu ranges.
229 | A leading ! can be used to indicate "not" this list (in other words, all
230 | cpus except this list), and a leading + can be used to indicate that the cpu
231 | -numbers in the list are relative to the thread's cpuset. The string can be
232 | +numbers in the list are relative to the task's cpuset. The string can be
233 | "all" to specify all (
234 | -.BR numa_num_thread_cpus()
235 | +.BR numa_num_task_cpus()
236 | ) cpus.
237 | Cpu numbers are limited by the number in the system. See
238 | -.BR numa_num_thread_cpus()
239 | +.BR numa_num_task_cpus()
240 | and
241 | .BR numa_num_configured_cpus().
242 | .br
243 | @@ -396,7 +396,7 @@ instead of
244 | This is useful on 32-bit architectures with large nodes.
245 |
246 | .BR numa_preferred ()
247 | -returns the preferred node of the current thread.
248 | +returns the preferred node of the current task.
249 | This is the node on which the kernel preferably
250 | allocates memory, unless some other policy overrides this.
251 | .\" TODO: results are misleading for MPOL_PREFERRED and may
252 | @@ -406,7 +406,7 @@ allocates memory, unless some other poli
253 | .\" node. Need to tighten this up with the syscall results.
254 |
255 | .BR numa_set_preferred ()
256 | -sets the preferred node for the current thread to
257 | +sets the preferred node for the current task to
258 | .IR node .
259 | The system will attempt to allocate memory from the preferred node,
260 | but will fall back to other nodes if no memory is available on the
261 | @@ -418,12 +418,12 @@ calling
262 | .BR numa_set_localalloc ().
263 |
264 | .BR numa_get_interleave_mask ()
265 | -returns the current interleave mask if the thread's memory allocation policy
266 | +returns the current interleave mask if the task's memory allocation policy
267 | is page interleaved.
268 | Otherwise, this function returns an empty mask.
269 |
270 | .BR numa_set_interleave_mask ()
271 | -sets the memory interleave mask for the current thread to
272 | +sets the memory interleave mask for the current task to
273 | .IR nodemask .
274 | All new memory allocations
275 | are page interleaved over all nodes in the interleave mask. Interleaving
276 | @@ -434,7 +434,7 @@ page into the current address space. It
277 | will fall back to other nodes if no memory is available on the interleave
278 | target.
279 | .\" NOTE: the following is not really the case. this function sets the
280 | -.\" thread policy for all future allocations, including stack, bss, ...
281 | +.\" task policy for all future allocations, including stack, bss, ...
282 | .\" The functions specified in this sentence actually allocate a new memory
283 | .\" range [via mmap()]. This is quite a different thing. Suggest we drop
284 | .\" this.
285 | @@ -477,7 +477,7 @@ flag is true then the operation will cau
286 | pages in the mapping that do not follow the policy.
287 |
288 | .BR numa_bind ()
289 | -binds the current thread and its children to the nodes
290 | +binds the current task and its children to the nodes
291 | specified in
292 | .IR nodemask .
293 | They will only run on the CPUs of the specified nodes and only be able to allocate
294 | @@ -488,7 +488,7 @@ This function is equivalent to calling
295 | .I numa_run_on_node_mask(nodemask)
296 | followed by
297 | .IR numa_set_membind(nodemask) .
298 | -If threads should be bound to individual CPUs inside nodes
299 | +If tasks should be bound to individual CPUs inside nodes
300 | consider using
301 | .I numa_node_to_cpus
302 | and the
303 | @@ -496,15 +496,15 @@ and the
304 | syscall.
305 |
306 | .BR numa_set_localalloc ()
307 | -sets the memory allocation policy for the calling thread to
308 | +sets the memory allocation policy for the calling task to
309 | local allocation.
310 | In this mode, the preferred node for memory allocation is
311 | -effectively the node where the thread is executing at the
312 | +effectively the node where the task is executing at the
313 | time of a page allocation.
314 |
315 | .BR numa_set_membind ()
316 | sets the memory allocation mask.
317 | -The thread will only allocate memory from the nodes set in
318 | +The task will only allocate memory from the nodes set in
319 | .IR nodemask .
320 | Passing an empty
321 | .I nodemask
322 | @@ -610,7 +610,7 @@ The
323 | argument will be rounded up to a multiple of the system page size.
324 |
325 | .BR numa_run_on_node ()
326 | -runs the current thread and its children
327 | +runs the current task and its children
328 | on a specific node. They will not migrate to CPUs of
329 | other nodes until the node affinity is reset with a new call to
330 | .BR numa_run_on_node_mask ().
331 | @@ -621,7 +621,7 @@ On success, 0 is returned; on error \-1
332 | is set to indicate the error.
333 |
334 | .BR numa_run_on_node_mask ()
335 | -runs the current thread and its children only on nodes specified in
336 | +runs the current task and its children only on nodes specified in
337 | .IR nodemask .
338 | They will not migrate to CPUs of
339 | other nodes until the node affinity is reset with a new call to
340 | @@ -636,7 +636,7 @@ On success, 0 is returned; on error \-1
341 | is set to indicate the error.
342 |
343 | .BR numa_get_run_node_mask ()
344 | -returns the mask of nodes that the current thread is allowed to run on.
345 | +returns the mask of nodes that the current task is allowed to run on.
346 |
347 | .BR numa_tonode_memory ()
348 | put memory on a specific node. The constraints described for
349 | @@ -698,7 +698,7 @@ alternative to repeated calls to the get
350 | See getpagesize(2).
351 |
352 | .BR numa_sched_getaffinity()
353 | -retrieves a bitmask of the cpus on which a thread may run. The thread is
354 | +retrieves a bitmask of the cpus on which a task may run. The task is
355 | specified by
356 | .I pid.
357 | Returns the return value of the sched_getaffinity
358 | @@ -710,9 +710,9 @@ Test the bits in the mask by calling
359 | .BR numa_bitmask_isbitset().
360 |
361 | .BR numa_sched_setaffinity()
362 | -sets a thread's allowed cpu's to those cpu's specified in
363 | +sets a task's allowed cpu's to those cpu's specified in
364 | .I mask.
365 | -The thread is specified by
366 | +The task is specified by
367 | .I pid.
368 | Returns the return value of the sched_setaffinity system call.
369 | See sched_setaffinity(2). You may allocate the bitmask with
370 | @@ -866,7 +866,7 @@ executing or current process.
371 | It simply uses the move_pages system call.
372 | .br
373 | .I pid
374 | -- ID of thread. If not valid, use the current thread.
375 | +- ID of task. If not valid, use the current task.
376 | .br
377 | .I count
378 | - Number of pages.
379 | @@ -887,7 +887,7 @@ See move_pages(2).
380 |
381 | .BR numa_migrate_pages()
382 | simply uses the migrate_pages system call to cause the pages of the calling
383 | -thread, or a specified thread, to be migated from one set of nodes to another.
384 | +task, or a specified task, to be migated from one set of nodes to another.
385 | See migrate_pages(2).
386 | The bit masks representing the nodes should be allocated with
387 | .BR numa_allocate_nodemask()
388 | @@ -897,7 +897,7 @@ using an
389 | .I n
390 | value returned from
391 | .BR numa_num_possible_nodes().
392 | -A thread's current node set can be gotten by calling
393 | +A task's current node set can be gotten by calling
394 | .BR numa_get_membind().
395 | Bits in the
396 | .I tonodes
397 | @@ -971,6 +971,17 @@ and
398 | .I numa_exit_on_error
399 | are process global. The other calls are thread safe.
400 |
401 | +.SH NOTES
402 | +Linux scheduling affinity and NUMA memory policies apply to Linux kernel tasks.
403 | +For a thread model that maps each user space thread directly onto a kernel task,
404 | +such as the Pthreads PTHREAD_SCOPE_SYSTEM model,
405 | +the terms thread and task are synonomous.
406 | +For a thread model that maps multiple user space threads onto one or more kernel tasks,
407 | +such as the Pthreads PTHREAD_SCOPE_PROCESS model,
408 | +the terms are not necessarily synonomous.
409 | +To make the function descriptions above true for either model,
410 | +this document uses the term "task" throughout.
411 | +
412 | .SH COPYRIGHT
413 | Copyright 2002, 2004, 2007, 2008 Andi Kleen, SuSE Labs.
414 | .I libnuma
415 | @@ -984,7 +995,8 @@ is under the GNU Lesser General Public L
416 | .BR mmap (2),
417 | .BR shmat (2),
418 | .BR numactl (8),
419 | -.BR sched_getaffinity (2)
420 | -.BR sched_setaffinity (2)
421 | -.BR move_pages (2)
422 | -.BR migrate_pages (2)
423 | +.BR sched_getaffinity (2),
424 | +.BR sched_setaffinity (2),
425 | +.BR move_pages (2),
426 | +.BR migrate_pages (2),
427 | +.BR pthread_attr_setscope (3)
428 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # Makefile for linux "page fault test"
2 | #
3 | #
4 |
5 | # until this shows up in distro headers
6 | # pft will check whether or not kernel supports it.
7 | RUSAGE_THREAD ?= -DUSE_RUSAGE_THREAD
8 |
9 | # Requires kernel patch to work.
10 | NOCLEAR ?= -UUSE_NOCLEAR
11 |
12 | #--------------------------------------------
13 | SHELL = /bin/sh
14 |
15 | MACH =
16 |
17 | CMODE = -std=gnu99
18 | COPT = $(CMODE) -pthread -O3 #-non_shared
19 | DEFS = -D_GNU_SOURCE $(RUSAGE_THREAD) $(NOCLEAR)
20 | INCLS = #-I
21 | CFLAGS = $(COPT) $(DEFS) $(INCLS) $(ECFLAGS)
22 |
23 | LDOPTS = #-dnon_shared
24 | # comment out '-lnuma' for platforms w/o libnuma -- laptops?
25 | LDLIBS = -lpthread -lrt -lnuma
26 | LDFLAGS = $(CMODE) $(LDOPTS) $(ELDFLAGS)
27 |
28 | HDRS =
29 |
30 | OBJS = pft.o
31 |
32 | EXTRAHDRS =
33 |
34 | # Include 'numa_stubs.o' for platforms w/o libnuma -- laptops?
35 | EXTRAOBJS = /usr/include/numa.h /usr/include/numaif.h
36 |
37 | PROGS = pft
38 |
39 | PROJ = pft
40 |
41 | #---------------------------------
42 |
43 | all: $(PROGS)
44 |
45 | pft: $(OBJS) $(EXTRAOBJS)
46 | $(CC) -o $@ $(LDFLAGS) $(OBJS) $(EXTRAOBJS) $(LDLIBS)
47 |
48 | $(OBJS): $(HDRS)
49 |
50 | # extra dependencies to generate errors if headers are missing
51 | pft.o:
52 |
53 | install:
54 | @echo "install not implemented"
55 |
56 | clean:
57 | -rm -f *.o core.[0-9]* Log*
58 |
59 | clobber: clean
60 | -rm -f $(PROGS) cscope.*
61 |
62 | # ------------------------------------------------
63 | # N.B., renames current directory to new version name!
64 | # [and, yes, this is really ugly...]
65 | VERSION=$$(cat $$_WD/version.h|grep _VERSION|sed 's/^.* "\([0-9.a-z+-]*\)".*$$/\1/')
66 | tarball: clobber
67 | @chmod --recursive u+r .pc; \
68 | _WD=`pwd`; _WD=`basename $$_WD`; cd ..;\
69 | _version=$(VERSION); _tarball=$(PROJ)-$${_version}.tar.gz; \
70 | _newWD=`echo $$_WD | sed s:-.*:-$$_version:`; \
71 | if [ "$$_WD" != "$$_newWD" ] ; then \
72 | echo "Renaming '.' [$$_WD/] to $$_newWD/"; \
73 | mv $$_WD $$_newWD; \
74 | fi ; \
75 | tar czf - $$_newWD >$$_tarball; \
76 | if [ $$? -eq 0 ]; then \
77 | echo "tarball at ../$$_tarball"; \
78 | else \
79 | echo "Error making tarball"; \
80 | fi
81 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | The "overall operation" section is way out of date, sorry.
2 | Especially since restoration of multi-process version.
3 | Update is on the TODO list. Version history below is more or
4 | less up to date.
5 |
6 | "pft" : Page Fault Test
7 |
8 | Originally by Chirstoph Lameter.
9 |
10 | Modified by Lee Schermerhorn [v0.2+] to measure relative overhead
11 | of memory policy changes: reference counting, ...
12 |
13 | See "usage" in program source for command line options.
14 |
15 | Overall operation:
16 |
17 | 1) parse options, calculate memory sizes, create "communications" area
18 | in shared memory.
19 |
20 | 2) fork a child to run test "launch()" function. Originally, we did this
21 | so we could use RUSAGE_CHILDREN to obtain accumulated statistics --
22 | faults, ... However, this included cpu time and faults from other
23 | than the test loops that we're interested in. We've changed how we
24 | capture the wall clock time and the rusage, but we still launch() the
25 | test workers [threads or processes] from a child process.
26 | Wait for the child to exit.
27 |
28 | 3) launch() function [in child]:
29 | a) creates test region of specified size and type [anon vs shm];
30 | optionally "mbind()s" test region to install a vma/shared mempolicy.
31 | However, launch() does NOT touch the region, so as not to fault in
32 | any pages.
33 | Note: if supported by kernel [requires patch] and enabled at build
34 | time [e.g., NOCLEAR=-DUSE_NOCLEAR on make command line],
35 | '-Z' option will cause launch() to mark region as "noclear",
36 | eliminating the page zeroing overhead from the test.
37 | b) sets launch() process' scheduler policy to SCHED_FIFO and it's
38 | priority to 1 greater than will be used for worker threads/processes.
39 | c) creates/starts specified number of threads to run the "test()"
40 | function and "waits" for all threads to become "READY". Threads
41 | runs SCHED_FIFO on priority below the launch() thread. The objective
42 | is to allow a worker to run on each cpu. The launch() process/thread
43 | runs as "worker 0".
44 | d) gives all threads the "go ahead"; then run the test loop as worker 0.
45 | e) When the test loop completes, loops waiting waiting to reap al
46 | workers As each worker terminates, select the start time [and rusage]
47 | from the worker that started earliest, and the end time [and rusage]
48 | from the worker that finished last.
49 | Note: for kernels that support RUSAGE_THREAD, pft_mpol uses that to
50 | fetch each worker's rusage and sums the faults and cpu times
51 | for all workers.
52 | f) returns/exits
53 |
54 | 4) test threads:
55 | a) wait for "go ahead" from launch().
56 | b) snap thread start time and start rusage into this thread's thread_info.
57 | c) The measured test loop: either bzero() the thread's respective test
58 | region or touch the specified number of cachelines per page therein.
59 | d) snap the thread's end time and end rusage into this thread's thread_info.
60 | e) sleep for specified delay -- default 2 sec.
61 | f) indicates 'DONE in the per thread info area.
62 | g) exits.
63 |
64 | 5) main program returns from wait() when child/launch() exits, and
65 | computes/emits results.
66 |
67 | ----------------------------
68 |
69 | Helper scripts:
70 |
71 | See Scripts/README
72 |
73 | -------------------------------
74 |
75 | Version history:
76 |
77 | 0.01 - first version of pft_mpol for testing mempolicy fault/allocation
78 | overhead.
79 |
80 | 0.02 - added support for agr [xmgrace] "tag"
81 |
82 | 0.02a - enhancement to helper scripts to support multiple runs per thread
83 | count and added usage string to pft_mpol. General "cleanup".
84 |
85 | 0.03 - use mmap(MAP_ANONYMOUS) for anon test memory and parent/child comm area.
86 | Added pft_mmap(), valloc_{private|shared}(), ... for this purpose.
87 |
88 | Add support for "affinitizing" pft to cpus in hopes of obtaining more
89 | repeatable results.
90 |
91 | Factor out test memory allocation and thread creation from pft results:
92 | snapshot launch() rusage just before giving threads the "go ahead",
93 | subtract this usage from final RUSAGE_CHILDREN.
94 |
95 | Added helper functions to compute elapses, cpu times as double to
96 | "improve readability" of final results reporting.
97 |
98 | 0.04 - In a further attempt to obtain repeatable and accurate results, changed
99 | to capture the end rusage in each of the test threads themselves--just
100 | after the test loops.
101 |
102 | Snap the start time and start rusage of each thread into thread_info
103 | after getting the "go ahead" from the parent, before the page fault
104 | test loop. Snap the end time and rusage after the test loop.
105 | In the parent, as threads join, select the start time and start rusage
106 | from the thread with the earlies start time, and the end time and end
107 | rusage from the thread with the latest end wall clock time.
108 |
109 | Compute difference between selected end and start rusage for determining
110 | the cpu time used and the number of faults in the test loop
111 |
112 | 0.05 - Add option to set scheduler policy of test threads, including the
113 | launch thread to SCHED_FIFO. Launch thread will run at one RT
114 | (SCHED_FIFO) priority higher to maintain control while starting threads,
115 | if nr_threads > nr_online_cpus.
116 |
117 | N.B., This is fragile. And, SCHED_FIFO seems to introduce a wall clock time
118 | delay into the tests. Under investigation.
119 |
120 | Run "thread 0" test in launch() thread, after giving other threads
121 | the go-ahead.
122 |
123 | 0.06 - Add '-L' [SHM_LOCK] and '-l' [mlock] options to test fault rate for
124 | noreclaim/mlock patches. ['-L' also in 0.05?]
125 |
126 | 0.07 - slight mods to emitted TAG and wrapper scripts to ease parsing for
127 | new pft_plot script.
128 |
129 | 0.08 - start adding back multi-process version to avoid mmap_sem on high cpu
130 | counts. Use RUSAGE_THREAD if available.
131 |
132 | 0.09 - added support for "cpus_allowed" constraint on where tests run. pft will
133 | read /proc/self/status, if possible, and extract Cpus_allowed. If the
134 | numbers of cpus allowed is < the number on-line, pft will use the allowed
135 | cpus. Otherwise, it will use cpus 0..nr_cpus_online-1. Allows taskset,
136 | numactl or cpuset constraint on pft cpu usage.
137 |
138 | 0.10 - added support for '-Z' flag to request kernel NOT to clear pages on
139 | allocations, as clear_page() tends to dominate the profiles and time
140 | to fault in a new page. This will, one hopes, give us better visibility
141 | into the behavior of the allocation path, separate from clear_page()
142 | which should be fairly constant release-to-release for a given
143 | platform. This feature requires a kernel patch. See ./Kernel/*
144 | Uses a mbind() flag--MPOL_MF_NOCLEAR--to request no clearing of a
145 | range of memory. Actually just sets "noclear" for the vma that
146 | intersects the mbind() 'start' address, if any.
147 |
148 | 0.11 - use 'cpus_allowed' handling from aim/multitask. Newer version.
149 | + option to use /dev/zero mapping instead of MAP_ANONYMOUS.
150 |
151 | add '-M' [multimap] support -- mmap() separate anon regions for each test
152 | to eliminate anon_vma sharing [WORK IN PROGRESS -- i.e, not quite working]
153 |
154 | 0.12 - rework cpus_allowed to use more libnuma support instead of parsing
155 | /proc//status
156 | N.B., uses 'numa_num_task_cpus()' which is broken in libnuma-2.0.3.
157 | Requires 2.0.4 or patched libnuma. See Libnuma/*
158 | tweak various scripts: pft_plot.py [no legend option], pft_per_node,
159 | pft-task_thread => pft_task_thread.
160 |
--------------------------------------------------------------------------------
/Scripts/README:
--------------------------------------------------------------------------------
1 | Ad hoc pft automation scripts
2 |
3 | runpft - bash script to run page fault test with specified options
4 | a specified number of times [default 1] varying the task/thread
5 | count from 1 to the number of cpus allowed in /proc//status
6 | "Cpus_allowed:" mask.
7 |
8 | The following scripts use runpft to run test from 1 to number of
9 | allowed cpus:
10 |
11 | pft-multirun - old script; invoke runpft with varying
12 | options: anon+{default|w/ mpol}|shmem+{default|w/ mempol}
13 | Emits "old style" annotations. Not for use with
14 | pft_plot.py
15 | pft_task_thread - run task vs thread scalability test.
16 | Emits pft_plot.py style markup.
17 |
18 | pft_per_node - invoke runpft on each node w/ cpus
19 | restricted to that node using:
20 | "numactl --cpunodebind- runpft ...".
21 | Test per node scalability. Emits pft_plot.py
22 | style markup.
23 |
24 | The following scripts have their own internal version of runpft
25 | to vary task count while gathering stats, profile. They ignore
26 | Cpus_allowed and attempt to run tests on all cpus in the system.
27 | These scripts emit pft_plot.py 'LEGEND' markup, but require
28 | manual editing to add PLOTID and [SUB]TITLEs.
29 |
30 | pft_lockstats - requires debug kernel that supports
31 | lockstats.
32 | pft_profile - uses built in kernel profiler. Clears
33 | and stores profile for each load point.
34 | Requires kernel be booted with "profile=N".
35 | pft_vmstats - collects vmstat output during each load
36 | point.
37 |
38 | pft_plot.py - python/matplotlib script to process output of the
39 | scripts above and produce a /.png' plot. See help text.
40 | Always a "work in progress".
41 |
42 | rmshm - hack to remove sysv shm segments should pft leave
43 | some behind. Quite indiscriminant.
44 |
45 | fmt_vmstats - used by pft_vmstats to pretty up the vmstat output
46 | for systems whose numbers exceed vmstat(1)'s field widths.
47 | Unfortunately, this output doesn't play nice with vmstat_plot.py
48 | [separate tool].
49 |
--------------------------------------------------------------------------------
/Scripts/fmt_vmstats:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (c) 2006, 2014 SGI. All rights reserved.
4 | #
5 | # This program is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation; either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program. If not, see .
17 |
18 | ## fmt_vmstats -- reformat vmstats output for large systems to align
19 | ## numeric data with headers.
20 |
21 | ## Usage: fmt_vmstats
22 | # e.g., fmt_vmstats -a -S M 10
23 | # doesn't work for all possible vmstat args.
24 |
25 | # Note: this needs at least 118 columns of screen to display all fields on one line
26 |
27 | # At some point, we may need to increase the field widths--again:
28 |
29 | # 1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678
30 | hdr1="---procs---|----------------memory---------------|----swap-----|--------io-------|------system-----|-------cpu--------\n"
31 | hdr2="_run_ _blk_|swpd ___free___ ___buff___ ___cache__|__si__ __so__|___bi___ ___bo___|___in___ ___cs___|usr sys idl wai st\n"
32 | hdr2a="_run_ _blk_|swpd ___free___ ___inact__ __active__|__si__ __so__|___bi___ ___bo___|___in___ ___cs___|usr sys idl wai st\n"
33 | fmt="%5d %5d|%4d %10d %10d %10d|%6d %6d|%8d %8d|%8d %8d|%3d %3d %3d %3d %2d %s\n"
34 |
35 |
36 | declare -i irun=
37 | declare VMSTAT=/usr/bin/vmstat
38 |
39 |
40 | if [[ $# -eq 0 ]]; then
41 | echo -e "Usage: fmt_vmstats \n\nRun vmstat with and format the output.\n"
42 | exit 1
43 | fi
44 |
45 | # TODO: add optional timestamps?
46 | $VMSTAT "$@" |
47 | while read run blk swpd free buff cache si so bi bo in cs us sy id wa st rest
48 | do
49 | if [[ "$run" = "procs" ]]; then
50 | printf -- "$hdr1"
51 | continue
52 | fi
53 | if [[ "$run" = "r" ]]; then
54 | if [[ "$buff" = "buff" ]]; then
55 | printf "$hdr2"
56 | elif [[ "$buff" = "inact" ]]; then
57 | printf "$hdr2a"
58 | else
59 | echo "Sorry. Don't recognize vmstat output format." >&2
60 | exit 1
61 | fi
62 | continue
63 | fi
64 | irun=$run
65 | if [[ "$irun" != "$run" ]]; then
66 | # echo non-numeric lines
67 | echo "$run $blk $swpd $free $buff $cache $si $so $bi $bo $in $cs $us $sy $id $wa $st $rest"
68 | continue
69 | fi
70 | printf "$fmt" $run $blk $swpd $free $buff $cache $si $so $bi $bo $in $cs $us $sy $id $wa $st "$rest"
71 |
72 | done
73 |
--------------------------------------------------------------------------------
/Scripts/pft-multirun:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (c) 2006, 2014 SGI. All rights reserved.
4 | #
5 | # This program is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation; either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program. If not, see .
17 |
18 | ## pft-multirunX -- invoke runpft with varying args
19 |
20 | # for plot annotations
21 | PLATFORM=$(dmidecode -s system-product-name)
22 | if [[ -n "$PLATFORM" ]]; then
23 | PLATFORM=$( echo "$PLATFORM" | awk '{print $1"-"$2$3;}')
24 | else
25 | PLATFORM=Unknown
26 | fi
27 |
28 | # better way to determine nr_cpus?
29 | nr_cpus=$(cat /proc/cpuinfo | grep '^processor' | wc -l)
30 | nr_nodes=$(ls -1d /sys/devices/system/node/node[0-9]* | wc -l)
31 |
32 | # TESTING=true
33 | TESTING=false
34 | export NOEXEC=$TESTING VERBOSE=$TESTING
35 |
36 | TIMESTAMP="$(date +%y%m%d-%H%M%S)"
37 |
38 | # "runpft" will run pft_mpol for nr_threads = 1 .. nr_cpus,
39 | # multiple times for each thread count for averaging, ...
40 | RUNPFT="/usr/local/bin/runpft"
41 |
42 | # use os revision for pft "tag"
43 | osrev=$(uname -r)
44 | #osrev=${osrev#2.6.} # drop the 2.6.
45 |
46 | # Memory Size -- if not set, calc from GB_PER_TASK * nr_tasks)
47 | #MEMSIZE="-m 4g"
48 | MEMSIZE="-m 0" # required to use GB_PER_TASK
49 | GB_PER_TASK="-g 8"
50 |
51 | # Number of Runs Per Thread count:
52 | NRPT="-N 4"
53 |
54 | # Affinitize -- bind to cpus
55 | BIND="-af"
56 |
57 | # Nodebind: affinitize job to specified nodes
58 | #NODEBIND=
59 | NODEBIND="numactl --cpunodebind 1"
60 |
61 | outprefix=pft_allnodes-$PLATFORM-$osrev-$TIMESTAMP
62 |
63 | STOP_FILE=./pft_stop_file
64 |
65 | {
66 | # pft_mpol build version/timestamp:
67 | pft_mpol -V
68 | echo "PLOTID pft_multirun-plotid" # edit as needed
69 | echo "TITLE Single Node Scalability - ${GB_PER_TASK##* }/task"
70 | echo "SUBTITLE $PLATFORM $osrev"
71 |
72 |
73 | echo "LEGEND no additional patches "
74 | rm -f $STOP_FILE
75 | # anon mem, sys default mpol, touch to fault
76 | $NODEBIND $RUNPFT $NRPT $MEMSIZE $GB_PER_TASK $BIND "$osrev"
77 | ## anon mem, explicit local mpol, touch to fault
78 | #$NODEBIND $RUNPFT $NRPT $MEMSIZE $GB_PER_TASK $BIND -p "$osrev"
79 | ## shmem, sys default mpol, touch to fault
80 | #$NODEBIND $RUNPFT $NRPT $MEMSIZE $GB_PER_TASK $BIND -S "$osrev"
81 | ## shmem, explicit local mpol, touch to fault
82 | #$NODEBIND $RUNPFT $NRPT $MEMSIZE $GB_PER_TASK $BIND -S -p "$osrev"
83 | } > ${outprefix}.pft 2>&1
84 |
--------------------------------------------------------------------------------
/Scripts/pft_lockstats:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (c) 2006, 2014 SGI. All rights reserved.
4 | #
5 | # This program is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation; either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program. If not, see .
17 |
18 | # for plot annotations
19 | PLATFORM=$(dmidecode -s system-product-name )
20 | if [[ -n "$PLATFORM" ]]; then
21 | PLATFORM=$( echo "$PLATFORM" | awk '{print $1"-"$2$3;}')
22 | else
23 | PLATFORM=Unknown
24 | fi
25 |
26 | # better way to determine nr_cpus?
27 | nr_cpus=$(cat /proc/cpuinfo | grep '^processor' | wc -l)
28 | nr_nodes=$(ls -1d /sys/devices/system/node/node[0-9]* | wc -l)
29 |
30 | # os revision for pft "tag"
31 | osrev=$(uname -r)
32 | osrev=${osrev#2.6.} # drop the 2.6.
33 |
34 | # Memory Size -- if not set, calc from GB_PER_TASK * nr_tasks)
35 | #MEMSIZE="-m 4g"
36 | MEMSIZE=
37 | GB_PER_TASK=8
38 |
39 | # Affinitize -- bind to cpus; use SCHED_FIFO
40 | BIND="-af"
41 |
42 | # Test type: -n for tasks, nothing for threads
43 | TEST_TYPE= #-n
44 |
45 | TIMESTAMP="$(date +%y%m%d-%H%M%S)"
46 |
47 | reset_lockstats()
48 | {
49 | echo 0 >/proc/lock_stat
50 | }
51 |
52 | enable_lockstats()
53 | {
54 | echo 1 >/sys/module/lockdep/parameters/lock_stat
55 | }
56 |
57 | disable_lockstats()
58 | {
59 | echo 0 >/sys/module/lockdep/parameters/lock_stat
60 | }
61 |
62 |
63 | outprefix=pft-$PLATFORM-$osrev-$TIMESTAMP
64 | outfile=${outprefix}.pgfaults
65 |
66 | STOP_FILE=./pft_stop_file
67 |
68 | # quick and dirty intenal version.
69 | # run pft varying task count from 1 .. nr_cpus
70 | runpft()
71 | {
72 | local memtype=$1
73 | local tag=MAP_ANON
74 | [[ "$memtype" != "-Z" ]] || tag=dev_zero
75 | local memsize
76 |
77 | rm -f $STOP_FILE
78 | reset_lockstats
79 | enable_lockstats
80 | title=-T
81 | echo "LEGEND $osrev $tag" >> ${outprefix}.pgfaults
82 | echo "$osrev $tag - 1..$nr_cpus tasks" >>${outprefix}.lockstats
83 | for nr_tasks in $(seq 1 $nr_cpus);
84 | do
85 | memsize=$MEMSIZE
86 | [[ -n "$memsize" ]] || memsize="-m $(( GB_PER_TASK * nr_tasks ))g"
87 | pft $BIND $memsize $memtype -n $nr_tasks $title
88 | title=
89 | if [[ -f $STOP_FILE ]]; then
90 | echo "Saw 'stop file'" >&2
91 | break
92 | fi
93 | done >> ${outprefix}.pgfaults
94 | echo >> ${outprefix}.pgfaults
95 | disable_lockstats
96 | cat /proc/lock_stat >>${outprefix}.lockstats
97 | }
98 |
99 | # =====================================================================
100 | #main()
101 |
102 |
103 | # page faults using /dev/zero
104 | runpft -Z
105 |
106 | # page faults using MAP_ANON
107 | runpft
108 |
109 |
--------------------------------------------------------------------------------
/Scripts/pft_per_node:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 | # Copyright (c) 2006, 2014 SGI. All rights reserved.
4 | #
5 | # This program is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation; either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program. If not, see .
17 |
18 | ## pft_per_node: cpunodebind pft to each node in the system and
19 | ## invoke runpft to run for 1..nr_cpus [allowed]
20 |
21 | # for plot annotations
22 | PLATFORM=$(dmidecode -s system-product-name )
23 | if [[ -n "$PLATFORM" ]]; then
24 | PLATFORM=$( echo "$PLATFORM" | awk '{print $1"-"$2$3;}')
25 | else
26 | PLATFORM=Unknown
27 | fi
28 |
29 | # better way to determine nr_cpus?
30 | nr_cpus=$(cat /proc/cpuinfo | grep '^processor' | wc -l)
31 | nr_nodes=$(ls -1d /sys/devices/system/node/node[0-9]* | wc -l)
32 |
33 | # os revision for pft "tag"
34 | osrev=$(uname -r)
35 | #osrev=${osrev#2.6.} # drop the 2.6.
36 |
37 | # Memory Size -- if not set, calc from GB_PER_TASK * nr_tasks)
38 | #MEMSIZE="-m 4g"
39 | MEMSIZE="-m 0"
40 | GB_PER_TASK="-g 2"
41 |
42 | # Number of Runs Per Thread count:
43 | NRPT="-N 4"
44 |
45 | # Affinitize -- bind to cpus; use SCHED_FIFO
46 | BIND="-af"
47 |
48 | # Test type: -n for tasks, nothing for threads
49 | TEST_TYPE= #-n
50 |
51 | case $TEST_TYPE in
52 | -n) task_thread="task"
53 | Task_thread="Task"
54 | ;;
55 | *) task_thread="thread"
56 | Task_thread="Thread"
57 | ;;
58 | esac
59 |
60 | TIMESTAMP="$(date +%y%m%d-%H%M%S)"
61 |
62 | RUNPFT="/usr/local/bin/runpft"
63 |
64 | STOP_FILE=./pft_stop_file
65 |
66 | outprefix=pft_per_node-$PLATFORM-$osrev-$task_thread-$TIMESTAMP
67 |
68 | # =====================================================================
69 |
70 | main()
71 | {
72 |
73 | echo "PLOTID dl785c_per_node_${task_thread}_pft"
74 | echo "TITLE Per Node $Task_thread Scalability"
75 | echo "SUBTITLE $PLATFORM $osrev"
76 |
77 | rm -f $STOP_FILE
78 | for nid in {0..7}; do
79 | if [[ -f $STOP_FILE ]]; then
80 | echo "Saw 'stop file before node $nid'" >&2
81 | break
82 | fi
83 | # echo "LEGEND DL785 node $nid"
84 | echo "LEGEND $osrev node $nid $task_thread"
85 | # anon mem, sys default mpol, touch to fault
86 | # pass dummy 'tag' to generate pft header
87 | _cmd="numactl --cpunodebind=$nid $RUNPFT $TEST_TYPE $NRPT $MEMSIZE $GB_PER_TASK $BIND tag"
88 | echo "$_cmd" >&2
89 | eval "$_cmd"
90 | done
91 |
92 | }
93 |
94 | # =====================================================================
95 | main "$@" >${outprefix}.pft
96 |
--------------------------------------------------------------------------------
/Scripts/pft_plot.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright (c) 2006, 2014 SGI. All rights reserved.
4 | #
5 | # This program is free software; you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation; either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful,
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | # GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program. If not, see .
17 | #
18 | # Work in Progress: convert 'ptf to agr data' to "pft_plot" using matplotlib
19 | # TODO: add 'tabulate' option to emit tabular [averaged] data
20 | #-----------------------------------------------------------------------------
21 | """
22 | pft_plot.py => plot pft [page fault test] data from multiple pft runs using
23 | matplotlib.
24 |
25 | runpft script runs from 1 to nr_cpus-1 threads. Possibly multiple runs per
26 | thread count. We average these.
27 | TODO: compute std dev'n for error bars?
28 |
29 | input file[s] may contain multiple runpft runs--e.g., with different
30 | parameters--e.g., anon vs shmem, mlock vs touch, ... -- possibly from
31 | multiple kernels--e.g., with and without patches applied.
32 |
33 | Plot faults/cpu-sec and faults/wall-sec for all data sets with same set of
34 | pft parameters--e.g., on multiple kernels--on same graph for comparison.
35 | """
36 | #-----------------------------------------------------------------------------
37 |
38 | s_opts = ':hdl:p:v'
39 | l_opts = ['help', 'debug', 'legend_loc=', 'plot=', 'verbose' ]
40 |
41 | USAGE=\
42 | """
43 | Usage: pft_plot [-hv] [-l ] [-p ] ...
44 | Where:
45 | \t-h = Help! show usage.
46 | \t-v = Verbose - show what's happening\n
47 | \t-l - specify legend location; default = 'best'
48 | \t text locs: 'best' or [{upper|lower|center}-]{right|left}
49 | \t or: [{upper|lower}-]center -- e.g., 'upper-left'
50 | \t or: abbreviations for above: l, r, c, ul, lc, ...
51 | \t coordinates: , as floating point values 0.0..1.0
52 | \t 'none' to omit legend--e.g., when it obscures the plot.
53 | \t-p {[fpcs],[fpws]|[wall],[cpu]} - plot selected pft results [see
54 | \t header, below]. default: faults per both cpu & wall secs.
55 | \t Only one may be selected, except for wallclock and cpu times.
56 | \t ... is a list of zero or more files to convert.
57 | \t Default is standard input.\n
58 | Plot pft [page fault test -- mempolicy version] results.
59 | Input Format -- one or more of:\n
60 | PLOTID - arbitrary id to group data sets
61 | TITLE -- one per , last one wins.
62 | SUBTITLE -- one per , last one wins.
63 | LEGEND -- one per data set. identifies data set and curve
64 | on the plot. legends must be different or later occurrences in
65 | the input stream will overwrite earlier data set[s] with same
66 | legend. NOTE: a 'LEGEND' tag is required to indicate the
67 | start of results for an PFT run. pft_plot won't start looking
68 | for the data header until it sees a 'LEGEND'.
69 | other -- ignored
70 | Gb Thr CLine User System Wall flt/cpu/s fault/wsec
71 | N TT N N.NNs NN.NNs NN.NNs CCCCC.ccc WWWWWW.www
72 |
73 | Faults/{cpu|wallclock}-seconds or cpu and wall clock time--which ever is
74 | selected--will be averaged for successive lines with same thread count [TT].
75 | The faults/{cpu|wall}-sec or cpu+wall clock time for all LEGENDs with the
76 | same PLOTID will be plotted on the same graph. This will allow comparison
77 | of fault rate [inversely proportional to allocation overhead], e.g., for
78 | patched and unpatched kernels.
79 | """
80 |
81 | #-----------------------------------------------------------------------------
82 |
83 | import getopt, os, sys, inspect
84 | from math import log10
85 |
86 | # select the Anti-Grain Geometry engine backend for 'png' output
87 | # Must do this before importing pyplot, ...
88 | import matplotlib
89 | matplotlib.use('Agg')
90 | import matplotlib.pyplot as plt
91 |
92 | #-----------------------------------------------------------------------------
93 | # command line options:
94 |
95 | verbose = False
96 | debug = False
97 |
98 | #=============================================================================
99 |
100 | def vprint(msg):
101 | global verbose
102 | if bool(verbose):
103 | print >>sys.stderr, msg
104 | sys.stderr.flush()
105 |
106 | #-----------------------------------------------------------------------------
107 | def usage(ret, msg):
108 | """
109 | emit @msg, if specified, then
110 | emit program usage and exit with @ret return code
111 | """
112 | if msg:
113 | print >>sys.stderr, msg
114 | print >>sys.stderr, USAGE
115 | sys.stderr.flush()
116 | sys.exit(ret)
117 |
118 | #-----------------------------------------------------------------------------
119 | def warning(msg):
120 | print >>sys.stderr,'WARNING: ' + msg
121 | sys.stderr.flush()
122 |
123 | #-----------------------------------------------------------------------------
124 | def die(ret, msg):
125 | """
126 | emit FATAL @msg and exit with @ret return code
127 | """
128 | print >>sys.stderr,'FATAL: ' + msg
129 | sys.stderr.flush()
130 | sys.exit(ret)
131 |
132 | #-----------------------------------------------------------------------------
133 | # usage: not_implemented_yet(inspect.currentframe())
134 | def not_implemented_yet(frame):
135 | vprint((inspect.getframeinfo(frame)[2]) + " - not implemented yet")
136 |
137 | #=============================================================================
138 |
139 | # per plot data sets for PFT:
140 | faults_per_cpu_sec = []
141 | faults_per_wall_sec = []
142 | user_cpu_sec = []
143 | system_cpu_sec = []
144 | real_time_sec = []
145 |
146 | # default
147 | plot_items = ["fpcs", "fpws"]
148 |
149 | the_plots = {} # mapping of test/plot id [pft test parameters] to data_set[s]
150 | # each item in list is a dict: {'