Re: -mm merge plans for 2.6.23

From: Valdis . Kletnieks
Date: Wed Jul 25 2007 - 03:15:04 EST


On Wed, 25 Jul 2007 07:30:37 +0200, Rene Herman said:

> Yes, but what's locate's usage scenario? I've never, ever wanted to use it.
> When do you know the name of something but not where it's located, other
> than situations which "which" wouldn't cover and after just having
> installed/unpacked something meaning locate doesn't know about it yet either?

My favorite use - with 5 Fedora kernels and as many -mm kernels on my laptop,
doing a 'locate moby' finds all the moby.c and moby.o and moby.ko for
the various releases. For bonus points, something like:

ls -lt `locate iwl3945.ko`

to find all 19 copies that are on my system, and remind me which ones were
compiled when. Or just when you remember the name of some one-off 100-line
Perl program that you wrote 6 months ago, but not sure which directory you
left it in... ;)

You want hard numbers? Here you go - 'locate' versus 'find'
(/usr/src/ has about 290K files on it):

% strace locate iwl3945.ko >| /tmp/foo3 2>&1
% wc /tmp/foo3
96 592 6252 /tmp/foo3
% strace find /usr/src /lib -name iwl3945.ko >| /tmp/foo4 2>&1
% wc /tmp/foo4
328380 1550032 15708205 /tmp/foo4

# echo 1 > /proc/sys/vm/drop_caches (to empty the caches

% time locate iwl3945.ko > /dev/null

real 0m0.872s
user 0m0.867s
sys 0m0.008s

% time find /usr/src /lib -name iwl3945.ko > /dev/null
find: /usr/src/lost+found: Permission denied

real 1m12.241s
user 0m1.128s
sys 0m3.566s

So 96 system calls in 1 second, against 328K calls in a minute. There's your
use case, right there. Now if we can just find a way for that find/updatedb
to not be as painful to the rest of the system.....




Attachment: pgp00000.pgp
Description: PGP signature