Skip to content

mm/gup, drm/i915: refactor gup_fast, convert to pin_user_pages()

John Hubbard dri-devel intel-gfx linux-mm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 2 repliesIn review
  2. v14 patches 5 repliesSuperseded 3 of 4 applied

Changes in v2 from the cover letter

* Fixed a bug in the refactoring patch: added FOLL_FAST_ONLY to the list of gup_flags *not* to WARN() on. This lead to a failure in the first intel-gfx-ci test run [1].

[1] https://lore.kernel.org/r/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4mm/gup: move __get_user_pages_fast() down a few lines in gup.cmm/gup.c+56 -560 replies
2/4mm/gup: refactor and de-duplicate gup_fast() codeinclude/linux/mm.h mm/gup.c+31 -330 replies
3/4mm/gup: introduce pin_user_pages_fast_only()include/linux/mm.h mm/gup.c+38 -00 replies
4/4drm/i915: convert get_user_pages() --> pin_user_pages()drivers/gpu/drm/i915/gem/i915_gem_userptr.c+13 -90 replies

Reviews trailers per patch

None of the 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChris Wilson
SeriesR-b
1/4
2/4
3/4
4/4

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

Read the v2 thread

Cover letter [PATCH v2 0/4] mm/gup, drm/i915: refactor gup_fast, convert to pin_user_pages()

The purpose of posting this series is to launch a test in the intel-gfx-ci tree. (The patches have already been merged into Andrew's linux-mm tree.)

This applies to today's linux.git (note the base-commit tag at the bottom).

Changes since V1:

* Fixed a bug in the refactoring patch: added FOLL_FAST_ONLY to the list of gup_flags *not* to WARN() on. This lead to a failure in the first intel-gfx-ci test run [1].

[1] https://lore.kernel.org/r/[email protected]

Original cover letter:

This needs to go through Andrew's -mm tree, due to adding a new gup.c routine. However, I would really love to have some testing from the drm/i915 folks, because I haven't been able to run-time test that part of it.

Otherwise, though, the series has passed my basic run time testing:
some LTP tests, some xfs and etx4 non-destructive xfstests, and an assortment of other smaller ones: vm selftests, io_uring_register, a few more. But that's only on one particular machine. Also, cross-compile tests for half a dozen arches all pass.

Details:

In order to convert the drm/i915 driver from get_user_pages() to pin_user_pages(), a FOLL_PIN equivalent of __get_user_pages_fast() was required. That led to refactoring __get_user_pages_fast(), with the following goals:

1) As above: provide a pin_user_pages*() routine for drm/i915 to call, in place of __get_user_pages_fast(),

2) Get rid of the gup.c duplicate code for walking page tables with interrupts disabled. This duplicate code is a minor maintenance problem anyway.

3) Make it easy for an upcoming patch from Souptick, which aims to convert __get_user_pages_fast() to use a gup_flags argument, instead of a bool writeable arg. Also, if this series looks good, we can ask Souptick to change the name as well, to whatever the consensus is. My initial recommendation is: get_user_pages_fast_only(), to match the new pin_user_pages_only().

John Hubbard (4):
mm/gup: move __get_user_pages_fast() down a few lines in gup.c mm/gup: refactor and de-duplicate gup_fast() code mm/gup: introduce pin_user_pages_fast_only() drm/i915: convert get_user_pages() --> pin_user_pages()

 drivers/gpu/drm/i915/gem/i915_gem_userptr.c |  22 +--
 include/linux/mm.h                          |   3 +
 mm/gup.c                                    | 153 ++++++++++++--------
 3 files changed, 109 insertions(+), 69 deletions(-)

base-commit: 051143e1602d90ea71887d92363edd539d411de5

Signature · 1 line
2.26.2