pdflush writes back chunks of ~1000 pages. It currently takes a short
nap if it writes back no pages at all. That could cause it to write
back lots of small batches of pages, as it bounces against a congested
queue.
Change it to sleep if it failed to write back the entire batch against
a congested queue. Ths reduces the context switch rate a little.
The context switch rate is still fairly high (150/sec) - this appears
to be due to add_disk_randomness() scheduling a work function.
wbc.nr_to_write = MAX_WRITEBACK_PAGES;
writeback_inodes(&wbc);
min_pages -= MAX_WRITEBACK_PAGES - wbc.nr_to_write;
- if (wbc.nr_to_write == MAX_WRITEBACK_PAGES) {
- /* Wrote nothing */
+ if (wbc.nr_to_write > 0) {
+ /* Wrote less than expected */
if (wbc.encountered_congestion)
blk_congestion_wait(WRITE, HZ/10);
else