Rev 54 | Rev 64 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 54 | Rev 62 | ||
|---|---|---|---|
| Line 286... | Line 286... | ||
| 286 | </section> |
286 | </section> |
| 287 | 287 | ||
| 288 | <section id="frame_allocator"> |
288 | <section id="frame_allocator"> |
| 289 | <title>Frame allocator</title> |
289 | <title>Frame allocator</title> |
| 290 | 290 | ||
| 291 | <para><mediaobject id="frame_alloc"> |
291 | <figure><mediaobject id="frame_alloc"> |
| 292 | <imageobject role="html"> |
292 | <imageobject role="html"> |
| 293 | <imagedata fileref="images/frame_alloc.png" format="PNG" /> |
293 | <imagedata fileref="images/frame_alloc.png" format="PNG" /> |
| 294 | </imageobject> |
294 | </imageobject> |
| 295 | 295 | ||
| 296 | <imageobject role="fop"> |
296 | <imageobject role="fop"> |
| 297 | <imagedata fileref="images.vector/frame_alloc.svg" format="SVG" /> |
297 | <imagedata fileref="images.vector/frame_alloc.svg" format="SVG" /> |
| 298 | </imageobject> |
298 | </imageobject> |
| 299 | </mediaobject></para> |
299 | </mediaobject> |
| - | 300 | <title>Frame allocator scheme.</title> |
|
| - | 301 | </figure> |
|
| 300 | 302 | ||
| 301 | <formalpara> |
303 | <formalpara> |
| 302 | <title>Overview</title> |
304 | <title>Overview</title> |
| 303 | 305 | ||
| 304 | <para>Frame allocator provides physical memory allocation for the |
306 | <para>Frame allocator provides physical memory allocation for the |
| Line 337... | Line 339... | ||
| 337 | <title>Buddy allocator</title> |
339 | <title>Buddy allocator</title> |
| 338 | 340 | ||
| 339 | <section> |
341 | <section> |
| 340 | <title>Overview</title> |
342 | <title>Overview</title> |
| 341 | 343 | ||
| 342 | <para><mediaobject id="buddy_alloc"> |
344 | <figure><mediaobject id="buddy_alloc"> |
| 343 | <imageobject role="html"> |
345 | <imageobject role="html"> |
| 344 | <imagedata fileref="images/buddy_alloc.png" format="PNG" /> |
346 | <imagedata fileref="images/buddy_alloc.png" format="PNG" /> |
| 345 | </imageobject> |
347 | </imageobject> |
| 346 | 348 | ||
| 347 | <imageobject role="fop"> |
349 | <imageobject role="fop"> |
| 348 | <imagedata fileref="images.vector/buddy_alloc.svg" format="SVG" /> |
350 | <imagedata fileref="images.vector/buddy_alloc.svg" format="SVG" /> |
| 349 | </imageobject> |
351 | </imageobject> |
| 350 | </mediaobject></para> |
352 | </mediaobject> |
| - | 353 | <title>Buddy system scheme.</title> |
|
| - | 354 | </figure> |
|
| 351 | 355 | ||
| 352 | <para>In the buddy allocator, the memory is broken down into |
356 | <para>In the buddy allocator, the memory is broken down into |
| 353 | power-of-two sized naturally aligned blocks. These blocks are |
357 | power-of-two sized naturally aligned blocks. These blocks are |
| 354 | organized in an array of lists, in which the list with index i |
358 | organized in an array of lists, in which the list with index i |
| 355 | contains all unallocated blocks of size |
359 | contains all unallocated blocks of size |
| Line 481... | Line 485... | ||
| 481 | </section> |
485 | </section> |
| 482 | 486 | ||
| 483 | <section> |
487 | <section> |
| 484 | <title>Implementation</title> |
488 | <title>Implementation</title> |
| 485 | 489 | ||
| 486 | <para><mediaobject id="slab_alloc"> |
490 | <figure><mediaobject id="slab_alloc"> |
| 487 | <imageobject role="html"> |
491 | <imageobject role="html"> |
| 488 | <imagedata fileref="images/slab_alloc.png" format="PNG" /> |
492 | <imagedata fileref="images/slab_alloc.png" format="PNG" /> |
| 489 | </imageobject> |
493 | </imageobject> |
| 490 | 494 | ||
| 491 | <imageobject role="fop"> |
495 | <imageobject role="fop"> |
| 492 | <imagedata fileref="images.vector/slab_alloc.svg" format="SVG" /> |
496 | <imagedata fileref="images.vector/slab_alloc.svg" format="SVG" /> |
| 493 | </imageobject> |
497 | </imageobject> |
| 494 | </mediaobject></para> |
498 | </mediaobject> |
| - | 499 | <title>Slab allocator scheme.</title> |
|
| - | 500 | </figure> |
|
| 495 | 501 | ||
| 496 | <para>The SLAB allocator is closely modelled after <ulink |
502 | <para>The slab allocator is closely modelled after <ulink |
| 497 | url="http://www.usenix.org/events/usenix01/full_papers/bonwick/bonwick_html/"> |
503 | url="http://www.usenix.org/events/usenix01/full_papers/bonwick/bonwick_html/"> |
| 498 | OpenSolaris SLAB allocator by Jeff Bonwick and Jonathan Adams </ulink> |
504 | OpenSolaris slab allocator by Jeff Bonwick and Jonathan Adams </ulink> |
| 499 | with the following exceptions: <itemizedlist> |
505 | with the following exceptions: <itemizedlist> |
| 500 | <listitem> |
506 | <listitem> |
| 501 | empty SLABS are deallocated immediately (in Linux they are kept in linked list, in Solaris ???) |
507 | empty slabs are deallocated immediately (in Linux they are kept in linked list, in Solaris ???) |
| 502 | </listitem> |
508 | </listitem> |
| 503 | 509 | ||
| 504 | <listitem> |
510 | <listitem> |
| 505 | empty magazines are deallocated when not needed (in Solaris they are held in linked list in slab cache) |
511 | empty magazines are deallocated when not needed (in Solaris they are held in linked list in slab cache) |
| 506 | </listitem> |
512 | </listitem> |
| Line 517... | Line 523... | ||
| 517 | 523 | ||
| 518 | <section> |
524 | <section> |
| 519 | <title>Magazine layer</title> |
525 | <title>Magazine layer</title> |
| 520 | 526 | ||
| 521 | <para>Due to the extensive bottleneck on SMP architures, caused by |
527 | <para>Due to the extensive bottleneck on SMP architures, caused by |
| 522 | global SLAB locking mechanism, making processing of all slab |
528 | global slab locking mechanism, making processing of all slab |
| 523 | allocation requests serialized, a new layer was introduced to the |
529 | allocation requests serialized, a new layer was introduced to the |
| 524 | classic slab allocator design. Slab allocator was extended to |
530 | classic slab allocator design. Slab allocator was extended to |
| 525 | support per-CPU caches 'magazines' to achieve good SMP scaling. |
531 | support per-CPU caches 'magazines' to achieve good SMP scaling. |
| 526 | <termdef>Slab SMP perfromance bottleneck was resolved by introducing |
532 | <termdef>Slab SMP perfromance bottleneck was resolved by introducing |
| 527 | a per-CPU caching scheme called as <glossterm>magazine |
533 | a per-CPU caching scheme called as <glossterm>magazine |