Re: Large increase in context switch rate

From: Alex Nixon
Date: Fri Jul 25 2008 - 07:42:54 EST


>> I've bisected down to commit ba52de123d454b57369f291348266d86f4b35070 -
>> [PATCH] inode-diet. Before that kernbench consistently reports about
>> 35k context switches (total), and after that commit about 53k. The
>> benchmarks are being run on a tmpfs. I've verified the results on a
>> different machine, albeit with an almost identical setup (the same
>> kernels and debian distro, kernbench version, and benchmarking a build
>> of the same source).
>>
>> Seems to be a mystery why that patch is (seemingly) the culprit...

The relevant changeset had caused the blocksize to default to 1024 (as opposed
to 4096) - as a result there was a large increase in the time spent waiting on
pipes.

Instead of re-adding the line taken out of fs/pipe.c by Theodore I opted instead
to change the default block size for pseudo-filesystems to PAGE_SIZE, to try
avoid making pipe.c inconsistent with Theodore's new approach.

The performance penalty from these extra context switches is fairly small, but
is magnified when virtualization is involved, hence the desire to keep it lower
if possible.