tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD truss(1), coredumper(1) and performance bottlenecks



On 24.05.2019 08:34, Michael van Elst wrote:
> n54%gmx.com@localhost (Kamil Rytarowski) writes:
> 
>> Observations:
>> 1. We can observe in both examples that there is a performance issue in
>> build.sh, as something attempts to call 5000 times read(2) for 1 byte onl=
>> y.
> 
> That's probably the shell that must read input byte by byte in most cases.
> 

Shouldn't that be optimized with libc functions? It calls read(2) for
each character.

> 
>> 2. Firefox and Thunderbird and certainly other similar software calls
>> excessively gettimeofday() and clock_gettime(). At least around 100k
>> times per 1 minute, and the program spends around 30sec (cumulative time
>>from all LWPs in a process) in the kernel space prompting for the
>> current time.
> 
> That's only a symptom. The real question is why it doesn't sleep.
> 
> 

This is a symptom, but this is not specific to a single application. In
my checks other programs like top(1) are relatively hungry for checking
for the current time. More than 70% syscalls from top(1) are for
__gettimeofday50() (but of course top(1) doesn't emit so many syscalls
in so short periods).

In NetBSD truss(1) we prompt for the current time for each event like a
syscall entry/exit of a traced process.

Jason Thorpe mentioned how to optimize it. As far as I understand, we
can create a page shared between userland and kernel, pass it through
AUXV vector and effectively replace all syscalls with memory reads.

I leave these observations as is for now here. Feel free to continue the
investigation.

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index