From: David Woodhouse <dwmw2@infradead.org>
To: dipankar@in.ibm.com
Cc: hch@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] kmem_cache_zalloc
Date: Thu, 28 Mar 2002 11:25:12 +0000 [thread overview]
Message-ID: <20520.1017314712@redhat.com> (raw)
In-Reply-To: <20020328165142.A23089@in.ibm.com>
dipankar@in.ibm.com said:
> I thought that the life span of an object is between
> kmem_cache_alloc and kmem_cache_free. If you are expecting caching
> beyond this, you may not get correct data. kmem_cache allocator is
> supposed to quickly allocate fixed size structures avoiding the need
> for frequent splitting and coalescing in the allocator.
> Am I missing something here ?
Yes. Slab objects can be initialised once when a new page is added to the
slab, and returned to the slab in reusable form so that you don't have the
cost of complete initialisation on each allocation.
So if for example you have a semaphore in your slab object, instead of
initialising it on each kmem_cache_alloc() you do it once when the new pages
are added to the slab. Then you just make sure it's unlocked each time you
free a slab object.
--
dwmw2
next prev parent reply other threads:[~2002-03-28 11:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-28 11:21 [RFC] kmem_cache_zalloc Dipankar Sarma
2002-03-28 11:25 ` David Woodhouse [this message]
2002-03-28 11:40 ` Dipankar Sarma
-- strict thread matches above, loose matches on Subject: below --
2002-03-27 19:39 Eric Sandeen
2002-03-27 19:47 ` Andrew Morton
2002-03-27 19:52 ` Tigran Aivazian
2002-03-27 20:17 ` Alan Cox
2002-03-29 22:17 ` Pavel Machek
2002-03-29 23:21 ` Alan Cox
2002-03-27 20:19 ` Christoph Hellwig
2002-03-27 20:23 ` Jeff Garzik
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=20520.1017314712@redhat.com \
--to=dwmw2@infradead.org \
--cc=dipankar@in.ibm.com \
--cc=hch@infradead.org \
--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