mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: linux-kernel@vger.kernel.org
Subject: Re: using kmalloc
Date: Wed, 20 Mar 2002 12:48:37 +0100	[thread overview]
Message-ID: <20020320114837.GA5421@artax.karlin.mff.cuni.cz> (raw)
In-Reply-To: <fa.l19uvvv.1hjmo8t@ifi.uio.no> <010101c1cfd3$8a87cfd0$1a02a8c0@allyourbase>

> kmalloc() allocates physically-contiguous pages of memory. Due to
> fragmentation, more than 64KB-128KB of contiguous pages might not be
> available, and hence kmalloc() will fail.

kmalloc allocates from generic slab caches. They come in sizes of powers
of 2 from 32B to 128KiB. The largest has slabs 128KiB large (on i386 at least).
Pages are allocated via __get_free_pages, so they have to be continuous.

However if you allocate namy instances of some structure, it's best to create
a kmem cache and allocate via kmem_cache_alloc (since it does not round the
requested size up to a power of two).

--------------------------------------------------------------------------------
                  				- Jan Hudec `Bulb' <bulb@ucw.cz>

  parent reply	other threads:[~2002-03-20 11:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.l19uvvv.1hjmo8t@ifi.uio.no>
2002-03-20  5:53 ` Dan Maas
2002-03-20 10:27   ` Alan Cox
2002-03-20 11:48   ` Jan Hudec [this message]
     [not found] <OFD9F443C5.CB1A619A-ON88256B81.005F0AD1@boulder.ibm.com>
2002-03-19 19:26 ` chiranjeevi vaka
2002-03-19 19:38   ` Tommy Reynolds
2002-03-19 16:18 chiranjeevi vaka
2002-03-19 16:41 ` Arnaldo Carvalho de Melo
2002-03-19 17:30   ` yodaiken

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=20020320114837.GA5421@artax.karlin.mff.cuni.cz \
    --to=bulb@ucw.cz \
    --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

all inboxes | Powered by JetHome®