public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Octavian Purdila <tavi@cs.pub.ro>,
	"David S . Miller" <davem@davemloft.net>
Subject: Re: [PATCH 00/69] faster tree-based sysctl implementation
Date: Sun, 01 May 2011 15:49:33 -0700	[thread overview]
Message-ID: <m1r58i2g02.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <BANLkTi=NcpPQUGkR=pbOMPfMkyL7LiBeoA@mail.gmail.com> (Lucian Adrian Grijincu's message of "Sun, 1 May 2011 18:20:47 +0200")

Lucian Adrian Grijincu <lucian.grijincu@gmail.com> writes:

> On Sun, May 1, 2011 at 5:28 PM, Eric W. Biederman <ebiederm@xmission.com> wrote:
>>> The first patches remove the .child field of ctl_table. This is a
>>> requirement for the new algorithm. These patches are scattered all
>>> over the tree :(
>>
>> Only registering sysctl leaves seems very reasonable, the code has
>> been slowly moving in that direction for quite a while.
>>
>> We need to make it a firm rule that directories are created before
>> they are used. (aka normal filesystem semantics) before we churn
>> through and change everything.
>
>
> I don't understand what you want to say.
>
> Patch 60 makes sure that if a directory is not found a
> ctl_table_header will be created for it. That directory can be freed
> by anyone else when the reference count becomes 0.
> E.g. register /newdir/file1, register /newdir/file2, unregister
> /newdir/file1, unregister /newdir/file1
> - 1st registration created 'newdir' and takes a reference to it.
> - 2nd regisitration incs the reference count.
> - 1st unregister decs the reference count.
> - 2nd unregister decs the reference count which becomes 0 and frees 'newdir'.
>
> I may have misunderstood your comment.

While you can make directory lifetimes work by ref counting.  Making it
work by ref counting removes a concept of ownership and makes it hard to
see when a sysctl directory should exist.

If we are reforming this we should go all of the way and make strict
lifetime rules of directories.  So that it is required to do:

register newdir
register newdir/file1
unregister newdir/file1
unregister newdir

Today there is a WARN_ON in unregister_sysctl_table enforcing the
ordering that directories must come first and be removed after
the files in those directories.  If we change the table registrations
to only include leaves (as your removal of .child patches do) I
believe that rule becomes absolute.

That WARN_ON came in with Al Viro's last major sweep through the code,
and it started moving sysctl in the direction of a normal filesystem.
For long term maintainability and comprehensibility I think moving
sysctl in the direction of a normal filesystem makes a lot of sense.

>> Since we are touching most if not all of the sysctl registrations this
>> would also be a good time to pass a path string instead of the weird
>> ctl_path data structure.  We needed ctl_path when we had both binary
>> and proc paths to worry about but we no longer have that concern.
>
>
> I still find good use for it in the next patches (some optimisations).
> Getting rid of it makes some things more difficult:
> - I wouldn't like to parse strings into path components at registeration

I don't expect '/' being more difficult to deal with than an array.  In
general I expect a single string to be more space efficient and easier
for human comprehension.

> - users of the register_sysctl_paths would need to create strings with
> dynamic components (for example "net/conf/%s/" - where %s is a
> netdevice-name or "kernel/sched_domain/%s/%s" with cpu-name and
> domain-name).

This is a good point.

In the normal proc implementation this is solved by being able to
pass the equivalent of a ctl_table_header into the registration
function, which allows the use of relative paths in the registration
function.

In the examples you have given relative paths should also work for
sysctl.

Using string paths is not a must have but in practice I think it
simplifies things quite a bit

Eric

  reply	other threads:[~2011-05-01 22:49 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-01  1:35 [PATCH 00/69] faster tree-based sysctl implementation Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 01/69] sysctl: remove .child from dev/parport/default Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 02/69] sysctl: parport: reorder .child assignments to simplify review Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 03/69] sysctl: remove .child from dev/parport/PORT/devices/DEVICE Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 04/69] sysctl: remove .child from dev/parport/PORT/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 05/69] sysctl: remove .child from dev/parport/PORT/devices/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 06/69] sysctl: remove .child from kernel/vsyscall64 (x86) Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 07/69] sysctl: remove .child from abi/vsyscall32 (x86) Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 08/69] sysctl: remove .child from crypto/fips_enabled Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 09/69] sysctl: remove .child from dev/cdrom/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 10/69] sysctl: remove .child from dev/hpet/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 11/69] sysctl: remove .child from dev/ipmi/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 12/69] sysctl: remove .child from dev/rtc/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 13/69] sysctl: remove .child from dev/mac_hid/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 14/69] sysctl: remove .child from dev/raid/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 15/69] sysctl: remove .child from xpc/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 16/69] sysctl: remove .child from xpc/hb Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 17/69] sysctl: remove .child from kernel/sclp (s390) Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 18/69] sysctl: remove .child from dev/scsi Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 19/69] sysctl: remove .child from kernel/pty Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 20/69] sysctl: remove .child from coda/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 21/69] sysctl: remove .child from fscache/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 22/69] sysctl: remove .child from fs/nfs/ nlm_table table Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 23/69] sysctl: remove .child from fs/nfs/ nfs_cb_table Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 24/69] sysctl: remove .child from fs/ntfs-debug Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 25/69] sysctl: remove .child from fs/ocfs2/nm/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 26/69] sysctl: remove .child from fs/quota/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 27/69] sysctl: remove .child from fs/xfs/ Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 28/69] sysctl: remove .child from kernel/ (ipc) Lucian Adrian Grijincu
