The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: Tejun Heo <tj@kernel.org>
Cc: void@manifault.com, multics69@gmail.com,
	linux-kernel@vger.kernel.org, sched-ext@meta.com
Subject: Re: [PATCH 4/5] sched_ext: Drop "ops" from scx_ops_exit(), scx_ops_error() and friends
Date: Fri, 4 Apr 2025 22:06:56 +0200	[thread overview]
Message-ID: <Z_A74OspwwIPuNQ_@gpd3> (raw)
In-Reply-To: <Z_AuwsDt68U01rmL@slm.duckdns.org>

On Fri, Apr 04, 2025 at 09:10:58AM -1000, Tejun Heo wrote:
> Hello, Andrea.
> 
> On Fri, Apr 04, 2025 at 09:30:23AM +0200, Andrea Righi wrote:
> > > @@ -1043,18 +1043,17 @@ static struct kobject *scx_root_kobj;
> > >  
> > >  static void process_ddsp_deferred_locals(struct rq *rq);
> > >  static void scx_bpf_kick_cpu(s32 cpu, u64 flags);
> > > -static __printf(3, 4) void scx_ops_exit_kind(enum scx_exit_kind kind,
> > > -					     s64 exit_code,
> > > -					     const char *fmt, ...);
> > > +static __printf(3, 4) void __scx_exit(enum scx_exit_kind kind, s64 exit_code,
> > > +				      const char *fmt, ...);
> > >  
> > > -#define scx_ops_error_kind(err, fmt, args...)					\
> > > -	scx_ops_exit_kind((err), 0, fmt, ##args)
> > > +#define __scx_error(err, fmt, args...)						\
> > > +	__scx_exit((err), 0, fmt, ##args)
> > >  
> > 
> > Can we move scx_error() here, right after __scx_error(), for better
> > readability?
> 
> The current order is:
> 
>   __scx_exit()
>   __scx_error()
>   scx_exit()
>   scx_error()

I see, that's because there's __scx_exit() function definition before the
macros. It's a bit difficult to read, but not the end of the world.

> 
> If relocated as you suggested:
> 
>   __scx_exit()
>   __scx_error()
>   scx_error()
>   scx_exit()
> 
> which probably isn't optimal. We can do:
> 
>   __scx_exit()
>   scx_exit()
>   __scx_error()
>   scx_error()
> 
> Maybe that's a bit better. I don't know.

This looks better, but I'm just nitpicking here, so feel free to ignore
this.

> 
> > > -#define scx_ops_exit(code, fmt, args...)					\
> > > -	scx_ops_exit_kind(SCX_EXIT_UNREG_KERN, (code), fmt, ##args)
> > > +#define scx_exit(code, fmt, args...)						\
> > > +	__scx_exit(SCX_EXIT_UNREG_KERN, (code), fmt, ##args)
> > >  
> > > -#define scx_ops_error(fmt, args...)						\
> > > -	scx_ops_error_kind(SCX_EXIT_ERROR, fmt, ##args)
> > > +#define scx_error(fmt, args...)							\
> > > +	__scx_error(SCX_EXIT_ERROR, fmt, ##args)
> > 
> > I've always found scx_exit_kind / exit_code a bit confusing, scx_exit_kind
> > represents the reason of the exit, while exit_code is an additional code to
> > describe the error.
> > 
> > Not necessarily for this patch set, but what do you think about renaming
> > scx_exit_kind to scx_exit_reason and scx_exit_reason() to
> > scx_exit_reason_str()?
> 
> Even if those are better names, the enum is exposed and used from the
> schedulers and renaming it would need to go through compatibility process.
> I'm not sure the gain here would be justified.
> 
> We basically have two levels of exit descriptors. We call the higher level
> kind and lower level code. I think having two exit descriptors is going to
> be a bit confusing no matter what we do and maybe we should have stuck to
> one value. Anyways, here, I'm not sure the return would justify the cost.

Yeah, I wasn't considering that it's part of the BPF API, definitely not
worth changing it. Let's keep it as it is, maybe we can add a comment later
to scx_exit_kind to better explain the difference with the exit code.

Thanks,
-Andrea

  reply	other threads:[~2025-04-04 20:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 22:49 [PATCHSET sched_ext/for-6.16] sched_ext: Cleanup "ops" usage in symbols Tejun Heo
2025-04-03 22:49 ` [PATCH 1/5] sched_ext: Drop "ops" from scx_ops_enable_state and friends Tejun Heo
2025-04-03 22:49 ` [PATCH 2/5] sched_ext: Drop "ops" from scx_ops_helper, scx_ops_enable_mutex and __scx_ops_enabled Tejun Heo
2025-04-03 22:49 ` [PATCH 3/5] sched_ext: Drop "ops" from scx_ops_bypass(), scx_ops_breather() and friends Tejun Heo
2025-04-03 22:49 ` [PATCH 4/5] sched_ext: Drop "ops" from scx_ops_exit(), scx_ops_error() " Tejun Heo
2025-04-04  7:30   ` Andrea Righi
2025-04-04 19:10     ` Tejun Heo
2025-04-04 20:06       ` Andrea Righi [this message]
2025-04-03 22:49 ` [PATCH 5/5] sched_ext: Drop "ops" from scx_ops_{init|exit|enable|disable}[_task]() " Tejun Heo
2025-04-04  7:41 ` [PATCHSET sched_ext/for-6.16] sched_ext: Cleanup "ops" usage in symbols Andrea Righi
2025-04-04 18:53   ` Tejun Heo
2025-04-04 19:12   ` [PATCH 6/5] sched_ext: Drop "ops" from SCX_OPS_TASK_ITER_BATCH Tejun Heo
2025-04-04 20:08     ` Andrea Righi
2025-04-04 20:10     ` Tejun Heo

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=Z_A74OspwwIPuNQ_@gpd3 \
    --to=arighi@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=multics69@gmail.com \
    --cc=sched-ext@meta.com \
    --cc=tj@kernel.org \
    --cc=void@manifault.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox