From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9E3C30EF7C for ; Tue, 7 Apr 2026 09:54:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775555668; cv=none; b=hYHkJ+wT7J6C5lydcrZzZ4l2eGg4NCxGs43M5y+zqedcuGF/Ezj6hWDoYGHiG6SFXomFz1RItH/g04Gm+TULKBY2K2rrR1oeozh+/VaEetNoTNjrIqerchgS76/Jijv/lDCD8kfeb1RuVxkhZocOfNuGT6HOsOKyTg+aj52w+28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775555668; c=relaxed/simple; bh=JiDmOBb52ayWBZHsIMB0ZOY9VC0NkDLYiOe/EP4wUhs=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=q9VHbFniqWyrA+pYz4YKS7VbLuGBUd0aWGmYD0VyxWsBP7zFzNPpmGXDRXHKrP14nHxP/7qbgKgl+Psdmpxo7EBNyfC+jjDqCHIz+efSGUE3SQiuMGLcNrlWra2wXmAF8Eu6EOiquAeikaAB5jxRrvlXjdeZYeJSfvmFrGJbTgw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jpiecuch.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Z4V9YH5L; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jpiecuch.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Z4V9YH5L" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4888b17ffa6so38739745e9.3 for ; Tue, 07 Apr 2026 02:54:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775555664; x=1776160464; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=i4vsXtEL49zVqufg8lyj0hHK/lVL3UAvs+p/Ca2lHfA=; b=Z4V9YH5LgyFP2LLpbJAWuOfQGDtUWejX9rBROyyI+ewpU8+f3S/Ig5MtzMqiXtFz4j oM219Bbg6NkoUsQfN3rU1eBqNDXL7+kPzf5+JbFaYCbc8rXKNBY0mUDCAh1h8w01JIK6 DlZ9Vn7XOR0b9cYPAyo4VMZ10LY5ERe38CNE/rh6nUHcmfqKhLYv8nDeo7o2ajv23f71 BNZT9rWPSlY3xGiuf1PHHWIT7wfaJ9WLRjwOYUxq+Ohq7yJA71SfBw6U30Pu3S/dD8iI KPTEvdjxlG24UjhIGYCKAcvu7DmFVNe67uobFaq35Xwyiv0LvHa+szxzbB1TiuEPT5xY yfww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775555664; x=1776160464; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=i4vsXtEL49zVqufg8lyj0hHK/lVL3UAvs+p/Ca2lHfA=; b=VxeztMZ3eFhtTf1oEzB75aALvxF/5qvNhs8eZevzwl2rekuA8nLZRWiXU9OJinYGsF +NTUFr/d0ZHdugDl5+E85VaVqJJtGbJpLUumlJvK4lapMzHnjMI6YGeLrW43ZqmaNtaS z0A4ygl5LN78G9nA/R8kY6CJ9ju5kim7fQeSs/7Akdt9+yV3Hnzlwf8OZSy0jyJphhXL p6QK3J0sobcckpDyIKkr15xygCpCpttxtTszl5nW01MuYWxffwovgrfBAb5UqTiK6f0V FeFVS3NKTmYPLWtV2uGfklTDRKvq5/nPvWnA3x9WHgDRCzFZ7gTxLRBWa+OmytVa0U28 hKvA== X-Forwarded-Encrypted: i=1; AJvYcCWVPM5FGNQsBRnG8XzJpTC6n8j/FM8ADwmOMW1HuEZ7OxPKimhXsUevMRF9W8jWVh1n1g1Fvz/X3fqhrdU=@vger.kernel.org X-Gm-Message-State: AOJu0YycKlEOLccr4junUNkHtoSnq2iFEOJQA2DjwNkbE8VtaVgSdddx S3l79M+6JtFHz2Hii15ehzsBuLqIgs+SP/bmJSbIMI75qNi/spMhICpo8GpXNvlhX/ky3xszt2G 7Q02MPvmfl268xA== X-Received: from wmc13.prod.google.com ([2002:a05:600c:600d:b0:488:7c5a:b238]) (user=jpiecuch job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:3492:b0:488:b14f:b8ed with SMTP id 5b1f17b1804b1-488b14fb9e4mr101613605e9.0.1775555663834; Tue, 07 Apr 2026 02:54:23 -0700 (PDT) Date: Tue, 07 Apr 2026 09:54:22 +0000 In-Reply-To: <20260406114755.840497-1-arighi@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260406114755.840497-1-arighi@nvidia.com> X-Mailer: aerc 0.21.0-0-g5549850facc2 Message-ID: Subject: Re: [PATCH sched_ext/for-7.1] sched_ext: Documentation: Add ops.dequeue() to task lifecycle From: Kuba Piecuch To: Andrea Righi , Tejun Heo , David Vernet , Changwoo Min Cc: Christian Loehle , Kuba Piecuch , Emil Tsalapatis , , Content-Type: text/plain; charset="UTF-8" Hi Andrea, On Mon Apr 6, 2026 at 11:47 AM UTC, Andrea Righi wrote: > Document ops.dequeue() in the sched_ext task lifecycle now that its > semantics are well-defined. > > Also update the pseudo-code to use task_is_runnable() consistently and > clarify the case where ops.dispatch() does not refill the time slice. > > Fixes: ebf1ccff79c4 ("sched_ext: Fix ops.dequeue() semantics") > Signed-off-by: Andrea Righi > --- > Documentation/scheduler/sched-ext.rst | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > > diff --git a/Documentation/scheduler/sched-ext.rst b/Documentation/scheduler/sched-ext.rst > index 404b4e4c33f7e..9f03650abfeba 100644 > --- a/Documentation/scheduler/sched-ext.rst > +++ b/Documentation/scheduler/sched-ext.rst > @@ -422,23 +422,29 @@ by a sched_ext scheduler: > > ops.runnable(); /* Task becomes ready to run */ > > - while (task is runnable) { > + while (task_is_runnable(task)) { > if (task is not in a DSQ && task->scx.slice == 0) { > ops.enqueue(); /* Task can be added to a DSQ */ > > - /* Any usable CPU becomes available */ > + /* Task property change (i.e., affinity, nice, etc.)? */ > + if (sched_change(task)) { > + ops.dequeue(); /* Exiting BPF scheduler custody */ Doesn't the task also go through quiescent -> runnable here? The full path being dequeue -> quiescent -> (actual property change) -> runnable -> enqueue. I guess we should be accurate here since quiescent and runnable are present elsewhere in the pseudocode. > + continue; > + } > + } > > - ops.dispatch(); /* Task is moved to a local DSQ */ > + /* Any usable CPU becomes available */ > + > + ops.dispatch(); /* Task is moved to a local DSQ */ s/local/terminal/? > + ops.dequeue(); /* Exiting BPF scheduler custody */ > > - ops.dequeue(); /* Exiting BPF scheduler */ > - } > ops.running(); /* Task starts running on its assigned CPU */ > > - while task_is_runnable(p) { > - while (task->scx.slice > 0 && task_is_runnable(p)) > - ops.tick(); /* Called every 1/HZ seconds */ > + while (task_is_runnable(task) && task->scx.slice > 0) { > + ops.tick(); /* Called every 1/HZ seconds */ > > - ops.dispatch(); /* task->scx.slice can be refilled */ > + if (task->scx.slice == 0) > + ops.dispatch(); /* task->scx.slice can be refilled */ > } > > ops.stopping(); /* Task stops running (time slice expires or wait) */ Thanks, Kuba