mbox series

[00/10] drm: use idr_init_base() over idr_init() if applicable

Message ID 20220701185303.284082-1-dakr@redhat.com (mailing list archive)
Headers show
Series drm: use idr_init_base() over idr_init() if applicable | expand

Message

Danilo Krummrich July 1, 2022, 6:52 p.m. UTC
From: Danilo Krummrich <dakr@redhat.com>

This patch series initializes IDRs with idr_init_base(&idr, 1) rather than
idr_init(&idr) in case for the particular IDR no IDs < 1 are ever requested -
this avoids unnecessary tree walks.

Danilo Krummrich (10):
  drm/amdgpu: use idr_init_base() to initialize mgr->ctx_handles
  drm/amdgpu: use idr_init_base() to initialize fpriv->bo_list_handles
  drm: use idr_init_base() to initialize master->magic_map
  drm: use idr_init_base() to initialize master->lessee_idr
  drm: use idr_init_base() to initialize mode_config.object_idr
  drm: use idr_init_base() to initialize mode_config.tile_idr
  drm/sis: use idr_init_base() to initialize dev_priv->object_idr
  drm/v3d: use idr_init_base() to initialize v3d_priv->perfmon.idr
  drm/via: use idr_init_base() to initialize dev_priv->object_idr
  drm/todo: remove task for idr_init_base()

 Documentation/gpu/todo.rst              | 12 ------------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 +-
 drivers/gpu/drm/drm_auth.c              |  4 ++--
 drivers/gpu/drm/drm_mode_config.c       |  4 ++--
 drivers/gpu/drm/sis/sis_drv.c           |  2 +-
 drivers/gpu/drm/v3d/v3d_perfmon.c       |  2 +-
 drivers/gpu/drm/via/via_map.c           |  2 +-
 8 files changed, 9 insertions(+), 21 deletions(-)

Comments

Christian König July 4, 2022, 1:09 p.m. UTC | #1
Am 01.07.22 um 20:52 schrieb dakr@redhat.com:
> From: Danilo Krummrich <dakr@redhat.com>
>
> This patch series initializes IDRs with idr_init_base(&idr, 1) rather than
> idr_init(&idr) in case for the particular IDR no IDs < 1 are ever requested -
> this avoids unnecessary tree walks.

Feel free to add Reviewed-by: Christian König <christian.koenig@amd.com> 
for the two amdgpu patches.

And an Acked-by: Christian König <christian.koenig@amd.com> for the rest.

Regards,
Christian.

>
> Danilo Krummrich (10):
>    drm/amdgpu: use idr_init_base() to initialize mgr->ctx_handles
>    drm/amdgpu: use idr_init_base() to initialize fpriv->bo_list_handles
>    drm: use idr_init_base() to initialize master->magic_map
>    drm: use idr_init_base() to initialize master->lessee_idr
>    drm: use idr_init_base() to initialize mode_config.object_idr
>    drm: use idr_init_base() to initialize mode_config.tile_idr
>    drm/sis: use idr_init_base() to initialize dev_priv->object_idr
>    drm/v3d: use idr_init_base() to initialize v3d_priv->perfmon.idr
>    drm/via: use idr_init_base() to initialize dev_priv->object_idr
>    drm/todo: remove task for idr_init_base()
>
>   Documentation/gpu/todo.rst              | 12 ------------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c |  2 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 +-
>   drivers/gpu/drm/drm_auth.c              |  4 ++--
>   drivers/gpu/drm/drm_mode_config.c       |  4 ++--
>   drivers/gpu/drm/sis/sis_drv.c           |  2 +-
>   drivers/gpu/drm/v3d/v3d_perfmon.c       |  2 +-
>   drivers/gpu/drm/via/via_map.c           |  2 +-
>   8 files changed, 9 insertions(+), 21 deletions(-)
>
Danilo Krummrich July 12, 2022, 2:24 p.m. UTC | #2
Hi Laurent,

On 7/1/22 20:52, dakr@redhat.com wrote:
> From: Danilo Krummrich <dakr@redhat.com>
> 
> This patch series initializes IDRs with idr_init_base(&idr, 1) rather than
> idr_init(&idr) in case for the particular IDR no IDs < 1 are ever requested -
> this avoids unnecessary tree walks.
>
Guess this would go through drm-misc too?

- Danilo

