lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 22 Jan 2024 22:48:52 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Yajun Deng <yajun.deng@...ux.dev>
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
 vincent.guittot@...aro.org, dietmar.eggemann@....com, bsegall@...gle.com,
 mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] sched/fair: Return NULL when entity isn't a task
 in task_of()

On Wed,  6 Dec 2023 14:33:59 +0800
Yajun Deng <yajun.deng@...ux.dev> wrote:

> Before calling task_of(), we need to make sure that the entity is a task.
> There is also a warning in task_of() if the entity isn't a task. That
> means we need to check the entity twice. If the entity isn't a task,

Does it really check it twice? Have you disassembled it to see if the code
is any better?

#define entity_is_task(se)	(!se->my_q)
static inline struct task_struct *task_of(struct sched_entity *se)
{
	SCHED_WARN_ON(!entity_is_task(se));
	return container_of(se, struct task_struct, se);
}

The above is a macro and a static inline, which means that the compiler
should optimized out that second check.


> return the task struct is meaningless.
> 
> Return NULL when entity isn't a task in task_of(), and call task_of()
> instead of entity_is_task() when we need a task_struct.

I'm not against the change, as it could be considered a clean up. But it is
up to the sched maintainers to decide if it's worth the churn.

-- Steve


> 
> Signed-off-by: Yajun Deng <yajun.deng@...ux.dev>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