2011-05-01  1:35 ` [PATCH 29/69] sysctl: remove .child from fs/mqueue Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 30/69] sysctl: sched: add sd_table_template Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 31/69] sysctl: remove .child from kernel/sched_domain/cpuX/domainY/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 32/69] sysctl: remove .child from kernel/ (utsname) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 33/69] sysctl: remove .child from sunrpc/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 34/69] sysctl: remove .child from sunrpc/svc_rdma Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 35/69] sysctl: remove .child from sunrpc/ (xprtrdma) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 36/69] sysctl: remove .child from sunrpc/ (xprtsock) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 37/69] sysctl: remove .child from bus/isa/ (arm) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 38/69] sysctl: remove .child from reboot/warm (arm) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 39/69] sysctl: remove .child from lasat/ (mips) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 40/69] sysctl: remove .child from appldata/ (s390) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 41/69] sysctl: remove .child from s390dbf/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 42/69] sysctl: remove .child from vm/ (s390) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 43/69] sysctl: remove .child from kernel/perfmon/ (ia64) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 44/69] sysctl: remove .child from kernel/ (ia64/kdump) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 45/69] sysctl: remove .child from kernel/powersave-nap (powerpc) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 46/69] sysctl: remove .child from pm/ (frv) Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 47/69] sysctl: remove .child from frv/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 48/69] sysctl: remove .child from sh64/unaligned_fixup/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 49/69] sysctl: delete unused register_sysctl_table function Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 50/69] sysctl: remove .child from ax25 table Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 51/69] sysctl: remove .child from net/ipv4/route and net/ipv4/neigh tables Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 52/69] sysctl: remove .child from net/ipv4/neigh table Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 53/69] sysctl: remove .child from net/ipv6/route, net/ipv6/icmp, net/ipv6 tables Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 54/69] sysctl: remove .child from net/llc tables Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 55/69] sysctl: no-child: manually register kernel/random Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 56/69] sysctl: no-child: manually register kernel/keys Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 57/69] sysctl: no-child: manually register fs/inotify Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 58/69] sysctl: no-child: manually register fs/epoll Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 59/69] sysctl: no-child: manually register root tables Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 60/69] sysctl: faster tree-based sysctl implementation Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 61/69] sysctl: single subheader path: optimisation for paths used only once Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 62/69] sysctl: single subheader path: net/ipv4/conf/DEVICE-NAME/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 63/69] sysctl: single subheader path: net/{ipv4|ipv6}/neigh/DEV/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 64/69] sysctl: single subheader path: net/ipv6/conf/DEVICE-NAME/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 65/69] sysctl: single subheader path: dev/parport/PORT/devices/DEVICE/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 66/69] sysctl: single subheader path: net/ax25/DEVICE Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 67/69] sysctl: single subheader path: kernel/sched_domain/CPU/DOMAIN/ Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 68/69] sysctl: single subheader path: net/decnet/conf/DEVNAME Lucian Adrian Grijincu
2011-05-01  1:36 ` [PATCH 69/69] RFC: sysctl: convert read-write lock to RCU Lucian Adrian Grijincu
2011-05-01 11:07 ` [PATCH 00/69] faster tree-based sysctl implementation Lucian Adrian Grijincu
2011-05-01 15:28 ` Eric W. Biederman
2011-05-01 16:20   ` Lucian Adrian Grijincu
2011-05-01 22:49     ` Eric W. Biederman [this message]
2011-05-01 23:12       ` Lucian Adrian Grijincu
2011-05-02  3:06         ` Eric W. Biederman
2011-05-02  7:44           ` Lucian Adrian Grijincu
2011-05-02 19:02             ` Eric W. Biederman
2011-05-02 21:43               ` Lucian Adrian Grijincu
2011-05-01 23:34       ` Lucian Adrian Grijincu
2011-05-02  0:03         ` Lucian Adrian Grijincu
2011-05-02  3:26         ` Eric W. Biederman

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=m1r58i2g02.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=adobriyan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucian.grijincu@gmail.com \
    --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