From: Robert Love <rml@tech9.net>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: Martin Mares <mj@ucw.cz>, linux-kernel@vger.kernel.org
Subject: Re: [RFC] tree-based bootmem
Date: 19 Nov 2001 03:08:07 -0500 [thread overview]
Message-ID: <1006157288.869.0.camel@phantasy> (raw)
In-Reply-To: <20011117160134.A11913@holomorphy.com>
In-Reply-To: <20011117011415.B1180@holomorphy.com> <20011118001657.A467@ucw.cz> <20011117160134.A11913@holomorphy.com>
On Sun, Nov 18, 2001 at 12:16:57AM +0100, Martin Mares wrote:
> I don't understand why does it use segment trees instead of a simple
> linked list. Bootmem allocations are obviously not going to be time
> critical and shaving off a couple of ms during the boot process is
> not worth the extra complexity involved.
>
> (Nevertheless, treaps are a very nice structure...)
I think there is merit in using segment trees here. Previously I have
replied demonstrating the benefit of the finer granularity in
addressing, which results in a couple KB increase in total memory on my
machines. This is not the greatest benefit, IMO.
What really stands out to me is the design; and I think segment trees
are applicable here. While I doubt performance of the bootmem allocator
is ever a _terrible_ concern, it probably does have tight spots.
The beauty is in the implementation. With a linked list implementation,
you have an exhaustive search and and at-worst O(n) insertion and
searching complexity. We also don't end up with any clean way to say
"memory a belongs to x". This is where the segment tree comes in, a
segment tree stores intervals: it is a binary tree where each node
represents an interval from a to b. We only need to store nodes that
have allocated intervals of memory, and insertion is O(log n).
Searching is even easier as you just walk the intervals until we get to
what we want. Searching would be O(log(n+s)) where s is the number of
segments we had to walk. OK, you know this, but my point is its is
quite applicable. Besides a performance boost, we end up with a nice
way to interface with other code to work with bootmem and I think that
is the main benefit here.
Of course, the downside would be "good lord the complexity here is
grossly overkill" but I think this doesn't have that problem.
just my two bits,
Robert Love
next prev parent reply other threads:[~2001-11-19 8:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-17 9:14 [RFC] tree-based bootmem William Lee Irwin III
[not found] ` <20011118001657.A467@ucw.cz>
2001-11-18 0:01 ` William Lee Irwin III
2001-11-19 8:08 ` Robert Love [this message]
2001-11-26 21:02 ` Martin Mares
2001-11-21 16:20 ` William Lee Irwin III
2001-11-23 9:30 ` William Lee Irwin III
2001-11-28 9:04 ` Chris Wright
2001-11-28 12:40 ` William Lee Irwin III
2001-11-29 0:33 ` Chris Wright
2001-11-29 1:23 ` William Lee Irwin III
2001-11-30 2:29 ` Robert Love
2001-12-02 6:59 ` William Lee Irwin III
2001-12-02 7:08 ` Anton Blanchard
[not found] <20011118005819.3762.qmail@science.horizon.com>
2001-11-18 1:24 ` William Lee Irwin III
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=1006157288.869.0.camel@phantasy \
--to=rml@tech9.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mj@ucw.cz \
--cc=wli@holomorphy.com \
/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