Skip to content

grant-table: optimize grant copies when crossing page boundaries

David Vrabel xen-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 2 repliesIn review
  2. v23 patches 9 repliesSuperseded

Changes in v3 from the cover letter

- Fix regressions:
- Get writable frame if required so shared pages are unshared.
- Mark destination as dirty.
- s16 -> int.
- gnttab_copy_lock_domains() always unlocks on error.
- Use is_gref parameter in gnttab_copy_buf_valid().

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3grant-table: use uint16_t consistently for grant copy offset and lengthxen/common/grant_table.c+5 -50 replies
2/3grant-table: refactor grant copy to reduce duplicate codexen/common/grant_table.c xen/include/public/grant_table.h+192 -992 replies
3/3grant-table: defer releasing pages acquired in a grant copyxen/common/grant_table.c+66 -170 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchJan BeulichTim Deegan
1/3A-b
2/3R-b R-b
3/3R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCHv3 0/3] grant-table: optimize grant copies when crossing page boundaries

Netback tries (where possible) to minimize the number of copy ops in the to-guest direction (since acquiring a page is expensive) this reduces the number acquire operations at the expensive of more Rx slots and more frags in the guests.

By deferring the release of the pages we can optimize the case where the grant copier splits a copy into two operations to cross a page boundary (either to split a source GFN into two granted pages, or a two source into the same granted page).

This then allows netback to coalesce to-guest packets with minimal extra cost, reducing the number of slots needed and improving performance.

Changes in v3:
- Fix regressions:
- Get writable frame if required so shared pages are unshared.
- Mark destination as dirty.
- s16 -> int.
- gnttab_copy_lock_domains() always unlocks on error.
- Use is_gref parameter in gnttab_copy_buf_valid().

Changes in v2:
- Split refactor into separate patch.
- Use in struct grant_copy_ptr in struct grant_copy_buf.
- Various style fixes.

David