9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9fans@9fans.net
Subject: Re: [9fans] pool curalloc bug
Date: Mon,  2 Mar 2015 11:23:00 +0100	[thread overview]
Message-ID: <2f65a0aa1447a438f388be943ab38c4a@felloff.net> (raw)
In-Reply-To: <c861fe457b5e52ffd70a12b2e332d67e@brasstown.quanstro.net>

the problem with curalloc was the following:

poolallocl() allocates, trims, and then adds the resulting
block size to curalloc. and poolfreel() subtracts the blocksize
from curalloc. so far so good. problem is when we try to merge
arenas, the last block in the bottom arena is extended up to
the start of the top arena to encompass the space between,
and then it is trimmed back to its old *data* size. depending
on the size of the gab, the free data might be accounted for in the
Btail datasize or it might get its own free block if it is
big enougth. in the first case, the block size would'v been
increased (we got some extra space at the end) but this was not
accounted for in curalloc. so poolfreel() will subtract a bigger
value than was added to curalloc, hence the underflow.

the fix is to account for the changed block size in curalloc when
merging arenas.

curalloc is also not properly maintained in poolallocalign(),
but thats not in the testcase.

--
cinap



      parent reply	other threads:[~2015-03-02 10:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-26  2:38 mischief
2015-02-26 22:27 ` mischief
2015-03-02  8:06 ` erik quanstrom
2015-03-02 10:10   ` cinap_lenrek
2015-03-02 10:23   ` cinap_lenrek [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f65a0aa1447a438f388be943ab38c4a@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).