All of lore.kernel.org
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@kernel.org>
To: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: amd-gfx@lists.freedesktop.org, kernel-dev@igalia.com,
	"Christian König" <christian.koenig@amd.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Philipp Stanner" <phasta@kernel.org>
Subject: Re: [PATCH 3/3] drm/sched: Remove a hole from struct drm_sched_job
Date: Thu, 6 Feb 2025 18:04:26 +0100	[thread overview]
Message-ID: <Z6Trmm0s2oTP-mDd@cassiopeiae> (raw)
In-Reply-To: <20250206164031.43413-4-tvrtko.ursulin@igalia.com>

On Thu, Feb 06, 2025 at 04:40:31PM +0000, Tvrtko Ursulin wrote:
> We can re-order some struct members and take u32 credits outside of the
> pointer sandwich and also for the last_dependency member we can get away
> with an unsigned int since for dependency we use xa_limit_32b.
> 
> Pahole report before:
>         /* size: 160, cachelines: 3, members: 14 */
>         /* sum members: 156, holes: 1, sum holes: 4 */
>         /* last cacheline: 32 bytes */
> 
> And after:
>         /* size: 152, cachelines: 3, members: 14 */
>         /* last cacheline: 24 bytes */
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Danilo Krummrich <dakr@kernel.org>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Cc: Philipp Stanner <phasta@kernel.org>
> ---
>  include/drm/gpu_scheduler.h | 38 +++++++++++++++++++------------------
>  1 file changed, 20 insertions(+), 18 deletions(-)
> 
> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
> index a0ff08123f07..68da3dec8dba 100644
> --- a/include/drm/gpu_scheduler.h
> +++ b/include/drm/gpu_scheduler.h
> @@ -338,8 +338,14 @@ struct drm_sched_fence *to_drm_sched_fence(struct dma_fence *f);
>   * to schedule the job.
>   */
>  struct drm_sched_job {
> -	struct spsc_node		queue_node;
> -	struct list_head		list;
> +	u64				id;
> +
> +	/**
> +	 * @submit_ts:
> +	 *
> +	 * When the job was pushed into the entity queue.
> +	 */
> +	ktime_t                         submit_ts;
>  
>  	/**
>  	 * @sched:
> @@ -349,24 +355,30 @@ struct drm_sched_job {
>  	 * has finished.
>  	 */
>  	struct drm_gpu_scheduler	*sched;
> +
>  	struct drm_sched_fence		*s_fence;
> +	struct drm_sched_entity         *entity;
>  
> +	enum drm_sched_priority		s_priority;
>  	u32				credits;
> +	/** @last_dependency: tracks @dependencies as they signal */
> +	unsigned int			last_dependency;
> +	atomic_t			karma;
> +
> +	struct spsc_node		queue_node;
> +	struct list_head		list;
>  
>  	/*
>  	 * work is used only after finish_cb has been used and will not be
>  	 * accessed anymore.
>  	 */
>  	union {
> -		struct dma_fence_cb		finish_cb;
> -		struct work_struct		work;
> +		struct dma_fence_cb	finish_cb;
> +		struct work_struct	work;

I usually prefer to leave those things alone, but since you change most of this
struct anyways...

With or without this diff:

Acked-by: Danilo Krummrich <dakr@kernel.org>

>  	};
>  
> -	uint64_t			id;
> -	atomic_t			karma;
> -	enum drm_sched_priority		s_priority;
> -	struct drm_sched_entity         *entity;
>  	struct dma_fence_cb		cb;
> +
>  	/**
>  	 * @dependencies:
>  	 *
> @@ -375,16 +387,6 @@ struct drm_sched_job {
>  	 * drm_sched_job_add_implicit_dependencies().
>  	 */
>  	struct xarray			dependencies;
> -
> -	/** @last_dependency: tracks @dependencies as they signal */
> -	unsigned long			last_dependency;
> -
> -	/**
> -	 * @submit_ts:
> -	 *
> -	 * When the job was pushed into the entity queue.
> -	 */
> -	ktime_t                         submit_ts;
>  };
>  
>  static inline bool drm_sched_invalidate_job(struct drm_sched_job *s_job,
> -- 
> 2.48.0
> 

  reply	other threads:[~2025-02-06 17:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-06 16:40 [PATCH v3 0/3] drm/sched: Job queue peek/pop helpers and struct job re-order Tvrtko Ursulin
2025-02-06 16:40 ` [PATCH 1/3] drm/sched: Add internal job peek/pop API Tvrtko Ursulin
2025-02-06 16:54   ` Danilo Krummrich
2025-02-07  8:41     ` Tvrtko Ursulin
2025-02-06 16:40 ` [PATCH 2/3] drm/amdgpu: Pop jobs from the queue more robustly Tvrtko Ursulin
2025-02-11  8:22   ` Christian König
2025-02-11 10:08     ` Philipp Stanner
2025-02-11 10:21       ` Christian König
2025-02-11 10:35         ` Tvrtko Ursulin
2025-02-14 10:21         ` Tvrtko Ursulin
2025-02-14 10:31           ` Christian König
2025-02-14 10:34             ` Tvrtko Ursulin
2025-02-14 10:39               ` Christian König
2025-02-06 16:40 ` [PATCH 3/3] drm/sched: Remove a hole from struct drm_sched_job Tvrtko Ursulin
2025-02-06 17:04   ` Danilo Krummrich [this message]
2025-02-11  8:28   ` Christian König
2025-02-06 16:58 ` [PATCH v3 0/3] drm/sched: Job queue peek/pop helpers and struct job re-order Danilo Krummrich
2025-02-07 10:13   ` Tvrtko Ursulin

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=Z6Trmm0s2oTP-mDd@cassiopeiae \
    --to=dakr@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=kernel-dev@igalia.com \
    --cc=matthew.brost@intel.com \
    --cc=phasta@kernel.org \
    --cc=tvrtko.ursulin@igalia.com \
    /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.