[PATCH 6/8] drm/sched: Re-order struct drm_sched_rq members for clarity
Simona Vetter
simona.vetter at ffwll.ch
Tue Sep 24 09:44:24 UTC 2024
On Mon, Sep 09, 2024 at 06:19:35PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
>
> Lets re-order the members to make it clear which are protected by the lock
> and at the same time document it via kerneldoc.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at igalia.com>
> Cc: Christian König <christian.koenig at amd.com>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Cc: Luben Tuikov <ltuikov89 at gmail.com>
> Cc: Matthew Brost <matthew.brost at intel.com>
> Cc: Philipp Stanner <pstanner at redhat.com>
> ---
> include/drm/gpu_scheduler.h | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
> index a06753987d93..d4a3ba333568 100644
> --- a/include/drm/gpu_scheduler.h
> +++ b/include/drm/gpu_scheduler.h
> @@ -243,10 +243,10 @@ struct drm_sched_entity {
> /**
> * struct drm_sched_rq - queue of entities to be scheduled.
> *
> - * @lock: to modify the entities list.
> * @sched: the scheduler to which this rq belongs to.
> - * @entities: list of the entities to be scheduled.
> + * @lock: protects the list, tree and current entity.
> * @current_entity: the entity which is to be scheduled.
> + * @entities: list of the entities to be scheduled.
> * @rb_tree_root: root of time based priory queue of entities for FIFO scheduling
> *
> * Run queue is a set of entities scheduling command submissions for
> @@ -254,10 +254,12 @@ struct drm_sched_entity {
> * the next entity to emit commands from.
> */
> struct drm_sched_rq {
> - spinlock_t lock;
> struct drm_gpu_scheduler *sched;
> - struct list_head entities;
> +
> + spinlock_t lock;
> + /* Following members are protected by the @lock: */
Bit a bikeshed, but I think the moment you feel like you need to sprinkle
additional comments around you should switch over to the in-line
documentation style, where you can have all the space to add everything.
For structures in general I think the top comment style for members isn't
a good idea except for really trivial structs.
But yeah I know it's a bit of work to shuffle stuff around, so maybe next
time ..
-Sima
> struct drm_sched_entity *current_entity;
> + struct list_head entities;
> struct rb_root_cached rb_tree_root;
> };
>
> --
> 2.46.0
>
--
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the dri-devel
mailing list