From: torvalds@transmeta.com (Linus Torvalds)
To: linux-kernel@vger.kernel.org
Subject: Re: Buddy allocator - help! I thought I understood this
Date: Sat, 8 Sep 2001 01:47:15 +0000 (UTC) [thread overview]
Message-ID: <9nbtb3$o6i$1@penguin.transmeta.com> (raw)
In-Reply-To: <525190103.999719280@[10.132.112.53]>
In article <525190103.999719280@[10.132.112.53]>,
Alex Bligh - linux-kernel <linux-kernel@alex.org.uk> wrote:
>I could swear I understood this bit of __free_pages_ok()
>Monday night, but my mind appears to have gone blank.
>
>As I recall, the memory bitmaps indicate by the
>status a bit op returns whether or not a page
>is on the free list for that particular order
>area.
No. It actually indicates that the _buddy_ of the page is on the free
list for that particular order.
Basically each bit describes two pages of the order in question, which
is sufficient because while they have four states (both free, first
free, second free, neither free), we get the "other bit" of information
from the fact that we are just freeing one page - which obviously cannot
have been free before.
Thus the games with xor'ing the bit around, and looking at the old
state.
And no, most kernel programmers don't have to actually follow that piece
of code. Ugly but efficient.
Linus
prev parent reply other threads:[~2001-09-08 1:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-09-05 18:48 Buddy allocator - help! I thought I understood this Alex Bligh - linux-kernel
2001-09-05 20:44 ` Alex Bligh - linux-kernel
2001-09-08 1:47 ` Linus Torvalds [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='9nbtb3$o6i$1@penguin.transmeta.com' \
--to=torvalds@transmeta.com \
--cc=linux-kernel@vger.kernel.org \
/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