mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/8] sched: Use lock guards, wave 2
@ 2023-08-09 20:24 Peter Zijlstra
  2023-08-09 20:24 ` [PATCH 1/8] sched: Simplify set_user_nice() Peter Zijlstra
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Peter Zijlstra @ 2023-08-09 20:24 UTC (permalink / raw)
  To: mingo
  Cc: peterz, juri.lelli, vincent.guittot, dietmar.eggemann, rostedt,
	bsegall, mgorman, bristot, vschneid, linux-kernel

Hi, as promised, here is the second part of the SBRM patches.

Now that we're a little used to them, these are a little more involved.

New in this series, over the guard()() and scoped_guard () usage, is CLASS().

CLASS() is very like guard() except it also takes a name argument. So where
guard() instantiates an 'anonymous' variable, CLASS() instantiates an
explicitly named one.

  CLASS(task_rq_lock, rq_guard)(p);

which can be read like:

  class_task_rq_lock_t rq_guard __cleanup(class_task_rq_lock_destructor) =
	class_task_rq_lock_constructor(p);

[[ Notable: guard(name) := CLASS(name, __UNIQUE_ID(guard)) ]]

The advantage in this specific case is that the guard object of task_rq_lock
will contain the 'struct rq *' which we'll need.

Another use of CLASS() is:

  CLASS(find_get_task, p)(pid);

Where 'p' is of 'struct task_struct *' type and the constructor does the
pid->task_struct lookup and the destructor does put_task_struct.

Again, mostly aimed at getting rid of error gotos. The final patch is a bunch
of random conversions that happened while I was poking around and playing with
things.

Also available at:

  git://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git sched/guards2


Next in line is kernel/events/core.c, but I might not bore all of you with those
patches :-)


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-09 20:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-09 20:24 [PATCH 0/8] sched: Use lock guards, wave 2 Peter Zijlstra
2023-08-09 20:24 ` [PATCH 1/8] sched: Simplify set_user_nice() Peter Zijlstra
2023-08-09 20:24 ` [PATCH 2/8] sched: Simplify syscalls Peter Zijlstra
2023-08-09 20:24 ` [PATCH 3/8] sched: Simplify sched_{set,get}affinity() Peter Zijlstra
2023-08-09 20:24 ` [PATCH 4/8] sched: Simplify yield_to() Peter Zijlstra
2023-08-09 20:24 ` [PATCH 5/8] sched: Simplify sched_rr_get_interval() Peter Zijlstra
2023-08-09 20:24 ` [PATCH 6/8] sched: Simplify sched_move_task() Peter Zijlstra
2023-08-09 20:24 ` [PATCH 7/8] sched: Simplify tg_set_cfs_bandwidth() Peter Zijlstra
2023-08-09 20:24 ` [PATCH 8/8] sched: Misc cleanups Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®