All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: Paul Jackson <pj@sgi.com>
Cc: akpm@osdl.org, James.Bottomley@steeleye.com,
	linux-kernel@vger.kernel.org
Subject: Re: [TEST PATCH 3/3] lib bitmap region restructure
Date: Sun, 22 Jan 2006 17:03:20 +0200	[thread overview]
Message-ID: <20060122150320.GA19211@linux-sh.org> (raw)
In-Reply-To: <20060120015643.11e8707c.pj@sgi.com>

[-- Attachment #1: Type: text/plain, Size: 2708 bytes --]

On Fri, Jan 20, 2006 at 01:56:43AM -0800, Paul Jackson wrote:
> Ah - I guess my problem is that I believed James code comment:
> 
>  * This is used to allocate a memory region from a bitmap.  The idea is
>  * that the region has to be 1<<order sized and 1<<order aligned (this
>  * makes the search algorithm much faster).
> 
> I thought this meant that it was a design requirement (the "idea")
> to have the alignment always be (1 << order).  Apparently it was
> just a useful performance tweak, for the sub-word sizes.
> 
> Apparently for the multiword case you are adding, you recommend going
> for tighter packing of the allocated regions, rather than extending
> the alignment constraint past a single word.
> 
From a performance point of view going the (1 << order) route for
alignment and searching is much faster. I'm not too tightly bound to the
notion of tightly packing the allocated regions, that was just the
behaviour my implementation was following originally.

Speeding up the searches should take priority for this, though I expect
there's going to be very few corner cases where the search time is of
real relevance (primarily given the fact that it can only handle the <=
BITS_PER_LONG case now).

To give you an example of my use case, I have a 64MB chunk of address
space at a fixed virtual range in the SH-4 processors, which can be
accessed by both the kernel and userspace (unfortunately the address
range is in the mapped peripheral space, which exceeds TASK_SIZE, so
relying even on a custom ->get_unmapped_area() to prep the VMA location
and ->mmap() to setup the mappings simply isn't going to work).

Based off of this, I've got a bitmap for covering this space that both
the kernel and userspace interfaces hook in to to carve up the address
space amongst themselves, and it's not uncommon to map large memory
apertures (32M or so) through this space all at once, particularly in the
case where VRAM is remapped to parallelize with DMA for faster
throughput.

> The performance of bitmap_find_free_region() becomes essentially
> O(N**2) rather than O(Log2 N).  The search loop would scan forward
> with REG_OP_ISFREE from each word in succession, until it found
> the requested sequence of free words, rather than scanning just
> from the words on (1 << order) bits alignment.  Since it looks in
> more places, the worst case times are longer.
> 
Yes, I think given this your patch 3/3 should be mostly fine as is. I've
gotten around to testing it in practice now and everything seems to hold
up. I'll clean up the comments a bit and submit the patch set to Andrew,
who I'm sure is rather tired of hearing about this by now :-)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

      reply	other threads:[~2006-01-22 15:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-20  2:07 [TEST PATCH 1/3] lib bitmap region cleanup Paul Jackson
2006-01-20  2:08 ` [TEST PATCH 2/3] lib bitmap region multiword Paul Jackson
2006-01-20  2:08 ` [TEST PATCH 3/3] lib bitmap region restructure Paul Jackson
2006-01-20  8:13   ` Paul Mundt
2006-01-20  9:56     ` Paul Jackson
2006-01-22 15:03       ` Paul Mundt [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=20060122150320.GA19211@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.