more strict KPI for vm_pager_get_pages()

Gleb Smirnoff glebius at FreeBSD.org
Fri Aug 7 13:38:48 UTC 2015


  Hi!

  This is followup on older email:

https://lists.freebsd.org/pipermail/freebsd-arch/2015-April/017154.html

The preparatory commits were already checked in, and I'm going
to push next week the rest, since the whole story is already
several months due.

Planned changes:

o vm_pager_get_pages() accepts array of pages, and treats all pages
  equally. Notion of reqpage goes away.
o The array span validity must be checked before with vm_pager_has_page().
o All pages must be xbusied on enter.
o All pages will be left xbusied on exit. This closes possible races,
  allows to pass in wired pages (for any pager). And it leaves
  the caller to decide what to do with pages: vm_page_active,
  vm_page_deactivate, vm_page_flash or just vm_page_free them.

The patch has been tested by me and pho@ with his stress2 test.

I know, that there are two comments from kib@ on the patch.

1) There could be a user of KPI who would be fine with partial success.

My answer: right now there is none, and if one emerges, the code can
be easily adopted to return VM_PAGER_ERROR, but still mark validated
pages as valid. The user of KPI then can scan the array and take valid
pages. So, the patch doesn't put any obstacles on appearance of such
user.

2) Filesystems can do short reads by design, and thus fail to validate
   the entire array.

My answer: yes, that's true. By design NFS, SMBFS and FUSE should be
able to return short reads. However, the VOP_GETPAGES methods for all
three FSes right now do not have any code that would support that. So,
it looks like there is an open issue with these filesystems, not related
to my patch. When this issue is addressed in any of aforementioned FSes,
the VOP_GETPAGES should be fixed to do several I/Os in case of short
reads.

-- 
Totus tuus, Glebius.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vm_pager_get_pages.diff
Type: text/x-diff
Size: 57294 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20150807/72287e16/attachment.bin>


More information about the freebsd-arch mailing list