Can small writes generate a lot of faults?

Greg Freemyer greg.freemyer at gmail.com
Mon Apr 22 09:20:39 EDT 2013



Mulyadi Santosa <mulyadi.santosa at gmail.com> wrote:

>Hi :)
>
>On Sat, Apr 20, 2013 at 4:42 AM, Daniel Hilst Selli
><danielhilst at gmail.com> wrote:
>> AFAIK, major page faults are generated when data that is not yet
>present
>> on RAM is loaded from disk, but in this case data is being write do
>> disk, I can't
>> see how writes can generate faults, but still, it seems that is
>> happening, ... !?
>>
>> Is that possible?
>
>I never pay close attention on these kind of stuffs, but IMHO there is
>a chance that this "write" is actually "update"

I missed the original email, but the kernel filesystem logic typically works with 4 KB pages.  If a write lands on page boundaries then the file system will do pure writes, but if it doesn't then the filesystem will typically read the original page from disk then update it and write it back out.   

Small writes of 4 kb as an example that are not page aligned will cause 2 pages to read, both to be updated and both to be written.

Adding raid 5/6 below the file system layer greatly accelerates the problem.  Now you need to ensure your writes are the full size of a stripe and stripe aligned to avoid the read/update/write sequence.  Some filesystems build knowledge of stripes into them to try and optimize this process, some don't.

Greg



-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.



More information about the Kernelnewbies mailing list