> Danilo Krummrich (10):
>    drm/amdgpu: use idr_init_base() to initialize mgr->ctx_handles
>    drm/amdgpu: use idr_init_base() to initialize fpriv->bo_list_handles
>    drm: use idr_init_base() to initialize master->magic_map
>    drm: use idr_init_base() to initialize master->lessee_idr
>    drm: use idr_init_base() to initialize mode_config.object_idr
>    drm: use idr_init_base() to initialize mode_config.tile_idr
>    drm/sis: use idr_init_base() to initialize dev_priv->object_idr
>    drm/v3d: use idr_init_base() to initialize v3d_priv->perfmon.idr
>    drm/via: use idr_init_base() to initialize dev_priv->object_idr
>    drm/todo: remove task for idr_init_base()
> 
>   Documentation/gpu/todo.rst              | 12 ------------
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c |  2 +-
>   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |  2 +-
>   drivers/gpu/drm/drm_auth.c              |  4 ++--
>   drivers/gpu/drm/drm_mode_config.c       |  4 ++--
>   drivers/gpu/drm/sis/sis_drv.c           |  2 +-
>   drivers/gpu/drm/v3d/v3d_perfmon.c       |  2 +-
>   drivers/gpu/drm/via/via_map.c           |  2 +-
>   8 files changed, 9 insertions(+), 21 deletions(-)
>
Maxime Ripard July 28, 2022, 2:41 p.m. UTC | #3
On Fri, 1 Jul 2022 20:52:53 +0200, dakr@redhat.com wrote:
> From: Danilo Krummrich <dakr@redhat.com>
> 
> This patch series initializes IDRs with idr_init_base(&idr, 1) rather than
> idr_init(&idr) in case for the particular IDR no IDs < 1 are ever requested -
> this avoids unnecessary tree walks.
> 
> Danilo Krummrich (10):
>   drm/amdgpu: use idr_init_base() to initialize mgr->ctx_handles
>   drm/amdgpu: use idr_init_base() to initialize fpriv->bo_list_handles
>   drm: use idr_init_base() to initialize master->magic_map
>   drm: use idr_init_base() to initialize master->lessee_idr
>   drm: use idr_init_base() to initialize mode_config.object_idr
>   drm: use idr_init_base() to initialize mode_config.tile_idr
>   drm/sis: use idr_init_base() to initialize dev_priv->object_idr
>   drm/v3d: use idr_init_base() to initialize v3d_priv->perfmon.idr
>   drm/via: use idr_init_base() to initialize dev_priv->object_idr
>   drm/todo: remove task for idr_init_base()
> 
> [...]

Applied to drm/drm-misc (drm-misc-next).

Thanks!
Maxime
Maxime Ripard July 28, 2022, 2:44 p.m. UTC | #4
On Thu, Jul 28, 2022 at 04:41:41PM +0200, Maxime Ripard wrote:
> On Fri, 1 Jul 2022 20:52:53 +0200, dakr@redhat.com wrote:
> > From: Danilo Krummrich <dakr@redhat.com>
> > 
> > This patch series initializes IDRs with idr_init_base(&idr, 1) rather than
> > idr_init(&idr) in case for the particular IDR no IDs < 1 are ever requested -
> > this avoids unnecessary tree walks.
> > 
> > Danilo Krummrich (10):
> >   drm/amdgpu: use idr_init_base() to initialize mgr->ctx_handles
> >   drm/amdgpu: use idr_init_base() to initialize fpriv->bo_list_handles
> >   drm: use idr_init_base() to initialize master->magic_map
> >   drm: use idr_init_base() to initialize master->lessee_idr
> >   drm: use idr_init_base() to initialize mode_config.object_idr
> >   drm: use idr_init_base() to initialize mode_config.tile_idr
> >   drm/sis: use idr_init_base() to initialize dev_priv->object_idr
> >   drm/v3d: use idr_init_base() to initialize v3d_priv->perfmon.idr
> >   drm/via: use idr_init_base() to initialize dev_priv->object_idr
> >   drm/todo: remove task for idr_init_base()
> > 
> > [...]
> 
> Applied to drm/drm-misc (drm-misc-next).

The via driver had changed a bit and the patch 9 didn't apply at all.
I've moved the change to where it looked like it belonged, but you might
want to double check.

Maxime
Danilo Krummrich July 28, 2022, 2:56 p.m. UTC | #5
On 7/28/22 16:44, Maxime Ripard wrote:
> On Thu, Jul 28, 2022 at 04:41:41PM +0200, Maxime Ripard wrote:
>> On Fri, 1 Jul 2022 20:52:53 +0200, dakr@redhat.com wrote:
>>> From: Danilo Krummrich <dakr@redhat.com>
>>>
>>> This patch series initializes IDRs with idr_init_base(&idr, 1) rather than
>>> idr_init(&idr) in case for the particular IDR no IDs < 1 are ever requested -
>>> this avoids unnecessary tree walks.
>>>
>>> Danilo Krummrich (10):
>>>    drm/amdgpu: use idr_init_base() to initialize mgr->ctx_handles
>>>    drm/amdgpu: use idr_init_base() to initialize fpriv->bo_list_handles
>>>    drm: use idr_init_base() to initialize master->magic_map
>>>    drm: use idr_init_base() to initialize master->lessee_idr
>>>    drm: use idr_init_base() to initialize mode_config.object_idr
>>>    drm: use idr_init_base() to initialize mode_config.tile_idr
>>>    drm/sis: use idr_init_base() to initialize dev_priv->object_idr
>>>    drm/v3d: use idr_init_base() to initialize v3d_priv->perfmon.idr
>>>    drm/via: use idr_init_base() to initialize dev_priv->object_idr
>>>    drm/todo: remove task for idr_init_base()
>>>
>>> [...]
>>
>> Applied to drm/drm-misc (drm-misc-next).

Thanks.

> 
> The via driver had changed a bit and the patch 9 didn't apply at all.
> I've moved the change to where it looked like it belonged, but you might
> want to double check.

LGTM.

- Danilo
> 
> Maxime