intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jason Ekstrand <jason@jlekstrand.net>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 07/10] drm/i915: move request slabs to direct module init/exit
Date: Mon, 26 Jul 2021 10:46:00 -0500	[thread overview]
Message-ID: <CAOFGe95FA+TLOYyuAy7JS63HSkv7T-EApV6L-RUXsCfSjqfDGQ@mail.gmail.com> (raw)
In-Reply-To: <20210723192934.1004427-7-daniel.vetter@ffwll.ch>

On Fri, Jul 23, 2021 at 2:29 PM Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>
> With the global kmem_cache shrink infrastructure gone there's nothing
> special and we can convert them over.
>
> I'm doing this split up into each patch because there's quite a bit of
> noise with removing the static global.slab_requests|execute_cbs to just a
> slab_requests|execute_cbs.
>
> Cc: Jason Ekstrand <jason@jlekstrand.net>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_globals.c |  2 --
>  drivers/gpu/drm/i915/i915_pci.c     |  2 ++
>  drivers/gpu/drm/i915/i915_request.c | 47 ++++++++++++-----------------
>  drivers/gpu/drm/i915/i915_request.h |  3 ++
>  4 files changed, 24 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_globals.c b/drivers/gpu/drm/i915/i915_globals.c
> index 40a592fbc3e0..8fffa8d93bc5 100644
> --- a/drivers/gpu/drm/i915/i915_globals.c
> +++ b/drivers/gpu/drm/i915/i915_globals.c
> @@ -8,7 +8,6 @@
>  #include <linux/workqueue.h>
>
>  #include "i915_globals.h"
> -#include "i915_request.h"
>  #include "i915_scheduler.h"
>  #include "i915_vma.h"
>
> @@ -30,7 +29,6 @@ static void __i915_globals_cleanup(void)
>  }
>
>  static __initconst int (* const initfn[])(void) = {
> -       i915_global_request_init,
>         i915_global_scheduler_init,
>         i915_global_vma_init,
>  };
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 2334eb3e9abb..bb2bd12fb8c2 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -35,6 +35,7 @@
>  #include "i915_drv.h"
>  #include "gem/i915_gem_context.h"
>  #include "gem/i915_gem_object.h"
> +#include "i915_request.h"
>  #include "i915_perf.h"
>  #include "i915_globals.h"
>  #include "i915_selftest.h"
> @@ -1302,6 +1303,7 @@ static const struct {
>         { i915_context_module_init, i915_context_module_exit },
>         { i915_gem_context_module_init, i915_gem_context_module_exit },
>         { i915_objects_module_init, i915_objects_module_exit },
> +       { i915_request_module_init, i915_request_module_exit },
>         { i915_globals_init, i915_globals_exit },
>         { i915_mock_selftests, NULL },
>         { i915_pmu_init, i915_pmu_exit },
> diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
> index 6594cb2f8ebd..69152369ea00 100644
> --- a/drivers/gpu/drm/i915/i915_request.c
> +++ b/drivers/gpu/drm/i915/i915_request.c
> @@ -42,7 +42,6 @@
>
>  #include "i915_active.h"
>  #include "i915_drv.h"
> -#include "i915_globals.h"
>  #include "i915_trace.h"
>  #include "intel_pm.h"
>
> @@ -52,11 +51,8 @@ struct execute_cb {
>         struct i915_request *signal;
>  };
>
> -static struct i915_global_request {
> -       struct i915_global base;
> -       struct kmem_cache *slab_requests;
> -       struct kmem_cache *slab_execute_cbs;
> -} global;
> +struct kmem_cache *slab_requests;

static

> +struct kmem_cache *slab_execute_cbs;

static

Am I tired of typing this?  Yes, I am!  Will I keep typing it?  Probably. :-P

>
>  static const char *i915_fence_get_driver_name(struct dma_fence *fence)
>  {
> @@ -107,7 +103,7 @@ static signed long i915_fence_wait(struct dma_fence *fence,
>
>  struct kmem_cache *i915_request_slab_cache(void)
>  {
> -       return global.slab_requests;
> +       return slab_requests;
>  }
>
>  static void i915_fence_release(struct dma_fence *fence)
> @@ -159,7 +155,7 @@ static void i915_fence_release(struct dma_fence *fence)
>             !cmpxchg(&rq->engine->request_pool, NULL, rq))
>                 return;
>
> -       kmem_cache_free(global.slab_requests, rq);
> +       kmem_cache_free(slab_requests, rq);
>  }
>
>  const struct dma_fence_ops i915_fence_ops = {
> @@ -176,7 +172,7 @@ static void irq_execute_cb(struct irq_work *wrk)
>         struct execute_cb *cb = container_of(wrk, typeof(*cb), work);
>
>         i915_sw_fence_complete(cb->fence);
> -       kmem_cache_free(global.slab_execute_cbs, cb);
> +       kmem_cache_free(slab_execute_cbs, cb);
>  }
>
>  static __always_inline void
> @@ -514,7 +510,7 @@ __await_execution(struct i915_request *rq,
>         if (i915_request_is_active(signal))
>                 return 0;
>
> -       cb = kmem_cache_alloc(global.slab_execute_cbs, gfp);
> +       cb = kmem_cache_alloc(slab_execute_cbs, gfp);
>         if (!cb)
>                 return -ENOMEM;
>
> @@ -868,7 +864,7 @@ request_alloc_slow(struct intel_timeline *tl,
>         rq = list_first_entry(&tl->requests, typeof(*rq), link);
>         i915_request_retire(rq);
>
> -       rq = kmem_cache_alloc(global.slab_requests,
> +       rq = kmem_cache_alloc(slab_requests,
>                               gfp | __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
>         if (rq)
>                 return rq;
> @@ -881,7 +877,7 @@ request_alloc_slow(struct intel_timeline *tl,
>         retire_requests(tl);
>
>  out:
> -       return kmem_cache_alloc(global.slab_requests, gfp);
> +       return kmem_cache_alloc(slab_requests, gfp);
>  }
>
>  static void __i915_request_ctor(void *arg)
> @@ -942,7 +938,7 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
>          *
>          * Do not use kmem_cache_zalloc() here!
>          */
> -       rq = kmem_cache_alloc(global.slab_requests,
> +       rq = kmem_cache_alloc(slab_requests,
>                               gfp | __GFP_RETRY_MAYFAIL | __GFP_NOWARN);
>         if (unlikely(!rq)) {
>                 rq = request_alloc_slow(tl, &ce->engine->request_pool, gfp);
> @@ -1029,7 +1025,7 @@ __i915_request_create(struct intel_context *ce, gfp_t gfp)
>         GEM_BUG_ON(!list_empty(&rq->sched.waiters_list));
>
>  err_free:
> -       kmem_cache_free(global.slab_requests, rq);
> +       kmem_cache_free(slab_requests, rq);
>  err_unreserve:
>         intel_context_unpin(ce);
>         return ERR_PTR(ret);
> @@ -2084,19 +2080,15 @@ void i915_request_show(struct drm_printer *m,
>  #include "selftests/i915_request.c"
>  #endif
>
> -static void i915_global_request_exit(void)
> +void i915_request_module_exit(void)
>  {
> -       kmem_cache_destroy(global.slab_execute_cbs);
> -       kmem_cache_destroy(global.slab_requests);
> +       kmem_cache_destroy(slab_execute_cbs);
> +       kmem_cache_destroy(slab_requests);
>  }
>
> -static struct i915_global_request global = { {
> -       .exit = i915_global_request_exit,
> -} };
> -
> -int __init i915_global_request_init(void)
> +int __init i915_request_module_init(void)
>  {
> -       global.slab_requests =
> +       slab_requests =
>                 kmem_cache_create("i915_request",
>                                   sizeof(struct i915_request),
>                                   __alignof__(struct i915_request),
> @@ -2104,20 +2096,19 @@ int __init i915_global_request_init(void)
>                                   SLAB_RECLAIM_ACCOUNT |
>                                   SLAB_TYPESAFE_BY_RCU,
>                                   __i915_request_ctor);
> -       if (!global.slab_requests)
> +       if (!slab_requests)
>                 return -ENOMEM;
>
> -       global.slab_execute_cbs = KMEM_CACHE(execute_cb,
> +       slab_execute_cbs = KMEM_CACHE(execute_cb,
>                                              SLAB_HWCACHE_ALIGN |
>                                              SLAB_RECLAIM_ACCOUNT |
>                                              SLAB_TYPESAFE_BY_RCU);

Indentation is wrong here

With static and indentation fixed,

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>

> -       if (!global.slab_execute_cbs)
> +       if (!slab_execute_cbs)
>                 goto err_requests;
>
> -       i915_global_register(&global.base);
>         return 0;
>
>  err_requests:
> -       kmem_cache_destroy(global.slab_requests);
> +       kmem_cache_destroy(slab_requests);
>         return -ENOMEM;
>  }
> diff --git a/drivers/gpu/drm/i915/i915_request.h b/drivers/gpu/drm/i915/i915_request.h
> index 717e5b292046..a79480f07f04 100644
> --- a/drivers/gpu/drm/i915/i915_request.h
> +++ b/drivers/gpu/drm/i915/i915_request.h
> @@ -647,4 +647,7 @@ bool
>  i915_request_active_engine(struct i915_request *rq,
>                            struct intel_engine_cs **active);
>
> +void i915_request_module_exit(void);
> +int i915_request_module_init(void);
> +
>  #endif /* I915_REQUEST_H */
> --
> 2.32.0
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2021-07-26 15:46 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-23 19:29 [Intel-gfx] [PATCH 01/10] drm/i915: Check for nomodeset in i915_init() first Daniel Vetter
2021-07-23 19:29 ` [Intel-gfx] [PATCH 02/10] drm/i915: move i915_active slab to direct module init/exit Daniel Vetter
2021-07-26 15:24   ` Jason Ekstrand
2021-07-23 19:29 ` [Intel-gfx] [PATCH 03/10] drm/i915: move i915_buddy " Daniel Vetter
2021-07-24  7:38   ` kernel test robot
2021-07-24  7:38   ` [Intel-gfx] [RFC PATCH] drm/i915: slab_blocks can be static kernel test robot
2021-07-26 15:26   ` [Intel-gfx] [PATCH 03/10] drm/i915: move i915_buddy slab to direct module init/exit Jason Ekstrand
2021-07-23 19:29 ` [Intel-gfx] [PATCH 04/10] drm/i915: move intel_context " Daniel Vetter
2021-07-24 11:45   ` kernel test robot
2021-07-24 11:45   ` [Intel-gfx] [RFC PATCH] drm/i915: slab_ce can be static kernel test robot
2021-07-26  8:35   ` [Intel-gfx] [PATCH 04/10] drm/i915: move intel_context slab to direct module init/exit Tvrtko Ursulin
2021-07-26 15:30     ` Jason Ekstrand
2021-07-26 15:42       ` Jason Ekstrand
2021-07-26 16:08         ` Tvrtko Ursulin
2021-07-26 16:20           ` Jason Ekstrand
2021-07-26 16:31             ` Tvrtko Ursulin
2021-07-26 18:17               ` Jason Ekstrand
2021-07-27 10:14                 ` Tvrtko Ursulin
2021-07-23 19:29 ` [Intel-gfx] [PATCH 05/10] drm/i915: move gem_context " Daniel Vetter
2021-07-24 14:50   ` kernel test robot
2021-07-24 14:50   ` [Intel-gfx] [RFC PATCH] drm/i915: slab_luts can be static kernel test robot
2021-07-26 15:35   ` [Intel-gfx] [PATCH 05/10] drm/i915: move gem_context slab to direct module init/exit Jason Ekstrand
2021-07-23 19:29 ` [Intel-gfx] [PATCH 06/10] drm/i915: move gem_objects " Daniel Vetter
2021-07-24 18:23   ` kernel test robot
2021-07-24 18:23   ` [Intel-gfx] [RFC PATCH] drm/i915: slab_objects can be static kernel test robot
2021-07-26 15:39   ` [Intel-gfx] [PATCH 06/10] drm/i915: move gem_objects slab to direct module init/exit Jason Ekstrand
2021-07-23 19:29 ` [Intel-gfx] [PATCH 07/10] drm/i915: move request slabs " Daniel Vetter
2021-07-24 21:58   ` kernel test robot
2021-07-24 21:58   ` [Intel-gfx] [RFC PATCH] drm/i915: slab_requests can be static kernel test robot
2021-07-26 15:46   ` Jason Ekstrand [this message]
2021-07-23 19:29 ` [Intel-gfx] [PATCH 08/10] drm/i915: move scheduler slabs to direct module init/exit Daniel Vetter
2021-07-25  1:23   ` kernel test robot
2021-07-25  1:23   ` [Intel-gfx] [RFC PATCH] drm/i915: slab_dependencies can be static kernel test robot
2021-07-26 15:47   ` [Intel-gfx] [PATCH 08/10] drm/i915: move scheduler slabs to direct module init/exit Jason Ekstrand
2021-07-23 19:29 ` [Intel-gfx] [PATCH 09/10] drm/i915: move vma slab " Daniel Vetter
2021-07-25  4:04   ` kernel test robot
2021-07-25  4:04   ` [Intel-gfx] [RFC PATCH] drm/i915: slab_vmas can be static kernel test robot
2021-07-26 15:50   ` [Intel-gfx] [PATCH 09/10] drm/i915: move vma slab to direct module init/exit Jason Ekstrand
2021-07-23 19:29 ` [Intel-gfx] [PATCH 10/10] drm/i915: Remove i915_globals Daniel Vetter
2021-07-26 15:51   ` Jason Ekstrand
2021-07-27 11:34     ` Daniel Vetter
2021-07-23 21:55 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/10] drm/i915: Check for nomodeset in i915_init() first Patchwork
2021-07-23 21:56 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-07-23 22:29 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-07-24  9:00 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-07-26 15:23 ` [Intel-gfx] [PATCH 01/10] " Jason Ekstrand

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=CAOFGe95FA+TLOYyuAy7JS63HSkv7T-EApV6L-RUXsCfSjqfDGQ@mail.gmail.com \
    --to=jason@jlekstrand.net \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).