From: Charles Manning <manningc2@actrix.gen.nz>
To: linux-kernel@vger.kernel.org
Subject: Trying to use SLUB in an odd way
Date: Mon, 24 May 2010 14:39:48 +1200 [thread overview]
Message-ID: <201005241439.48373.manningc2@actrix.gen.nz> (raw)
Hi
YAFFS uses an internal almost slub-like allocator and I've been looking at
moving it to use SLUB as part of an attempt to mainline yaffs.
In yaffs I create a lot of tiny objects which are allocated in blocks, like
slub, and then managed in a free list. Very slubbish so far, but mine is far
less intelligent than slub.
The difference though is that I can keep the objects for each mount separate
and can dump the whole lot on umount without individually freeing objects. I
just deallocate my whole cache.
There are two problems that I encountered in moving to slub:
1) I want to keep each mount point separate, but slub just hooks up with an
existing cache of the same size. I managed to trick slub into keeping yaffs
objects in their own cache by assigning a fake ctor. That stops the
combination (well at present anyway - could easy change in the future like if
ctor gets dropped). Like a VW Bug: ugly but it gets you there....
2) If I dump a cache with existing in-use objects then slub gets upset and
dumps warnings. I don't like the idea of just ignoring warnings. I also don't
want to manually tear down trees etc when the existing "just dump it"
approach is a lot faster. Pity there is no "trust me I know what I'm doing"
flag.
Questions:
A) Is there a better way to use slub to do this or is it better to just
continue with my manual allocator?
B) Is it worth adding flags to kmem_cache_create() to say:
a) Don't combine this slub with others.
b) "Trust me I know what I'm doing": Allow the cache to be dumped with
objects still allocated.
If (B) makes sense I'll put together a patch.
-- Charles
reply other threads:[~2010-05-24 2:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=201005241439.48373.manningc2@actrix.gen.nz \
--to=manningc2@actrix.gen.nz \
--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;
as well as URLs for NNTP newsgroup(s).