John Hubbard 07d8026995 mm: devmap: refactor 1-based refcounting for ZONE_DEVICE pages
An upcoming patch changes and complicates the refcounting and especially
the "put page" aspects of it.  In order to keep everything clean,
refactor the devmap page release routines:

* Rename put_devmap_managed_page() to page_is_devmap_managed(), and
  limit the functionality to "read only": return a bool, with no side
  effects.

* Add a new routine, put_devmap_managed_page(), to handle decrementing
  the refcount for ZONE_DEVICE pages.

* Change callers (just release_pages() and put_page()) to check
  page_is_devmap_managed() before calling the new
  put_devmap_managed_page() routine.  This is a performance point:
  put_page() is a hot path, so we need to avoid non- inline function calls
  where possible.

* Rename __put_devmap_managed_page() to free_devmap_managed_page(), and
  limit the functionality to unconditionally freeing a devmap page.

This is originally based on a separate patch by Ira Weiny, which applied
to an early version of the put_user_page() experiments.  Since then,
Jérôme Glisse suggested the refactoring described above.

Link: http://lkml.kernel.org/r/20200107224558.2362728-5-jhubbard@nvidia.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Suggested-by: Jérôme Glisse <jglisse@redhat.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Cc: Björn Töpel <bjorn.topel@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Leon Romanovsky <leonro@mellanox.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-01-31 10:30:37 -08:00
..
2019-08-09 09:15:05 +02:00
2019-12-05 11:43:31 -08:00
2019-09-16 09:56:27 -07:00
2019-12-11 09:12:38 +01:00
2019-11-12 11:43:29 -05:00
2020-01-27 10:30:42 -08:00
2019-07-08 09:54:55 -07:00
2020-01-27 14:35:32 +01:00
2020-01-29 18:16:16 -08:00
2020-01-23 12:37:18 +00:00
2019-12-18 18:07:32 +01:00
2020-01-29 18:16:16 -08:00
2019-11-26 10:26:26 +01:00
2020-01-23 00:35:50 +01:00
2019-09-23 11:21:04 -07:00
2019-10-09 19:33:43 -07:00
2019-06-24 10:23:16 +02:00
2019-11-28 11:16:43 -08:00
2020-01-27 10:55:50 -08:00
2019-12-03 11:20:37 +01:00
2019-09-05 19:52:33 -06:00
2020-01-27 11:09:31 +01:00
2019-12-05 12:27:16 -08:00
2020-01-18 09:19:18 -05:00
2020-01-13 21:48:42 +01:00
2019-09-25 09:55:59 -07:00
2019-12-11 12:22:38 -08:00
2019-11-20 09:40:10 +01:00
2019-11-27 11:06:20 -08:00
2019-12-01 12:59:06 -08:00
2019-09-05 11:40:54 +02:00
2020-01-03 09:33:24 +01:00
2019-11-08 08:46:49 -08:00
2019-07-05 21:34:50 +02:00
2019-06-26 13:19:46 -07:00
2019-10-04 12:31:46 -07:00
2019-10-15 13:34:25 +02:00
2019-11-11 09:02:56 +01:00
2019-12-04 19:44:14 -08:00
2019-12-11 09:12:38 +01:00
2019-07-08 19:36:47 -07:00
2019-09-02 11:43:54 +01:00
2019-12-09 10:36:44 -08:00
2019-10-15 20:40:06 -07:00
2019-09-05 12:32:05 +02:00
2019-09-29 10:33:41 -07:00
2019-12-06 10:28:09 -08:00
2019-12-10 10:11:00 +01:00
2019-08-14 15:30:35 +02:00
2019-08-08 09:09:25 +02:00
2019-11-14 19:06:47 -08:00
2019-11-06 08:55:23 -05:00
2019-10-09 12:06:19 -04:00
2019-11-06 08:55:23 -05:00
2020-01-14 12:20:48 +01:00
2019-07-26 17:01:29 -06:00
2019-12-11 16:37:02 +08:00
2019-11-13 19:09:47 +08:00
2020-01-16 17:09:18 +01:00
2019-12-03 13:58:22 -08:00
2019-07-16 19:23:25 -07:00
2019-12-06 10:47:28 +01:00
2019-06-15 12:25:49 +02:00
2020-01-13 18:16:43 -08:00
2019-12-06 10:28:09 -08:00
2019-08-23 16:39:26 +01:00
2020-01-10 14:00:58 -08:00
2020-01-24 10:24:31 -08:00
2020-01-24 10:24:31 -08:00
2019-12-05 11:43:31 -08:00
2019-10-19 22:55:46 +02:00
2019-11-14 13:07:48 +08:00
2020-01-29 19:38:34 -08:00
2019-10-10 14:55:24 -07:00
2019-12-01 06:29:17 -08:00
2019-11-13 12:15:34 -08:00
2020-01-13 18:31:48 -08:00
2020-01-29 19:38:34 -08:00
2019-11-13 00:33:21 +11:00
2020-01-26 15:28:47 +01:00
2019-11-07 07:00:26 +01:00
2019-08-30 07:27:17 -07:00
2019-08-01 20:51:22 +02:00
2019-07-31 19:03:35 +02:00
2019-12-10 10:11:00 +01:00
2019-12-01 14:00:59 -08:00
2020-01-14 12:20:48 +01:00
2019-11-14 12:20:02 +08:00
2019-07-14 16:51:47 -07:00
2020-01-17 22:33:37 -05:00