Hello,
On Thu, Oct 10, 2024 at 02:12:37PM -0500, David Vernet wrote:
...
I don't think we need them with the current queued spinlock implementationstatic struct task_struct *scx_task_iter_next(struct scx_task_iter *iter)Could you explain why we need this cpu_relax()? I thought it was only
{
struct list_head *cursor = &iter->cursor.tasks_node;
struct sched_ext_entity *pos;
- lockdep_assert_held(&scx_tasks_lock);
+ if (!(++iter->cnt % SCX_OPS_TASK_ITER_BATCH)) {
+ scx_task_iter_unlock(iter);
+ cpu_relax();
necessary for busy-wait loops.
but back when the spinlocks were dumb, just unlocking and relocking could
still starve out others.
cc'ing Waiman who should know a lot better than me. Waiman, what's the
current state? When releasing a spinlock to give others a chance, can we
just do unlock/lock or is cpu_relax() still useful in some cases?