Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| konstantinbelousov:vm6 [2010/04/14 21:13] – KonstantinBelousov | konstantinbelousov:vm6 [2022/06/08 00:51] (current) – Add Category: Stale (lastmod 2011) KubilayKocak | ||
|---|---|---|---|
| Line 17: | Line 17: | ||
| When adding pages for the file region that is extended by write() call, I need to truncate file to larger size. Doing this using VOP_SETATTR() appears to be prohibitely costly, at least on UFS, because ffs_truncate() allocates the block for last byte and writes it. | When adding pages for the file region that is extended by write() call, I need to truncate file to larger size. Doing this using VOP_SETATTR() appears to be prohibitely costly, at least on UFS, because ffs_truncate() allocates the block for last byte and writes it. | ||
| - | I introduced new VOP_EXTEND() that extends the file for new size. Default implementation does VOP_GETATTR/ | + | When file is modified, suid bit shall be dropped. Doing it by VOP_GETATTR/ |
| + | |||
| + | I introduced new VOP_EXTEND() that extends the file for new size. Default implementation does VOP_GETATTR/ | ||
| Pressure on writers is another critical feature, both for performance and for responsivness of the system. I tried to do it simple, by counting number of pages dirtyfied by vnode_pager_write(), | Pressure on writers is another critical feature, both for performance and for responsivness of the system. I tried to do it simple, by counting number of pages dirtyfied by vnode_pager_write(), | ||
| Line 42: | Line 44: | ||
| sysbench: http:// | sysbench: http:// | ||
| - | Known issues and parts not done: | + | ==== Known issues and parts not done: ==== |
| - | 1. vm_page_queue_lock contention. | + | === vm_page_queue_lock contention |
| + | Jeff' concern is that the patch increases contention on vm_page_queue_lock, | ||
| - | Jeff' concern | + | === VOP_REALLOCBLKS === |
| - | vm_page_queue_lock, that is already highly contented. See sysbench | + | Currently, the behaviour of the system when appending to the file is the same as if the file is created, then extended, mmaped into address space and then mapped area is filled. It is known that this caused severe file fragmentation, |
| - | graph above. | + | |
| - | 2. VOP_REALLOCBLKS. | + | On the other hand, we have measured the current situation, and it is not much worse that for unpatched kernel. Patch contains the sequential write detection code. |
| + | vm6 branch contains the UFS fragmentation measurement tool, see tools/ | ||
| - | Currently, the behaviour | + | < |
| - | the same as if the file is created, | + | > I create some 200 files of various size in 1k increments. I then have |
| - | space and then mapped area is filled. It is known that this caused | + | > 60 threads that copy the files to a new location, in parallel. The |
| - | severe file fragmentation, | + | > files in the new location are then deleted. This is repeated 50 times. |
| - | adjusted writes. Something similar for VOP_REALLOCBLKS ought to be | + | > Finally |
| - | implemented for page flushes. | + | > originals are deleted. |
| - | + | </code> | |
| - | 2. Filesystem full handling. | + | |
| - | + | ||
| - | Similar to the item #2, the mode of operation makes it very hard to | + | |
| - | inform write(2) callers on the free space exhaustion. | + | |
| - | + | ||
| - | This could be fixed by tracking the space (not) claimed by VOP_EXTEND | + | |
| - | on the per-fs basis. | + | |
| - | + | ||
| - | 3. Unset setuid/setgid bits after write. | + | |
| - | + | ||
| - | When file is modified, suid bit shall be dropped. Doing it by | + | |
| - | VOP_GETATTR/ | + | |
| - | modified to also drop setuid/gid bit, and then called unconditionally | + | |
| - | on write. Or another VOP could be added. | + | |
| - | 5. Swap-backed md deadlock. | + | The measurement of the fragmentation with use of fragc shown that both unpatched and patched kernel give fragmentation <0.2%, with some variations +/- 40% of absolute value on each side. |
| - | Swap-backed md is deadlock-prone. When a page is not present in the | + | === Filesystem full handling === |
| - | swap object, vm_page_grab() is called. On the low free pages | + | Similar |
| - | condition, it VM_WAITs. On the other hand, pageout daemon may need to | + | |
| - | flush a page belonging | + | |
| - | producer/ | + | |
| - | hitting | + | |
| - | Some mitigation is presented in the patch, cleaning the dirtyfied | + | This could be fixed by tracking |
| - | pages immediately | + | |
| - | 6. Rangelocks implementation | + | === Swap-backed md deadlock === |
| + | Swap-backed md is deadlock-prone. When a page is not present in the swap object, vm_page_grab() is called. On the low free pages condition, it VM_WAITs. On the other hand, pageout daemon may need to flush a page belonging to the md swap object, causing producer/ | ||
| + | Some mitigation is presented in the patch, cleaning the dirtyfied pages immediately on low memory condition. | ||
| - | Rangelocks are implemented by msleep and mutex, suffering from the | + | === Rangelocks implementation is not optimal === |
| - | same double-wait queue inefficiency as old sx and lockmgr. | + | Rangelocks are implemented by msleep and mutex, suffering from the same double-wait queue inefficiency as old sx and lockmgr. |
| - | 7. fsync(2) and O_SYNC efficiency. | + | |
| - | fsync(2) and O_SYNC are implemented by vm_object_page_clean() for now. | + | === fsync(2) and O_SYNC efficiency === |
| - | Jeff has the plan to make walking the list of object dirty pages and | + | fsync(2) and O_SYNC are implemented by vm_object_page_clean() for now. vm_object_page_clean() was rewritten recently. |
| - | flushing them much more efficient. | + | === Possible opt-in for vmio from fs === |
| + | I think that new i/o path should be explicitely allowed by mnt_kern_flags bit. | ||
| - | 8. Possible opt-in for vmio from fs. | + | ---- |
| - | I think that new i/o path should be explicitely allowed by | + | {{tag> |
| - | mnt_kern_flags bit. | + | |