From: "Serge E. Hallyn" <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
To: Li Zefan <lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: Linux Containers
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: Re: [RFC][PATCH] devcg: cache the last matched whitelist item
Date: Tue, 14 Apr 2009 09:29:53 -0500 [thread overview]
Message-ID: <20090414142953.GB6072@us.ibm.com> (raw)
In-Reply-To: <49E3E075.6050103-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Quoting Li Zefan (lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org):
> While I was doing testing by open/close files like this:
> for (i = 0; i < LOOP; i++) {
> fd = open("/dev/null");
> close(fd);
> }
> It got a bit slower when devcg is used, so I made this patch
> to speed it up.
>
> But walking through whitelist in devcgroup_inode_permission()
> doesn't seem to be a hot-path, if so this patch probably doesn't
> worth it, and it may not work well under real workload.
>
> Just post it to see if someone thinks it's useful.
Well there is a tendency of some software to repeatedly try to
open the same device - for instance sendmail opens /dev/null a
few times during startup. But I don't think 4-6 times during startup
justifies a hack like this.
OTOH I didn't expect the lookup to stay a linear linked list walk for
this long :) I'd be interested to hear the typical size of a whitelist
in your or openvz's experience, so we could see if a hash fn or some
other speedup makes sense. We also could consider taking a few entries
- like /dev/{u,}random, /dev/null, /dev/console, and /dev/zero, and
taking them out of the loop.
How much of a slow-down were you seeing in your loop, and how many
whitelist entries did you have?
-serge
prev parent reply other threads:[~2009-04-14 14:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-14 1:01 [RFC][PATCH] devcg: cache the last matched whitelist item Li Zefan
[not found] ` <49E3E075.6050103-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-04-14 14:29 ` Serge E. Hallyn [this message]
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=20090414142953.GB6072@us.ibm.com \
--to=serue-r/jw6+rmf7hqt0dzr+alfa@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=lizf-BthXqXjhjHXQFUHtdCDX3A@public.gmane.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