include/linux/dynamic_queue_limits.h
Source file repositories/reference/linux-study-clean/include/linux/dynamic_queue_limits.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/dynamic_queue_limits.h- Extension
.h- Size
- 5562 bytes
- Lines
- 164
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hasm/bug.h
Detected Declarations
struct dqlfunction dql_queue_stallfunction timefunction dql_queuedfunction dql_avail
Annotated Snippet
struct dql {
/* Fields accessed in enqueue path (dql_queued) */
unsigned int num_queued; /* Total ever queued */
unsigned int adj_limit; /* limit + num_completed */
unsigned int last_obj_cnt; /* Count at last queuing */
/* Stall threshold (in jiffies), defined by user */
unsigned short stall_thrs;
unsigned long history_head; /* top 58 bits of jiffies */
/* stall entries, a bit per entry */
unsigned long history[DQL_HIST_LEN];
/* Fields accessed only by completion path (dql_completed) */
unsigned int limit ____cacheline_aligned_in_smp; /* Current limit */
unsigned int num_completed; /* Total ever completed */
unsigned int prev_ovlimit; /* Previous over limit */
unsigned int prev_num_queued; /* Previous queue total */
unsigned int prev_last_obj_cnt; /* Previous queuing cnt */
unsigned int lowest_slack; /* Lowest slack found */
unsigned long slack_start_time; /* Time slacks seen */
/* Configuration */
unsigned int max_limit; /* Max limit */
unsigned int min_limit; /* Minimum limit */
unsigned int slack_hold_time; /* Time to measure slack */
/* Longest stall detected, reported to user */
unsigned short stall_max;
unsigned long last_reap; /* Last reap (in jiffies) */
unsigned long stall_cnt; /* Number of stalls */
};
/* Set some static maximums */
#define DQL_MAX_OBJECT (UINT_MAX / 16)
#define DQL_MAX_LIMIT ((UINT_MAX / 2) - DQL_MAX_OBJECT)
/* Populate the bitmap to be processed later in dql_check_stall() */
static inline void dql_queue_stall(struct dql *dql)
{
unsigned long map, now, now_hi, i;
now = jiffies;
now_hi = now / BITS_PER_LONG;
/* The following code set a bit in the ring buffer, where each
* bit trackes time the packet was queued. The dql->history buffer
* tracks DQL_HIST_LEN * BITS_PER_LONG time (jiffies) slot
*/
if (unlikely(now_hi != dql->history_head)) {
/* About to reuse slots, clear them */
for (i = 0; i < DQL_HIST_LEN; i++) {
/* Multiplication masks high bits */
if (now_hi * BITS_PER_LONG ==
(dql->history_head + i) * BITS_PER_LONG)
break;
DQL_HIST_ENT(dql, dql->history_head + i + 1) = 0;
}
/* pairs with smp_rmb() in dql_check_stall() */
smp_wmb();
WRITE_ONCE(dql->history_head, now_hi);
}
/* __set_bit() does not guarantee WRITE_ONCE() semantics */
map = DQL_HIST_ENT(dql, now_hi);
/* Populate the history with an entry (bit) per queued */
if (!(map & BIT_MASK(now)))
WRITE_ONCE(DQL_HIST_ENT(dql, now_hi), map | BIT_MASK(now));
}
/*
* Record number of objects queued. Assumes that caller has already checked
* availability in the queue with dql_avail.
*/
static inline void dql_queued(struct dql *dql, unsigned int count)
{
if (WARN_ON_ONCE(count > DQL_MAX_OBJECT))
return;
WRITE_ONCE(dql->last_obj_cnt, count);
/* We want to force a write first, so that cpu do not attempt
* to get cache line containing last_obj_cnt, num_queued, adj_limit
* in Shared state, but directly does a Request For Ownership
* It is only a hint, we use barrier() only.
*/
Annotation
- Immediate include surface: `linux/bitops.h`, `asm/bug.h`.
- Detected declarations: `struct dql`, `function dql_queue_stall`, `function time`, `function dql_queued`, `function dql_avail`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.