[haiku-gsoc] Re: Implementation Queries

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Wed, 28 Jun 2017 15:17:47 +0200

Am 28/06/2017 um 14:36 schrieb François Revol:

Le 28/06/2017 à 14:28, Hamish Morrison a écrit :
On Wed, Jun 28, 2017 at 12:46 PM, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote:
But if there is a flag called CONTIGUOUS_MEMORY, the software that does not
specify it, and rely on the memory block being contiguous, is buggy.

That's the thing - I don't think there is a flag - so it's hard to
tell which users of it actually need contiguous memory and which users
are just using it as a general allocation function.

The problem is kmalloc only allocates contiguous memory, and doesn't
have a flag asking otherwise, which is indeed silly:

https://www.kernel.org/doc/htmldocs/kernel-api/API-kmalloc.html
http://www.makelinux.net/ldd3/chp-8-sect-1

kzalloc is only passing the flags to kmalloc.

Maybe we could try only doing so for GFP_DMA, but that's risky.

Then I guess the best course of action is to have kmalloc() always return contiguous memory, too, and try that GFP_DMA thing later on.

Vivek, you could probably reuse parts of the boot loader's heap implementation for that; it's very simplistic. If you need something more advanced, I guess one of the debug heaps could be helpful, too.

Bye,
   Axel.

Other related posts: