io_uring/tw.h
Source file repositories/reference/linux-study-clean/io_uring/tw.h
File Facts
- System
- Linux kernel
- Corpus path
io_uring/tw.h- Extension
.h- Size
- 3289 bytes
- Lines
- 118
- Domain
- Kernel Services
- Bucket
- io_uring
- Inferred role
- Kernel Services: implementation source
- Status
- source implementation candidate
Why This File Exists
Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Shared kernel service surface used by multiple subsystems, including helpers, cryptography, virtualization support, and async I/O infrastructure.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sched.hlinux/percpu-refcount.hlinux/io_uring_types.hmpscq.h
Detected Declarations
function io_should_terminate_twfunction __io_req_task_work_addfunction io_req_task_work_addfunction io_run_task_workfunction io_local_work_pendingfunction io_task_work_pendingfunction io_tw_lockfunction io_allowed_defer_tw_runfunction io_allowed_run_tw
Annotated Snippet
if (test_thread_flag(TIF_NOTIFY_RESUME)) {
__set_current_state(TASK_RUNNING);
resume_user_mode_work(NULL);
}
if (current->io_uring) {
unsigned int count = 0;
__set_current_state(TASK_RUNNING);
tctx_task_work_run(current->io_uring, UINT_MAX, &count);
if (count)
ret = true;
}
}
if (task_work_pending(current)) {
__set_current_state(TASK_RUNNING);
task_work_run();
ret = true;
}
return ret;
}
static inline bool io_local_work_pending(struct io_ring_ctx *ctx)
{
return !mpscq_empty(&ctx->work_list);
}
static inline bool io_task_work_pending(struct io_ring_ctx *ctx)
{
return task_work_pending(current) || io_local_work_pending(ctx);
}
static inline void io_tw_lock(struct io_ring_ctx *ctx, io_tw_token_t tw)
{
lockdep_assert_held(&ctx->uring_lock);
}
static inline bool io_allowed_defer_tw_run(struct io_ring_ctx *ctx)
{
return likely(ctx->submitter_task == current);
}
static inline bool io_allowed_run_tw(struct io_ring_ctx *ctx)
{
return likely(!(ctx->flags & IORING_SETUP_DEFER_TASKRUN) ||
ctx->submitter_task == current);
}
#endif
Annotation
- Immediate include surface: `linux/sched.h`, `linux/percpu-refcount.h`, `linux/io_uring_types.h`, `mpscq.h`.
- Detected declarations: `function io_should_terminate_tw`, `function __io_req_task_work_add`, `function io_req_task_work_add`, `function io_run_task_work`, `function io_local_work_pending`, `function io_task_work_pending`, `function io_tw_lock`, `function io_allowed_defer_tw_run`, `function io_allowed_run_tw`.
- Atlas domain: Kernel Services / io_uring.
- 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.