Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the linux page cache flush order

There is page cache before we write data to disk.

So if I have two operations.

write(fileA)
write(fileB)

Then if the system is suddenly shutdown. We don't initiative call the sync() call.

I want to know if it is possible that the data we wrote to fileB has flush to the disk, while the data we wrote to fileA haven't been flush to the disk?

like image 532
baotiao Avatar asked Nov 03 '14 03:11

baotiao


People also ask

What is page cache Linux?

The page cache is the main disk cache used by the Linux kernel. In most cases, the kernel refers to the page cache when reading from or writing to disk. New pages are added to the page cache to satisfy User Mode processes's read requests.

What causes TLB flush?

TLB flushing can be triggered by various virtual memory operations that change the page table entries like page migration, freeing pages etc. that particular TLB entry is invalidated in all of the cores ... by the OS.


1 Answers

I believe that it is possible for fileB to be written to disk before fileA, as the writes will be bundled into block I/O requests and can be reordered at the block device layer by the I/O scheduler in an attempt to minimise disk seeking.

See the kernel documentation for more info about the I/O scheduler (elevator): http://lxr.free-electrons.com/source/Documentation/block/biodoc.txt#L885

like image 191
austinmarton Avatar answered Oct 11 '22 17:10

austinmarton