tools/perf/check-header_ignore_hunks/lib/list_sort.c
Source file repositories/reference/linux-study-clean/tools/perf/check-header_ignore_hunks/lib/list_sort.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/check-header_ignore_hunks/lib/list_sort.c- Extension
.c- Size
- 681 bytes
- Lines
- 25
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
@@ -50,6 +50,7 @@
struct list_head *a, struct list_head *b)
{
struct list_head *tail = head;
+ u8 count = 0;
for (;;) {
/* if equal, take 'a' -- important for sort stability */
@@ -75,6 +76,15 @@
/* Finish linking remainder of list b on to tail */
tail->next = b;
do {
+ /*
+ * If the merge is highly unbalanced (e.g. the input is
+ * already sorted), this loop may run many iterations.
+ * Continue callbacks to the client even though no
+ * element comparison is needed, so the client's cmp()
+ * routine can invoke cond_resched() periodically.
+ */
+ if (unlikely(!++count))
+ cmp(priv, b, b);
b->prev = tail;
tail = b;
b = b->next;
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- 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.