]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Re: TRIVIAL: William Lee Irwin III: buddy system comment
authorWilliam Lee Irwin III <wli@holomorphy.com>
Thu, 20 Jun 2002 06:53:26 +0000 (23:53 -0700)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Thu, 20 Jun 2002 06:53:26 +0000 (23:53 -0700)
mm/page_alloc.c

index be4236b678f85a0811c32c9c10b9dc05dd0fce37..7d01c430e9a1d9ee081d3b4bcba738f1312908ee 100644 (file)
@@ -65,10 +65,13 @@ static int zone_balance_max[MAX_NR_ZONES] __initdata = { 255 , 255, 255, };
  * at the bottom level available, and propagating the changes upward
  * as necessary, plus some accounting needed to play nicely with other
  * parts of the VM system.
- *
- * TODO: give references to descriptions of buddy system allocators,
- * describe precisely the silly trick buddy allocators use to avoid
- * storing an extra bit, utilizing entry point information.
+ * At each level, we keep one bit for each pair of blocks, which
+ * is set to 1 iff only one of the pair is allocated.  So when we
+ * are allocating or freeing one, we can derive the state of the
+ * other.  That is, if we allocate a small block, and both were   
+ * free, the remainder of the region must be split into blocks.   
+ * If a block is freed, and its buddy is also free, then this
+ * triggers coalescing into a block of larger size.            
  *
  * -- wli
  */