From: Boris Brezillon <boris.brezillon@collabora.com>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Cc: "Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Christian König" <christian.koenig@amd.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Qiang Yu" <yuq825@gmail.com>,
"Steven Price" <steven.price@arm.com>,
"Frank Binns" <frank.binns@imgtec.com>,
"Matt Coster" <matt.coster@imgtec.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
kernel@collabora.com
Subject: Re: [PATCH v20 09/10] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin
Date: Wed, 2 Apr 2025 15:21:02 +0200 [thread overview]
Message-ID: <20250402152102.01d9cfee@collabora.com> (raw)
In-Reply-To: <710cdbd4-2c6e-48b7-b12b-972ab6d12abf@collabora.com>
On Wed, 2 Apr 2025 15:58:55 +0300
Dmitry Osipenko <dmitry.osipenko@collabora.com> wrote:
> On 4/2/25 15:47, Thomas Zimmermann wrote:
> > Hi
> >
> > Am 22.03.25 um 22:26 schrieb Dmitry Osipenko:
> >> The vmapped pages shall be pinned in memory and previously get/
> >> put_pages()
> >> were implicitly hard-pinning/unpinning the pages. This will no longer be
> >> the case with addition of memory shrinker because pages_use_count > 0
> >> won't
> >> determine anymore whether pages are hard-pinned (they will be soft-
> >> pinned),
> >> while the new pages_pin_count will do the hard-pinning. Switch the
> >> vmap/vunmap() to use pin/unpin() functions in a preparation of addition
> >> of the memory shrinker support to drm-shmem.
> >
> > I've meanwhile rediscovered this patch and I'm sure this is not correct.
> > Vmap should not pin AFAIK. It is possible to vmap if the buffer has been
> > pinned, but that's not automatic. For other vmaps it is necessary to
> > hold the reservation lock to prevent the buffer from moving.
Hm, is this problematic though? If you want to vmap() inside a section
that's protected by the resv lock, you can
- drm_gem_shmem_vmap_locked()
- do whatever you need to do with the vaddr,
- drm_gem_shmem_vunmap_locked()
and the {pin,page_use}_count will be back to their original values.
Those are just ref counters, and I doubt the overhead of
incrementing/decrementing them makes a difference compared to the heavy
page-allocation/vmap operations...
next prev parent reply other threads:[~2025-04-02 13:21 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-22 21:25 [PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1) Dmitry Osipenko
2025-03-22 21:25 ` [PATCH v20 01/10] drm/gem: Change locked/unlocked postfix of drm_gem_v/unmap() function names Dmitry Osipenko
2025-03-24 13:05 ` Christian König
2025-03-25 13:15 ` Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 02/10] drm/gem: Add _locked postfix to functions that have unlocked counterpart Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 03/10] drm/gem: Document locking rule of vmap and evict callbacks Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 04/10] drm/shmem-helper: Make all exported symbols GPL Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 05/10] drm/shmem-helper: Refactor locked/unlocked functions Dmitry Osipenko
2025-03-27 11:25 ` Jani Nikula
2025-03-27 11:27 ` Jani Nikula
2025-03-27 11:29 ` Jani Nikula
2025-03-22 21:26 ` [PATCH v20 06/10] drm/shmem-helper: Remove obsoleted is_iomem test Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 07/10] drm/shmem-helper: Add and use pages_pin_count Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 08/10] drm/shmem-helper: Use refcount_t for pages_use_count Dmitry Osipenko
2025-03-22 21:26 ` [PATCH v20 09/10] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin Dmitry Osipenko
2025-04-02 12:47 ` Thomas Zimmermann
2025-04-02 12:58 ` Dmitry Osipenko
2025-04-02 13:21 ` Boris Brezillon [this message]
2025-04-03 7:20 ` Thomas Zimmermann
2025-04-03 8:50 ` Boris Brezillon
2025-04-04 8:01 ` Thomas Zimmermann
2025-04-04 14:52 ` Boris Brezillon
2025-04-04 14:58 ` Thomas Zimmermann
2025-04-07 9:56 ` Boris Brezillon
2025-03-22 21:26 ` [PATCH v20 10/10] drm/shmem-helper: Use refcount_t for vmap_use_count Dmitry Osipenko
2025-03-25 14:17 ` [PATCH v20 00/10] Add generic DRM-shmem memory shrinker (part 1) Thomas Zimmermann
2025-03-26 20:08 ` Dmitry Osipenko
2025-03-27 10:45 ` Boris Brezillon
2025-03-27 10:47 ` Dmitry Osipenko
2025-04-03 0:37 ` Lucas De Marchi
2025-04-03 7:03 ` Thomas Zimmermann
2025-04-03 14:10 ` Dmitry Osipenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250402152102.01d9cfee@collabora.com \
--to=boris.brezillon@collabora.com \
--cc=airlied@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dmitry.osipenko@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=frank.binns@imgtec.com \
--cc=kernel@collabora.com \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matt.coster@imgtec.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
--cc=yuq825@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.