Re: [PATCH 22/23] sysctl arm: Remove binary sysctl support

From: Andi Kleen
Date: Mon Nov 09 2009 - 08:28:38 EST


On Mon, Nov 09, 2009 at 04:41:44AM -0800, Eric W. Biederman wrote:
> >> >> The glibc pthread code that uses sysctl has no problems if sys_sysctl
> >> >> is gone. It both falls back to reading /proc/sys and it just controls
> >> >> an optimization and the code works with either result. Been there,
> >> >> done that.
> >> >
> >> > /proc/sys is much slower than sysctl though. So you made program startup
> >> > slower.
> >>
> >> Not much slower, but slower. I just measured it in a case that favors
> >> sysctl and the ration is about 5:2. Or sysctl is about 2.5x faster.
> >> About 49usec for open/read/close on proc and 19usec for sysctl.
> >> In my emulation it is a bit slower than that.
> >
> > That's not good.
>
> Why?

Because it slows down a very common path.

> >
> > a) all
> > b) common ones used by glibc and perhaps a few others only
> > c) none
> >
> > I suspect most users would use (b), in fact (c) might be redundant
> > if (b) is cheap enough (which it should be)
>
> Next year I expect b == c.

Only if you ignore ABI compatibility.

>
> If you think we need something better additional patches to sysctl_binary.c
> are welcome. Just add your custom fast path before the through the
> VFS.

I think sysctl_binary should be just stripped down for common sysctls
(at least with a CONFIG)

> > Hmm? There's plenty of glibc code that uses the binary sysctl.
>
> Where? I grepped glibc today. The only use in a recent glibc is
> in glibc-ports for the support of arm inb/outb. The only other
> use in older glibc was checking to see if we ran on an SMP kernel.

That older glibc is widely deployed. And it won't go away next year.

> >> Ultimately what drives me most is that people are still accidentally
> >> adding binary sysctls, which no one uses or tests. For a recent
> >> example see:
> >
> > Yes I agree new binary sysctls should just be deprecated right now.
>
> Good. The only way to keep new ones from showing up is to that I know
> of is to move everything into an emulation layer. I have done the heavy
> lifting there and everything is emulated using the exact same code.

I agree with that.

I just think you should have two flavours of emulation layer:
full and "common sysctls". This can be probably done with the same
code and some strategic ifdefs.

-Andi
--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/