From: Andrew Morton <akpm@osdl.org>
To: James Morris <jmorris@intercode.com.au>
Cc: jgarzik@pobox.com, sds@epoch.ncsc.mil, torvalds@osdl.org,
viro@parcelfarce.linux.theplanet.co.uk, alan@lxorguk.ukuu.org.uk,
hch@infradead.org, greg@kroah.com, chris@wirex.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Add SELinux module to 2.5.74-bk1
Date: Tue, 8 Jul 2003 03:09:31 -0700 [thread overview]
Message-ID: <20030708030931.6864972b.akpm@osdl.org> (raw)
In-Reply-To: <Mutt.LNX.4.44.0307081942550.7740-100000@excalibur.intercode.com.au>
James Morris <jmorris@intercode.com.au> wrote:
>
> +int hashtab_replace(struct hashtab *h, void *key, void *datum,
> + void (*destroy)(void *k, void *d, void *args),
> + void *args)
> +{
> ...
> + newnode = kmalloc(sizeof(*newnode), GFP_KERNEL);
>From an API perspective, the GFP_KERNEL is a problem. Particularly as this
code seems to require that the caller perform the locking?
The GFP_KERNEL means that the locking _has_ to be via a sleeping lock
rather than a spinlock, and interrupt-time insertions are not possible.
Would be better to pass in the gfp_flags.
Comparing the complexity (size) of this code with the q-n-d hash tables
which are currently used one does wonder how useful it all will be. The
additional indirections are not needed with q-n-d hashes.
But if it doesn't significantly add to the overall selinux patch then I
guess it makes sense.
A slab cache for hashtab_nodes would probably save a bit of space.
otoh: It would be faster and more space-efficient to require that the
clients of ths code embed a hastab_node inside their structures and just
pass the address of that hastab_node into here. When they do a lookup they
retreive their original struct with container_of. That fixes the GFP_KERNEL
thing too.
next prev parent reply other threads:[~2003-07-08 9:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-03 17:44 Stephen Smalley
2003-07-03 17:51 ` Jeff Garzik
2003-07-03 17:55 ` Chris Wright
2003-07-03 17:56 ` Greg KH
2003-07-03 18:05 ` Stephen Smalley
2003-07-04 15:41 ` Jeff Garzik
2003-07-08 9:49 ` James Morris
2003-07-08 10:09 ` Andrew Morton [this message]
2003-07-08 13:20 ` James Morris
2003-07-08 13:45 ` Alan Cox
2003-07-08 15:00 ` James Morris
2003-07-08 11:33 ` Christoph Hellwig
2003-07-08 13:50 ` James Morris
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=20030708030931.6864972b.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=chris@wirex.com \
--cc=greg@kroah.com \
--cc=hch@infradead.org \
--cc=jgarzik@pobox.com \
--cc=jmorris@intercode.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@epoch.ncsc.mil \
--cc=torvalds@osdl.org \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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®