From: Dmitry Osipenko <dmitry.osipenko@collabora.com>
To: Rob Clark <robdclark@gmail.com>
Cc: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
linux-arm-msm@vger.kernel.org, Rob Clark <robdclark@chromium.org>,
Daniel Vetter <daniel@ffwll.ch>,
Thomas Zimmermann <tzimmermann@suse.de>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
David Airlie <airlied@linux.ie>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 09/15] drm/gem: Add LRU/shrinker helper
Date: Fri, 29 Jul 2022 20:01:02 +0300 [thread overview]
Message-ID: <6ceabe5a-a1ff-0717-96f1-0d28167ef649@collabora.com> (raw)
In-Reply-To: <CAF6AEGuKU839m6TiARN3EwjPToo-qpdZR5cGD+BdJeiObjeY4A@mail.gmail.com>
On 7/29/22 18:40, Rob Clark wrote:
> On Fri, Jul 29, 2022 at 8:27 AM Dmitry Osipenko
> <dmitry.osipenko@collabora.com> wrote:
>>
>> On 7/26/22 20:50, Rob Clark wrote:
>>> +/**
>>> + * drm_gem_lru_move_tail_locked - move the object to the tail of the LRU
>>> + *
>>> + * If the object is already in this LRU it will be moved to the
>>> + * tail. Otherwise it will be removed from whichever other LRU
>>> + * it is in (if any) and moved into this LRU.
>>> + *
>>> + * Call with LRU lock held.
>>> + *
>>> + * @lru: The LRU to move the object into.
>>> + * @obj: The GEM object to move into this LRU
>>> + */
>>> +void
>>> +drm_gem_lru_move_tail_locked(struct drm_gem_lru *lru, struct drm_gem_object *obj)
>>> +{
>>> + lockdep_assert_held_once(lru->lock);
>>> +
>>> + if (obj->lru)
>>> + lru_remove(obj);
>>
>> The obj->lru also needs to be locked if lru != obj->lru, isn't it? And
>> then we should add lockdep_assert_held_once(obj->lru->lock).
>>
>
> It is expected (mentioned in comment on drm_gem_lru::lock) that all
> lru's are sharing the same lock. Possibly that could be made more
> obvious? Having per-lru locks wouldn't really work for accessing the
> single drm_gem_object::lru_node.
Right, my bad. I began to update the DRM-SHMEM shrinker patches on top
of the shrinker helper, but missed that the lock is shared when was
looking at this patch again today.
Adding comment to the code about the shared lock may help a tad, but
it's not really necessary. It was my fault that I forgot about it.
Thank you!
--
Best regards,
Dmitry
next prev parent reply other threads:[~2022-07-29 17:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-26 17:50 [PATCH v3 00/15] drm+msm: Shrinker and LRU rework Rob Clark
2022-07-26 17:50 ` [PATCH v3 01/15] drm/msm: Reorder lock vs submit alloc Rob Clark
2022-07-26 17:50 ` [PATCH v3 02/15] drm/msm: Small submit cleanup Rob Clark
2022-07-26 17:50 ` [PATCH v3 03/15] drm/msm: Split out idr_lock Rob Clark
2022-07-26 17:50 ` [PATCH v3 04/15] drm/msm/gem: Check for active in shrinker path Rob Clark
2022-07-26 17:50 ` [PATCH v3 05/15] drm/msm/gem: Rename update_inactive Rob Clark
2022-07-26 17:50 ` [PATCH v3 06/15] drm/msm/gem: Rename to pin/unpin_pages Rob Clark
2022-07-26 17:50 ` [PATCH v3 07/15] drm/msm/gem: Consolidate pin/unpin paths Rob Clark
2022-07-26 17:50 ` [PATCH v3 08/15] drm/msm/gem: Remove active refcnt Rob Clark
2022-07-26 17:50 ` [PATCH v3 09/15] drm/gem: Add LRU/shrinker helper Rob Clark
2022-07-29 15:27 ` Dmitry Osipenko
2022-07-29 15:40 ` Rob Clark
2022-07-29 17:01 ` Dmitry Osipenko [this message]
2022-08-01 19:41 ` Dmitry Osipenko
2022-08-01 20:00 ` Rob Clark
2022-08-01 20:11 ` Dmitry Osipenko
2022-08-01 20:13 ` Dmitry Osipenko
2022-08-01 20:26 ` Dmitry Osipenko
2022-08-01 20:42 ` Rob Clark
2022-08-01 20:59 ` Dmitry Osipenko
2022-07-26 17:50 ` [PATCH v3 10/15] drm/msm/gem: Convert to using drm_gem_lru Rob Clark
2022-07-26 17:50 ` [PATCH v3 11/15] drm/msm/gem: Unpin buffers earlier Rob Clark
2022-07-26 17:50 ` [PATCH v3 12/15] drm/msm/gem: Consolidate shrinker trace Rob Clark
2022-07-26 17:50 ` [PATCH v3 13/15] drm/msm/gem: Evict active GEM objects when necessary Rob Clark
2022-07-26 17:50 ` [PATCH v3 14/15] drm/msm/gem: Add msm_gem_assert_locked() Rob Clark
2022-07-26 17:50 ` [PATCH v3 15/15] drm/msm/gem: Convert to lockdep assert Rob Clark
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=6ceabe5a-a1ff-0717-96f1-0d28167ef649@collabora.com \
--to=dmitry.osipenko@collabora.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=tzimmermann@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox