STRUCT BFQ_ENTITY(9)
β¨ struct bfq_entity(9) β¨ β the Kernel API Manual page, but make it make sense
okay bestie, buckle up π this one is from the Kernel API Manual (struct bfq_entity(9)) and it's literally the blueprint for the schedulable entity β the main character of BFQ's little cgroup family tree. no cap, she's iconic. π
πΈ NAME πΈ
struct bfq_entity β schedulable entity. that's it, that's the vibe. a thing that the scheduler can actually, like, schedule. π
π¦ SYNOPSIS π¦
struct bfq_entity {
struct rb_node rb_node;
bool on_st_or_in_serv;
u64 start, finish;
struct rb_root *tree;
u64 min_start;
int service;
int budget;
int allocated;
int dev_weight;
int weight;
int new_weight;
int orig_weight;
struct bfq_entity *parent;
struct bfq_sched_data *my_sched_data;
struct bfq_sched_data *sched_data;
int prio_changed;
#ifdef CONFIG_BFQ_GROUP_IOSCHED;
bool in_groups_with_pending_reqs;
#endif;
struct bfq_queue *last_bfqq_created;
};
look at her. so many fields. so much lore. π«Ά
π§ Members π§
ngl, the original just says "Members" and then moves on β so we're keeping it exactly that β¨ (no invented descriptions here, bestie, that would be a vibe crime π)
π Description π
so, what is a bfq_entity, fr fr? a bfq_entity is used to represent either a bfq_queue (that's the leaf node in the cgroup hierarchy π±) or a bfq_group up in the upper level scheduler. every entity belongs to the sched_data of the parent group in the cgroup hierarchy. and the non-leaf entities? they also have their own sched_data, stored in my_sched_data. see, everybody gets a sched_data. slay. π
each entity stores its priority values independently β which would allow different weights on different devices, but highkey that functionality is not exported to userspace by now. so like, the door's there, nobody's opened it yet πͺβ¨
priorities and weights get updated lazily, bestie: first you stash the new values into the new_* fields, then you set the prio_changed flag. and as soon as there's a transition in the entity state that allows the priority update to actually take place, the effective and the requested priority values are synchronized. very demure, very mindful, very deferred. π
unless cgroups are used, the weight value is calculated from the ioprio to export the same interface as CFQ. and when we're dealing with "well-behaved" queues β i.e., queues that do not spend too much time to consume their budget, and have true sequential behavior, and when there are no external factors breaking anticipation β the relative weights at each level of the cgroups hierarchy should be guaranteed. π―
β οΈ okay important safety announcement: all the fields are protected by the queue lock of the containingbfqd. no freelancing. no vibes-based locking. thebfqdqueue lock or nothing, periodt. π
π SEE ALSO π
go read these, they're the friend group π«Ά
- Kernel file
./block/bfq-iosched.h struct bfq_service_tree(9)struct bfq_sched_data(9)struct bfq_weight_counter(9)struct bfq_ttime(9)struct bfq_queue(9)struct bfq_io_cq(9)struct bfq_data(9)struct bfq_group(9)
okay and that's the whole page, babe πβ¨ huge thanks to ./block for hosting this icon, and shoutout to the October 2026 release β she's fresh, she's documented, she's giving kernel internals. π§ββοΈπ bye bestie, go read the source, iykyk π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms