Skip to content

Commit

Permalink
fix braindead linked list fail
Browse files Browse the repository at this point in the history
I re-implemented a linked list for the slab freelist since we don't need to
manage the tail, check the previous item, and use it as a FIFO. However
prev/next must be managed so the slab mover is safe.

However I neglected to clear prev on a fetch, so if the slab mover was
zeroing the head of the freelist it would relink the next item in the freelist
with one in the main LRU.

Which results in chaos.
  • Loading branch information
dormando committed Jan 9, 2012
1 parent 193a653 commit 324975c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions slabs.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ static void *do_slabs_alloc(const size_t size, unsigned int id) {
/* return off our freelist */
it = (item *)p->slots;
p->slots = it->next;
if (it->next) it->next->prev = 0;
p->sl_curr--;
ret = (void *)it;
} else {
Expand Down

0 comments on commit 324975c

Please sign in to comment.