4285ch01.fm Draft Document for Review May 4, 2007 11:35 am
20 Linux Performance and Tuning Guidelines
We’ll take a look at Linux disk I/O subsystem to have better understanding of the components
which have large effect on system performance.
1.4.1 I/O subsystem architecture
Figure 1-18 on page20 shows basic concept of I/O sub system architecture
Figure 1-18 I/O subsystem architecture
For a quick understanding of overall I/O subsystem operations, we will take an example of
writing data to a disk. The following sequence outlines the fundamental operations that occur
when a disk-write operation is performed. Assuming that the file data is on sectors on disk
platters and has already been read and is on the page cache.
1. A process requests to write a file through the write() system call
2. The kernel updates the page cache mapped to the file
3. A pdflush kernel thread takes care of flushing the page cache to disk
4. The file system layer puts each block buffer together to a bio struct (refer to 1.4.3, “Block
layer” on page23) and submits a write request to the block device layer
5. The block device layer gets requests from upper layers and performs an I/O elevator
operation and puts the requests into the I/O request queue
device driver
block layer
VFS / file system layer
file
disk device
I/O Request queue
User process
sector
block buffer
bio
page cache page
cache
page
cache
Device driver
Disk
write()
pdflush
I/O scheduler