[PATCH 15/49] drm/ttm: make some inline helper functions for cleanup paths.

Dave Airlie airlied at gmail.com
Tue Aug 4 02:28:04 UTC 2020


On Fri, 31 Jul 2020 at 23:07, Christian König <christian.koenig at amd.com> wrote:
>
> Am 31.07.20 um 06:04 schrieb Dave Airlie:
> > From: Dave Airlie <airlied at redhat.com>
> >
> > Signed-off-by: Dave Airlie <airlied at redhat.com>
> > ---
> >   drivers/gpu/drm/ttm/ttm_bo.c    |  6 ++----
> >   include/drm/ttm/ttm_bo_driver.h | 12 ++++++++++++
> >   2 files changed, 14 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> > index 84e399395e4f..f584e5e94383 100644
> > --- a/drivers/gpu/drm/ttm/ttm_bo.c
> > +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> > @@ -1462,8 +1462,7 @@ int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
> >               return ret;
> >       }
> >
> > -     man->use_type = false;
> > -     man->has_type = false;
> > +     ttm_bo_disable_mm(man);
> >
> >       ret = 0;
> >       if (mem_type > 0) {
> > @@ -1476,8 +1475,7 @@ int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
> >               ret = (*man->func->takedown)(man);
> >       }
> >
> > -     dma_fence_put(man->move);
> > -     man->move = NULL;
> > +     ttm_bo_man_cleanup(man);
> >
> >       return ret;
> >   }
> > diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> > index d0f1a6cdfba7..92bb54cce633 100644
> > --- a/include/drm/ttm/ttm_bo_driver.h
> > +++ b/include/drm/ttm/ttm_bo_driver.h
> > @@ -671,6 +671,18 @@ static inline void ttm_bo_use_mm(struct ttm_mem_type_manager *man)
> >       man->use_type = true;
> >   }
> >
> > +static inline void ttm_bo_disable_mm(struct ttm_mem_type_manager *man)
> > +{
> > +     man->has_type = false;
> > +     man->use_type = false;
> > +}
> > +
> > +static inline void ttm_bo_man_cleanup(struct ttm_mem_type_manager *man)
> > +{
> > +     dma_fence_put(man->move);
> > +     man->move = NULL;
> > +}
> > +
>
> What's the value in making those inline? This is not performance
> critical at all.
>

Not for performance, but they were too trivial to bother putting in
real functions, if there was more going on I'd probably have put them
into functions, but setting two bits, and putting a fence didn't seem
worth adding function call overhead where there was none before.

Dave.


More information about the dri-devel mailing list