tools/testing/radix-tree/regression4.c
Source file repositories/reference/linux-study-clean/tools/testing/radix-tree/regression4.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/radix-tree/regression4.c- Extension
.c- Size
- 1521 bytes
- Lines
- 80
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
Dependency Surface
linux/kernel.hlinux/gfp.hlinux/slab.hlinux/radix-tree.hlinux/rcupdate.hstdlib.hpthread.hstdio.hassert.hregression.h
Detected Declarations
function regression4_test
Annotated Snippet
if (entry != &obj0) {
printf("iteration %d bad entry = %p\n", i, entry);
abort();
}
}
rcu_unregister_thread();
return NULL;
}
static void *writer_fn(void *arg)
{
int i;
rcu_register_thread();
pthread_barrier_wait(&worker_barrier);
for (i = 0; i < 1000000; i++) {
radix_tree_insert(&mt_tree, 1, &obj1);
radix_tree_delete(&mt_tree, 1);
}
rcu_unregister_thread();
return NULL;
}
void regression4_test(void)
{
pthread_t reader, writer;
printv(1, "regression test 4 starting\n");
radix_tree_insert(&mt_tree, 0, &obj0);
pthread_barrier_init(&worker_barrier, NULL, 2);
if (pthread_create(&reader, NULL, reader_fn, NULL) ||
pthread_create(&writer, NULL, writer_fn, NULL)) {
perror("pthread_create");
exit(1);
}
if (pthread_join(reader, NULL) || pthread_join(writer, NULL)) {
perror("pthread_join");
exit(1);
}
printv(1, "regression test 4 passed\n");
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/gfp.h`, `linux/slab.h`, `linux/radix-tree.h`, `linux/rcupdate.h`, `stdlib.h`, `pthread.h`, `stdio.h`.
- Detected declarations: `function regression4_test`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.