Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
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: Mon, 1 Aug 2022 23:59:22 +0300	[thread overview]
Message-ID: <a402e627-9437-1daa-0149-b8265dbfad5e@collabora.com> (raw)
In-Reply-To: <CAF6AEGu1_5EBmKQR8cMs=or6o_ALBWxTyKA_JL-G-AhemDyaww@mail.gmail.com>

On 8/1/22 23:42, Rob Clark wrote:
> On Mon, Aug 1, 2022 at 1:26 PM Dmitry Osipenko
> <dmitry.osipenko@collabora.com> wrote:
>>
>> On 8/1/22 23:13, Dmitry Osipenko wrote:
>>> On 8/1/22 23:11, Dmitry Osipenko wrote:
>>>> On 8/1/22 23:00, Rob Clark wrote:
>>>>> On Mon, Aug 1, 2022 at 12:41 PM Dmitry Osipenko
>>>>> <dmitry.osipenko@collabora.com> wrote:
>>>>>>
>>>>>> On 7/26/22 20:50, Rob Clark wrote:
>>>>>>> +/**
>>>>>>> + * drm_gem_lru_remove - remove object from whatever LRU it is in
>>>>>>> + *
>>>>>>> + * If the object is currently in any LRU, remove it.
>>>>>>> + *
>>>>>>> + * @obj: The GEM object to remove from current LRU
>>>>>>> + */
>>>>>>> +void
>>>>>>> +drm_gem_lru_remove(struct drm_gem_object *obj)
>>>>>>> +{
>>>>>>> +     struct drm_gem_lru *lru = obj->lru;
>>>>>>> +
>>>>>>> +     if (!lru)
>>>>>>> +             return;
>>>>>>> +
>>>>>>> +     mutex_lock(lru->lock);
>>>>>>> +     lru_remove(obj);
>>>>>>> +     mutex_unlock(lru->lock);
>>>>>>> +}
>>>>>>> +EXPORT_SYMBOL(drm_gem_lru_remove);
>>>>>>
>>>>>> I made a preliminary port of the DRM-SHMEM shrinker on top of the the
>>>>>> latest version of dma-buf locking convention and yours LRU patches. It
>>>>>> all works good, the only thing that is missing for the DRM-SHMEM
>>>>>> shrinker is the drm_gem_lru_remove_locked().
>>>>>>
>>>>>> What about to add a locked variant of drm_gem_lru_remove()?
>>>>>
>>>>> Sounds fine to me.. the only reason it didn't exist yet was because it
>>>>> wasn't needed yet..
>>>>
>>>> There is no use for the drm_gem_lru_move_tail_locked() as well, you're
>>>> not using it in the MSM driver. Hence I thought it might be good to add
>>>> the drm_gem_lru_remove_locked(), or maybe the
>>>> drm_gem_lru_move_tail_locked() should be dropped then?
>>>>
>>>>> I can respin w/ an addition of a _locked() version, or you can add it
>>>>> on top in your patchset.  Either is fine by me
>>>>
>>>> The either option is fine by me too. If you'll keep the unused
>>>> drm_gem_lru_move_tail_locked(), then will be nice to add
>>>> drm_gem_lru_remove_locked().
>>>>
>>>
>>> The drm_gem_lru_move_tail_locked() will be needed by DRM-SHMEM shrinker,
>>> BTW.
>>
>> On the other hand, I see now that DRM-SHMEM shrinker can use the
>> unlocked versions only. Hence both drm_gem_lru_move_tail_locked() and
>> drm_gem_lru_remove_locked() aren't needed.
> 
> drm_gem_lru_move_tail_locked() is used internally, but I guess it
> could be made static since there ended up not being external users
> (yet?)

Making it static will be good.

> I could see _move_tail_locked() being useful for a driver that wanted
> to bulk update a bunch of GEM objs, for ex. all the bo's associated
> with a submit/job.

At minimum we shouldn't expose the unused kernel symbols. But if you're
planning to make use of this function later on, then it might be fine to
add it.

-- 
Best regards,
Dmitry

  reply	other threads:[~2022-08-01 20:59 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
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 [this message]
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=a402e627-9437-1daa-0149-b8265dbfad5e@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