All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: Carl-Daniel Hailfinger <c-d.hailfinger.kernel.2004@gmx.net>
Cc: Jens Axboe <axboe@suse.de>, Robert Love <rml@novell.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] [PATCH] kmem_alloc (generic wrapper for kmalloc and vmalloc)
Date: Wed, 10 Nov 2004 09:17:00 -0800	[thread overview]
Message-ID: <52k6st1v5f.fsf@topspin.com> (raw)
In-Reply-To: <419249D8.1030100@gmx.net> (Carl-Daniel Hailfinger's message of "Wed, 10 Nov 2004 18:03:20 +0100")

    Carl-Daniel> OK, so how should I allocate memory for 512 struct
    Carl-Daniel> loop_device's?  Because of its odd size (304 bytes)
    Carl-Daniel> it seems that if I use kmalloc seperately for each
    Carl-Daniel> struct, I'd waste 208 bytes per allocation. 68%
    Carl-Daniel> overhead would be a step backwards. Or am I missing
    Carl-Daniel> something here?

Would creating your own slab cache with kmem_cache_create() and
allocating with kmem_cache_alloc() work?  You can fit 13 304 byte
objects in a 4K page, which wastes 4096 - 13*304 = 144 bytes per page
or about 11 bytes per object.  Less than 4% overhead seems OK to me.

 - R.

  reply	other threads:[~2004-11-10 17:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-10  5:19 [RFC] [PATCH] kmem_alloc (generic wrapper for kmalloc and vmalloc) Carl-Daniel Hailfinger
2004-11-10  6:03 ` Robert Love
2004-11-10  6:31   ` Carl-Daniel Hailfinger
2004-11-10  6:57     ` Robert Love
2004-11-10  7:10     ` Nick Piggin
2004-11-10 13:36     ` Geert Uytterhoeven
2004-11-10  7:54   ` Jens Axboe
2004-11-10 17:03     ` Carl-Daniel Hailfinger
2004-11-10 17:17       ` Roland Dreier [this message]
2004-11-10 17:54     ` Adam Heath
2004-11-10 18:04       ` Jens Axboe

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=52k6st1v5f.fsf@topspin.com \
    --to=roland@topspin.com \
    --cc=axboe@suse.de \
    --cc=c-d.hailfinger.kernel.2004@gmx.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@novell.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.