From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.12 32/87] sched/deadline: Document dl_server
Date: Wed, 4 Feb 2026 15:40:30 +0100 [thread overview]
Message-ID: <20260204143848.068025999@linuxfoundation.org> (raw)
In-Reply-To: <20260204143846.906385641@linuxfoundation.org>
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <peterz@infradead.org>
[ Upstream commit 2614069c5912e9d6f1f57c262face1b368fb8c93 ]
Place the notes that resulted from going through the dl_server code in a
comment.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Stable-dep-of: 115135422562 ("sched/deadline: Fix 'stuck' dl_server")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
kernel/sched/deadline.c | 194 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 194 insertions(+)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index abd0fb2d839c1..a860d77062395 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1624,6 +1624,200 @@ void dl_server_update(struct sched_dl_entity *dl_se, s64 delta_exec)
update_curr_dl_se(dl_se->rq, dl_se, delta_exec);
}
+/*
+ * dl_server && dl_defer:
+ *
+ * 6
+ * +--------------------+
+ * v |
+ * +-------------+ 4 +-----------+ 5 +------------------+
+ * +-> | A:init | <--- | D:running | -----> | E:replenish-wait |
+ * | +-------------+ +-----------+ +------------------+
+ * | | | 1 ^ ^ |
+ * | | 1 +----------+ | 3 |
+ * | v | |
+ * | +--------------------------------+ 2 |
+ * | | | ----+ |
+ * | 8 | B:zero_laxity-wait | | |
+ * | | | <---+ |
+ * | +--------------------------------+ |
+ * | | ^ ^ 2 |
+ * | | 7 | 2 +--------------------+
+ * | v |
+ * | +-------------+ |
+ * +-- | C:idle-wait | -+
+ * +-------------+
+ * ^ 7 |
+ * +---------+
+ *
+ *
+ * [A] - init
+ * dl_server_active = 0
+ * dl_throttled = 0
+ * dl_defer_armed = 0
+ * dl_defer_running = 0/1
+ * dl_defer_idle = 0
+ *
+ * [B] - zero_laxity-wait
+ * dl_server_active = 1
+ * dl_throttled = 1
+ * dl_defer_armed = 1
+ * dl_defer_running = 0
+ * dl_defer_idle = 0
+ *
+ * [C] - idle-wait
+ * dl_server_active = 1
+ * dl_throttled = 1
+ * dl_defer_armed = 1
+ * dl_defer_running = 0
+ * dl_defer_idle = 1
+ *
+ * [D] - running
+ * dl_server_active = 1
+ * dl_throttled = 0
+ * dl_defer_armed = 0
+ * dl_defer_running = 1
+ * dl_defer_idle = 0
+ *
+ * [E] - replenish-wait
+ * dl_server_active = 1
+ * dl_throttled = 1
+ * dl_defer_armed = 0
+ * dl_defer_running = 1
+ * dl_defer_idle = 0
+ *
+ *
+ * [1] A->B, A->D
+ * dl_server_start()
+ * dl_server_active = 1;
+ * enqueue_dl_entity()
+ * update_dl_entity(WAKEUP)
+ * if (!dl_defer_running)
+ * dl_defer_armed = 1;
+ * dl_throttled = 1;
+ * if (dl_throttled && start_dl_timer())
+ * return; // [B]
+ * __enqueue_dl_entity();
+ * // [D]
+ *
+ * // deplete server runtime from client-class
+ * [2] B->B, C->B, E->B
+ * dl_server_update()
+ * update_curr_dl_se() // idle = false
+ * if (dl_defer_idle)
+ * dl_defer_idle = 0;
+ * if (dl_defer && dl_throttled && dl_runtime_exceeded())
+ * dl_defer_running = 0;
+ * hrtimer_try_to_cancel(); // stop timer
+ * replenish_dl_new_period()
+ * // fwd period
+ * dl_throttled = 1;
+ * dl_defer_armed = 1;
+ * start_dl_timer(); // restart timer
+ * // [B]
+ *
+ * // timer actually fires means we have runtime
+ * [3] B->D
+ * dl_server_timer()
+ * if (dl_defer_armed)
+ * dl_defer_running = 1;
+ * enqueue_dl_entity(REPLENISH)
+ * replenish_dl_entity()
+ * // fwd period
+ * if (dl_throttled)
+ * dl_throttled = 0;
+ * if (dl_defer_armed)
+ * dl_defer_armed = 0;
+ * __enqueue_dl_entity();
+ * // [D]
+ *
+ * // schedule server
+ * [4] D->A
+ * pick_task_dl()
+ * p = server_pick_task();
+ * if (!p)
+ * dl_server_stop()
+ * dequeue_dl_entity();
+ * hrtimer_try_to_cancel();
+ * dl_defer_armed = 0;
+ * dl_throttled = 0;
+ * dl_server_active = 0;
+ * // [A]
+ * return p;
+ *
+ * // server running
+ * [5] D->E
+ * update_curr_dl_se()
+ * if (dl_runtime_exceeded())
+ * dl_throttled = 1;
+ * dequeue_dl_entity();
+ * start_dl_timer();
+ * // [E]
+ *
+ * // server replenished
+ * [6] E->D
+ * dl_server_timer()
+ * enqueue_dl_entity(REPLENISH)
+ * replenish_dl_entity()
+ * fwd-period
+ * if (dl_throttled)
+ * dl_throttled = 0;
+ * __enqueue_dl_entity();
+ * // [D]
+ *
+ * // deplete server runtime from idle
+ * [7] B->C, C->C
+ * dl_server_update_idle()
+ * update_curr_dl_se() // idle = true
+ * if (dl_defer && dl_throttled && dl_runtime_exceeded())
+ * if (dl_defer_idle)
+ * return;
+ * dl_defer_running = 0;
+ * hrtimer_try_to_cancel();
+ * replenish_dl_new_period()
+ * // fwd period
+ * dl_throttled = 1;
+ * dl_defer_armed = 1;
+ * dl_defer_idle = 1;
+ * start_dl_timer(); // restart timer
+ * // [C]
+ *
+ * // stop idle server
+ * [8] C->A
+ * dl_server_timer()
+ * if (dl_defer_idle)
+ * dl_server_stop();
+ * // [A]
+ *
+ *
+ * digraph dl_server {
+ * "A:init" -> "B:zero_laxity-wait" [label="1:dl_server_start"]
+ * "A:init" -> "D:running" [label="1:dl_server_start"]
+ * "B:zero_laxity-wait" -> "B:zero_laxity-wait" [label="2:dl_server_update"]
+ * "B:zero_laxity-wait" -> "C:idle-wait" [label="7:dl_server_update_idle"]
+ * "B:zero_laxity-wait" -> "D:running" [label="3:dl_server_timer"]
+ * "C:idle-wait" -> "A:init" [label="8:dl_server_timer"]
+ * "C:idle-wait" -> "B:zero_laxity-wait" [label="2:dl_server_update"]
+ * "C:idle-wait" -> "C:idle-wait" [label="7:dl_server_update_idle"]
+ * "D:running" -> "A:init" [label="4:pick_task_dl"]
+ * "D:running" -> "E:replenish-wait" [label="5:update_curr_dl_se"]
+ * "E:replenish-wait" -> "B:zero_laxity-wait" [label="2:dl_server_update"]
+ * "E:replenish-wait" -> "D:running" [label="6:dl_server_timer"]
+ * }
+ *
+ *
+ * Notes:
+ *
+ * - When there are fair tasks running the most likely loop is [2]->[2].
+ * the dl_server never actually runs, the timer never fires.
+ *
+ * - When there is actual fair starvation; the timer fires and starts the
+ * dl_server. This will then throttle and replenish like a normal DL
+ * task. Notably it will not 'defer' again.
+ *
+ * - When idle it will push the actication forward once, and then wait
+ * for the timer to hit or a non-idle update to restart things.
+ */
void dl_server_start(struct sched_dl_entity *dl_se)
{
struct rq *rq = dl_se->rq;
--
2.51.0
next prev parent reply other threads:[~2026-02-04 15:24 UTC|newest]
Thread overview: 104+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 14:39 [PATCH 6.12 00/87] 6.12.69-rc1 review Greg Kroah-Hartman
2026-02-04 14:39 ` [PATCH 6.12 01/87] can: at91_can: Fix memory leak in at91_can_probe() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 02/87] Bluetooth: hci_uart: fix null-ptr-deref in hci_uart_write_work Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 03/87] Bluetooth: MGMT: Fix memory leak in set_ssp_complete Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 04/87] net/mlx5: Fix memory leak in esw_acl_ingress_lgcy_setup() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 05/87] can: gs_usb: gs_usb_receive_bulk_callback(): fix error message Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 06/87] net: bcmasp: fix early exit leak with fixed phy Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 07/87] octeon_ep: Fix memory leak in octep_device_setup() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 08/87] bonding: annotate data-races around slave->last_rx Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 09/87] net: mvpp2: cls: Fix memory leak in mvpp2_ethtool_cls_rule_ins() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 10/87] ipv6: use the right ifindex when replying to icmpv6 from localhost Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 11/87] net: wwan: t7xx: fix potential skb->frags overflow in RX path Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 12/87] rocker: fix memory leak in rocker_world_port_post_fini() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 13/87] nfc: llcp: Fix memleak in nfc_llcp_send_ui_frame() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 14/87] ice: Fix NULL pointer dereference in ice_vsi_set_napi_queues Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 15/87] ice: stop counting UDP csum mismatch as rx_errors Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 16/87] net/mlx5e: TC, delete flows only for existing peers Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 17/87] nfc: nci: Fix race between rfkill and nci_unregister_device() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 18/87] net: bridge: fix static key check Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 19/87] net: phy: micrel: fix clk warning when removing the driver Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 20/87] net/mlx5: fs, Fix inverted cap check in tx flow table root disconnect Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 21/87] net/mlx5: Initialize events outside devlink lock Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 22/87] net/mlx5: Fix vhca_id access call trace use before alloc Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 23/87] net/mlx5e: Skip ESN replay window setup for IPsec crypto offload Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 24/87] scsi: firewire: sbp-target: Fix overflow in sbp_make_tpg() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 25/87] ASoC: Intel: sof_es8336: fix headphone GPIO logic inversion Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 26/87] gpiolib: acpi: use BIT_ULL() for u64 mask in address space handler Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 27/87] gpio: virtuser: fix UAF in configfs release path Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 28/87] bcache: fix improper use of bi_end_io Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 29/87] bcache: use bio cloning for detached device requests Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 30/87] bcache: fix I/O accounting leak in detached_dev_do_request Greg Kroah-Hartman
2026-02-13 0:16 ` Guenter Roeck
2026-02-16 9:50 ` Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 31/87] dma/pool: distinguish between missing and exhausted atomic pools Greg Kroah-Hartman
2026-02-04 14:40 ` Greg Kroah-Hartman [this message]
2026-02-04 14:40 ` [PATCH 6.12 33/87] sched/deadline: Fix stuck dl_server Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 34/87] pinctrl: meson: mark the GPIO controller as sleeping Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 35/87] riscv: compat: fix COMPAT_UTS_MACHINE definition Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 36/87] rust: rbtree: fix documentation typo in CursorMut peek_next method Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 37/87] rust: kbuild: give `--config-path` to `rustfmt` in `.rsi` target Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 38/87] ASoC: fsl: imx-card: Do not force slot width to sample width Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 39/87] scsi: be2iscsi: Fix a memory leak in beiscsi_boot_get_sinfo() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 40/87] ASoC: amd: yc: Add DMI quirk for Acer TravelMate P216-41-TCO Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 41/87] gpio: pca953x: mask interrupts in irq shutdown Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 42/87] scsi: qla2xxx: edif: Fix dma_free_coherent() size Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 43/87] efivarfs: fix error propagation in efivar_entry_get() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 44/87] nvmet: fix race in nvmet_bio_done() leading to NULL pointer dereference Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 45/87] gpio: rockchip: Stop calling pinctrl for set_direction Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 46/87] mm/kasan: fix KASAN poisoning in vrealloc() Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 47/87] mptcp: only reset subflow errors when propagated Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 48/87] selftests: mptcp: check no dup close events after error Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 49/87] selftests: mptcp: check subflow errors in close events Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 50/87] selftests: mptcp: join: fix local endp not being tracked Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 51/87] flex_proportions: make fprop_new_period() hardirq safe Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 52/87] mm/memory-failure: fix missing ->mf_stats count in hugetlb poison Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 53/87] mm/memory-failure: teach kill_accessing_process to accept hugetlb tail page pfn Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 54/87] mm/shmem, swap: fix race of truncate and swap entry split Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 55/87] net: fix segmentation of forwarding fraglist GRO Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 56/87] scripts: generate_rust_analyzer: remove sysroot assertion Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 57/87] scripts: generate_rust_analyzer: compile sysroot with correct edition Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 58/87] scripts: generate_rust_analyzer: Add compiler_builtins -> core dep Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 59/87] drm/msm/a6xx: fix bogus hwcg register updates Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 60/87] drm/imx/tve: fix probe device leak Greg Kroah-Hartman
2026-02-04 14:40 ` [PATCH 6.12 61/87] drm/amdgpu/soc21: fix xclk for APUs Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 62/87] drm/amdgpu/gfx10: fix wptr reset in KGQ init Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 63/87] drm/amdgpu/gfx11: " Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 64/87] drm/amdgpu/gfx12: " Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 65/87] drm/amdgpu: fix NULL pointer dereference in amdgpu_gmc_filter_faults_remove Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 66/87] drm/amdgpu: Fix cond_exec handling in amdgpu_ib_schedule() Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 67/87] gpiolib: acpi: Fix potential out-of-boundary left shift Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 68/87] rust: kbuild: support `-Cjump-tables=n` for Rust 1.93.0 Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 69/87] cgroup: Fix kernfs_node UAF in css_free_rwork_fn Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 70/87] rxrpc: Fix data-race warning and potential load/store tearing Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 71/87] ksmbd: smbd: fix dma_unmap_sg() nents Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 72/87] libbpf: Fix -Wdiscarded-qualifiers under C23 Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 73/87] mm/kfence: randomize the freelist on initialization Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 74/87] wifi: ath11k: add srng->lock for ath11k_hal_srng_* in monitor mode Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 75/87] Revert "drm/nouveau/disp: Set drm_mode_config_funcs.atomic_(check|commit)" Greg Kroah-Hartman
2026-02-05 14:28 ` Guenter Roeck
2026-02-05 14:30 ` Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 76/87] btrfs: prevent use-after-free on folio private data in btrfs_subpage_clear_uptodate() Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 77/87] net/sched: act_ife: convert comma to semicolon Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 78/87] pinctrl: qcom: sm8350-lpass-lpi: Merge with SC7280 to fix I2S2 and SWR TX pins Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 79/87] mptcp: avoid dup SUB_CLOSED events after disconnect Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 80/87] perf: Simplify get_perf_callchain() user logic Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 81/87] perf: sched: Fix perf crash with new is_user_task() helper Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 82/87] writeback: fix 100% CPU usage when dirtytime_expire_interval is 0 Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 83/87] drm/amdgpu/gfx11: adjust KGQ reset sequence Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 84/87] pinctrl: lpass-lpi: implement .get_direction() for the GPIO driver Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 85/87] net: mana: Change the function signature of mana_get_primary_netdev_rcu Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 86/87] RDMA/mana_ib: Handle net event for pointing to the current netdev Greg Kroah-Hartman
2026-02-04 14:41 ` [PATCH 6.12 87/87] bpf/selftests: test_select_reuseport_kern: Remove unused header Greg Kroah-Hartman
2026-02-04 19:52 ` [PATCH 6.12 00/87] 6.12.69-rc1 review Brett A C Sheffield
2026-02-04 20:11 ` Florian Fainelli
2026-02-04 20:27 ` Jon Hunter
2026-02-04 23:39 ` Peter Schneider
2026-02-05 7:40 ` Ron Economos
2026-02-05 8:26 ` Francesco Dolcini
2026-02-05 10:30 ` Harshit Mogalapalli
2026-02-05 12:13 ` Mark Brown
2026-02-05 14:34 ` Brett Mastbergen
2026-02-06 1:22 ` Hardik Garg
2026-02-06 5:53 ` Shung-Hsi Yu
2026-02-06 9:29 ` Miguel Ojeda
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=20260204143848.068025999@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=patches@lists.linux.dev \
--cc=peterz@infradead.org \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/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