Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 5 Mar 2011 20:49:46 -0500
From:      "illoai@gmail.com" <illoai@gmail.com>
To:        Jeremy Chadwick <freebsd@jdc.parodius.com>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Strange performance issue with grep -r -i as non-root user
Message-ID:  <AANLkTim1UVqh-5ByawpfJc209vad4hGToAebPubdeLKm@mail.gmail.com>
In-Reply-To: <20110306014355.GA36763@icarus.home.lan>
References:  <20110305234514.GA34594@icarus.home.lan> <20110306010140.GA90699@lava.net> <20110306014355.GA36763@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5 March 2011 20:43, Jeremy Chadwick <freebsd@jdc.parodius.com> wrote:
> On Sat, Mar 05, 2011 at 03:01:40PM -1000, Clifton Royston wrote:
>> On Sat, Mar 05, 2011 at 03:45:14PM -0800, Jeremy Chadwick wrote:
>> > This is a strange one, and the more I started debugging it (starting
>> > with truss, comparing fast vs. slow results, where all that appears
>> > different is read() operations are taking a lot longer -- I haven't ha=
d
>> > time to check with ktrace yet), the more strange it got: that's when I
>> > found out the behaviour changes depending on if you're a user or root.
>> >
>> > Easy to reproduce:
>> >
>> > - grep -r string /usr/src, as non-root, is fast
>> > - grep -r -i string /usr/src, as non-root, is 8x slower than without -=
i
>>
>> =A0 From your results below, I think you mean *80* x slower!
>
> Oops; yes, typo on my part. =A0I was never any good at math either! =A0;-=
)
>
>> > - grep -r string /usr/src, as root, is fast
>> > - grep -r -i string /usr/src, as root, is fast
>>
>> =A0 I can not reproduce this on 7.3-RELEASE-p4; I get consistent results
>> between root and non-root, with -i being only marginally slower (about
>> 15%) for each; results below.
>
> Your results look more or less like what I see on the 4th system (the
> 7.0-STABLE one). =A0I believe the speed difference there (and on your
> system) is justified, as I would imagine strcasecmp() a tiny bit slower
> than strcmp(). =A0But an 80x slowdown is completely unacceptable,
> especially given the conditions.
>
> My first thought was "compiler optimisation bug?", which I suppose could
> still be the case, but I don't know how root vs. non-root would change
> that behaviour, not to mention only when -i was specified.
>
> Using 'truss -d' it looks like the slowdown is happening on read(2),
> which makes me very concerned, as it could indicate something odd going
> on with CAM? =A0Sadly I cannot (for many reasons) get rid of ahci.ko on
> any of those 3 systems, so I can't compare stock ata(4) to ahci.ko
> easily on the same system.
>

On my 8.2-RELEASE system using ahci (built into the custom
kernel) I don't notice your observed slowdown, so unless ahci
is radically different on -STABLE I doubt it's the cause.

--=20
--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim1UVqh-5ByawpfJc209vad4hGToAebPubdeLKm>