4

In earlier 2.6.X kernels, pdflush was used and it would spawn more pdflush threads if all current pdflush threads were busy for a second (read from The Linux Page Cache and pdflush).

Since the 2.6.32 kernel, pdflush has been replaced by per-backing-device threads that are named flush-MAJOR (read from Linux 2 6 32 - Linux Kernel Newbies).

Is there a way to spawn multiple flush-MAJOR threads for a single backing device?

I am currently writing a large amount of data to a disk and while this is happening I am seeing the [flush-8:32] process at almost 100% cpu in top. I am wondering if there is a way to spawn more flush-MAJOR threads for a particular device that has a heavy I/O load. I don't know if it will help performance, but I would like to see what it does.

I saw evidence that multiple flusher threads per device should be supported in Flushing out pdflush:

After review of the first attempt, Jens added functionality of having multiple flusher threads per device based on the suggestions of Andrew Morton.

But I have no idea how to make this happen or if it happens automatically and I am missing it.

I am running RHEL 6.4 with a 2.6.32-358.el6.x86_64 kernel.

3
+50

You can't. There used to be a bdi_add_flusher_task() that got dropped around 2009 iirc. Also it was originally intended for filesystems but I don't think you're writing a filesystem :-)

But.. I can't see why you would have 100% cpu, that doesn't make sense - unless you're doing 10+ GB/s writes to some fantastic $100,000 array. RAM is so much faster than disk so you should have high iowait's but not high cpu.

Run atop and see where the cpu is actually being used, and break it down into system, user, irq and wait %.

Also check for other numbers that go high or hit warning or critical status like page scans etc.

If it's just high iowait % then that is expected, your disks are doing all they can and can't go faster, and the system is just waiting for them to read or write blocks.

Edit

I almost forgot to add this note as Kevin requested. I had another look but don't find any documentation as to why I remembered bdi_add_flusher_task() was dropped.

But in scanning Linux 3.2.0-67 source code that procedure does not exist, therefor it obviously must have been dropped somewhere, though I could easily be wrong about when :-)

2
2

Jens initially wanted to add a bdi_add_flusher_task() function to support multiple flusher threads per device, but it got aborted after discussion with Christoph Hellwig in the mail list, seeing details from bellow link: https://lore.kernel.org/patchwork/patch/169137/ So multiple flusher threads for a single device had never been merged into mainline.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.