All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Daniel Vetter <daniel@ffwll.ch>
Cc: daniel.vetter@ffwll.ch, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/ttm: optimize the pool shrinker a bit
Date: Thu, 8 Apr 2021 14:44:16 +0200	[thread overview]
Message-ID: <ede33f9c-e86d-7859-74d6-b28067080573@gmail.com> (raw)
In-Reply-To: <YG7pqs50QXkLQUz3@phenom.ffwll.local>

Am 08.04.21 um 13:31 schrieb Daniel Vetter:
> On Thu, Apr 08, 2021 at 01:17:32PM +0200, Christian König wrote:
>> Am 08.04.21 um 13:08 schrieb Daniel Vetter:
>>> On Thu, Apr 01, 2021 at 03:54:13PM +0200, Christian König wrote:
>>>> [SNIP]
>>>>    EXPORT_SYMBOL(unregister_shrinker);
>>>> +/**
>>>> + * sync_shrinker - Wait for all running shrinkers to complete.
>>>> + */
>>>> +void sync_shrinkers(void)
>>> This one should probably be in its own patch, with a bit more commit
>>> message about why we need it and all that. I'd assume that just
>>> unregistering the shrinker should sync everything we needed to sync
>>> already, and for other sync needs we can do locking within our own
>>> shrinker?
>> Correct. Reason why we need the barrier is that we need to destroy the
>> device (during hotplug) before the shrinker is unregistered (during module
>> unload).
>>
>> Going to separate that, write something up in the commit message and send it
>> to the appropriate audience.
> Hm why do we need that?

When the shrinker runs in parallel with (for example) a hotplug event 
and unmaps pages from the devices IOMMU I must make sure that you can't 
destroy the device or pool structure at the same time.

Previously holding the mutex while updating the IOMMU would take care of 
that, but now we need to prevent this otherwise.

Could be that this is also handled somewhere else, but I'm better save 
than sorry here and grabbing/releasing write side of the shrinker_rwsem 
is rather lightweight.

> Either way sounds like an orthogonal series for
> the hotunplug work, not just shrinker optimization.

It is unrelated to the hotplug work in general.

Regards,
Christian.

> -Daniel
>
>> Thanks,
>> Christian.
>>
>>> -Daniel
>>>
>>>> +{
>>>> +	down_write(&shrinker_rwsem);
>>>> +	up_write(&shrinker_rwsem);
>>>> +}
>>>> +EXPORT_SYMBOL(sync_shrinkers);
>>>> +
>>>>    #define SHRINK_BATCH 128
>>>>    static unsigned long do_shrink_slab(struct shrink_control *shrinkctl,
>>>> -- 
>>>> 2.25.1
>>>>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2021-04-08 12:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-01 13:54 [PATCH] drm/ttm: optimize the pool shrinker a bit Christian König
2021-04-02  4:18 ` kernel test robot
2021-04-02  4:18   ` kernel test robot
2021-04-08 11:08 ` Daniel Vetter
2021-04-08 11:17   ` Christian König
2021-04-08 11:31     ` Daniel Vetter
2021-04-08 12:44       ` Christian König [this message]
2021-04-09  7:41         ` Daniel Vetter

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=ede33f9c-e86d-7859-74d6-b28067080573@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    /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.