|
Lines 63-73
Link Here
|
| 63 |
The zone allocator stores state information inside the items proper, |
63 |
While an item is not in use, the first sizeof(void *) bytes are used |
| 64 |
so structures that will be managed by the zone allocator must reserve |
64 |
for a pointer to another available item. When allocated, all of the |
| 65 |
two pointers at the very beginning for internal use by the zone |
65 |
item's space is available, except with |
| 66 |
allocator, as follows: |
66 |
.Dv INVARIANTS |
| 67 |
.Bd -literal |
67 |
defined, where the second sizeof(void *) bytes are used for sanity |
| 68 |
struct my_item { |
68 |
checks, and we would get a panic trying to free the item if those bytes |
| 69 |
struct my_item *z_rsvd1; |
69 |
were somehow changed to |
| 70 |
struct my_item *z_rsvd2; |
70 |
.Dv ZENTRY_FREE . |
| 71 |
/* rest of structure */ |
71 |
.Pp |
| 72 |
}; |
72 |
A similar algorithm is further described in Donald Knuth's `The Art of |
| 73 |
.Ed |
73 |
Computer Programming' volume 1, starting at page 254 (section 2.2.3). |
| 74 |
-- |
|
|
|
Line 191
Link Here
|
| 191 |
.An Dag-Erling Co\(:idan Sm\(/orgrav Aq des@FreeBSD.org . |
191 |
.An Dag-Erling Co\(:idan Sm\(/orgrav Aq des@FreeBSD.org |
| 192 |
-- |
192 |
and modified by |
|
|
193 |
.An Robert Drehmel . |