From: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
netdev@vger.kernel.org, Alexey Dobriyan <adobriyan@gmail.com>,
Octavian Purdila <tavi@cs.pub.ro>,
"David S . Miller" <davem@davemloft.net>
Subject: Re: [v3 00/39] faster tree-based sysctl implementation
Date: Mon, 23 May 2011 16:26:47 +0300 [thread overview]
Message-ID: <BANLkTinH7h2+Vj6o=c03FoPt3nAZ3VU0oQ@mail.gmail.com> (raw)
In-Reply-To: <m1mxid7of6.fsf@fess.ebiederm.org>
On Mon, May 23, 2011 at 12:32 PM, Eric W. Biederman
<ebiederm@xmission.com> wrote:
> Mostly it is simplicity. There is also the fact that the spin lock is
> used in the implementation of something that is essentially a
> reader/writer lock already.
The amount of time in which the spin lock is held in the current
implementation can be quite large: in __register_sysctl_paths:
https://github.com/mirrors/linux-2.6/blob/v2.6.39/kernel/sysctl.c#L1887
spin_lock(&sysctl_lock);
for (set = header->set; set; set = set->parent)
list_for_each_entry(p, &set->list, ctl_entry)
try_attach(p, header);
spin_unlock(&sysctl_lock);
For N=10^5 headers and try_attach=O(N) it's not a very good locking mechanism.
That's why I opted for a rwlock for each dir's subdirs/tables.
> In that context I'm not certain I am comfortable with separating proc
> inode usage from other proc usage. But I haven't read through that
> section of your code well enough yet to tell if you are making sense.
Proc inode usage (->count) was already separate from other proc usage (->use).
It was not separate from other header references (shared in ->count).
I separated the two because when I call unregister on a header I need
to decide whether to really unregister it (->unregistering=true and no
one can see this header and anything under it any more) or just
decrement a reference.
In the current implementation a header is only created by a
__register_sysctl_paths call and it's clear that at unregister we have
to set ->unregistering.
In my implementation headers are created dynamically to create new
directory elements. I need to know when to unregister such a header
regardless of any possible procfs inode references.
https://github.com/luciang/linux-2.6-new-sysctl/blob/v4-new-sysctl-alg/kernel/sysctl.c#L2390
I pushed a new version:
git://github.com/luciang/linux-2.6-new-sysctl.git v4-new-sysctl-alg
I undid int->u8 for ctl_procfs_refs.
I left the ->permissions hook get it's namespace form current->
because rewriting history for that change trips on too many patches
and a new parameter can be very easily added later when needed. Hope
this is ok with you.
I'd like to send patches for review to archs/drivers/etc. that
register only tables of files, not whole sysctl trees.
The patches don't depend on anything from this series.
Examples:
* http://thread.gmane.org/gmane.linux.kernel/1137032/focus=1137089
* http://thread.gmane.org/gmane.linux.kernel/1137032/focus=1137087
I'd like an OK-GO from you.
--
.
..: Lucian
prev parent reply other threads:[~2011-05-23 13:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-23 1:56 [v3 00/39] faster tree-based sysctl implementation Lucian Adrian Grijincu
2011-05-23 4:27 ` Eric W. Biederman
2011-05-23 5:59 ` Lucian Adrian Grijincu
2011-05-23 6:37 ` Lucian Adrian Grijincu
2011-05-23 9:32 ` Eric W. Biederman
2011-05-23 13:26 ` Lucian Adrian Grijincu [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='BANLkTinH7h2+Vj6o=c03FoPt3nAZ3VU0oQ@mail.gmail.com' \
--to=lucian.grijincu@gmail.com \
--cc=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tavi@cs.pub.ro \
/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).