mbox series

[v2,00/13] Simplify the external interface for GUP

Message ID 0-v2-987e91b59705+36b-gup_tidy_jgg@nvidia.com (mailing list archive)
Headers show
Series Simplify the external interface for GUP | expand

Message

Jason Gunthorpe Jan. 24, 2023, 8:34 p.m. UTC
It is quite a maze of EXPORTED symbols leading up to the three actual
worker functions of GUP. Simplify this by reorganizing some of the code so
the EXPORTED symbols directly call the correct internal function with
validated and consistent arguments.

Consolidate all the assertions into one place at the top of the call
chains.

Remove some dead code.

Move more things into the mm/internal.h header

v2:
 - Call the new flag FOLL_UNLOCKABLE
 - Revise comments around locked to reflect FOLL_UNLOCKABLE
 - s/lock_dropped/must_unlock/
 - Various grammer fixes
 - Add missing FOLL_UNLOCKABLE users populate_vma_page_range,
   faultin_vma_page_range
 - Make the mmap_lock assertion unconditional
 - Move internal FOLL_ flags to mm/internal.h
 - Rebase onto 41c457e96ba5 ("Merge branch 'mm-nonmm-unstable' into mm-everything")
v1: https://lore.kernel.org/r/0-v1-dd94f8f0d5ad+716-gup_tidy_jgg@nvidia.com

Jason Gunthorpe (13):
  mm/gup: have internal functions get the mmap_read_lock()
  mm/gup: remove obsolete FOLL_LONGTERM comment
  mm/gup: don't call __gup_longterm_locked() if FOLL_LONGTERM cannot be
    set
  mm/gup: move try_grab_page() to mm/internal.h
  mm/gup: simplify the external interface functions and consolidate
    invariants
  mm/gup: add an assertion that the mmap lock is locked
  mm/gup: remove locked being NULL from faultin_vma_page_range()
  mm/gup: add FOLL_UNLOCKABLE
  mm/gup: make locked never NULL in the internal GUP functions
  mm/gup: remove pin_user_pages_fast_only()
  mm/gup: make get_user_pages_fast_only() return the common return value
  mm/gup: move gup_must_unshare() to mm/internal.h
  mm/gup: move private gup FOLL_ flags to internal.h

 include/linux/mm.h       |  69 --------
 include/linux/mm_types.h |  62 ++++---
 mm/gup.c                 | 370 +++++++++++++++++++--------------------
 mm/huge_memory.c         |  10 --
 mm/internal.h            |  81 +++++++++
 5 files changed, 292 insertions(+), 300 deletions(-)


base-commit: 41c457e96ba51547c6e80b125dcba91aa6a00699

Comments

Jason Gunthorpe Feb. 6, 2023, 11:46 p.m. UTC | #1
On Tue, Jan 24, 2023 at 04:34:21PM -0400, Jason Gunthorpe wrote:
> It is quite a maze of EXPORTED symbols leading up to the three actual
> worker functions of GUP. Simplify this by reorganizing some of the code so
> the EXPORTED symbols directly call the correct internal function with
> validated and consistent arguments.
> 
> Consolidate all the assertions into one place at the top of the call
> chains.
> 
> Remove some dead code.
> 
> Move more things into the mm/internal.h header

Hi Andrew,

It has been about two weeks and I don't have a reason to respin it, so
please consider for this cycle.

Thanks,
Jason