public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: john moser <bluefoxicy@linux.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: krealloc()
Date: Sun, 11 Jan 2004 09:37:10 +0100	[thread overview]
Message-ID: <40010B36.4010306@colorfullife.com> (raw)

John Moser wrote:

>I'm not sure if I should just call mmap() inside the
>kernel (any security hazzards or whatnot I should be worried about there?), but
>it's going to be a pain to resize arrays.
>
mmap only works for user space memory, not for kernel memory.

>Most realloc() implimentations grow or shrink in place, if possible.  If they can't,
>or if that wasn't how they were coded, they allocate the new block, memcpy() over,
>then free the old block.
>
>  
>
The kmalloc implementation is object based, it cannot grow in place. The 
only approach is call ksize and check if it fits by chance, otherwise 
alloc new block and memcpy, then free.
Why do you need realloc? What do you want to do? Are you aware that 
kmalloc is limited to 128 kB, and that large kmallocs (I'd guess: > 16 
kB) can fail due to memory fragmentation after long uptimes?

--
    Manfred


             reply	other threads:[~2004-01-11  8:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-11  8:37 Manfred Spraul [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-01-11  4:42 krealloc() john moser

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=40010B36.4010306@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=bluefoxicy@linux.net \
    --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