include/linux/cpuset.h
Source file repositories/reference/linux-study-clean/include/linux/cpuset.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/cpuset.h- Extension
.h- Size
- 8684 bytes
- Lines
- 309
- 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/sched.hlinux/sched/topology.hlinux/sched/task.hlinux/cpumask.hlinux/nodemask.hlinux/mm.hlinux/mmu_context.hlinux/jump_label.h
Detected Declarations
function cpusets_enabledfunction cpuset_incfunction cpuset_decfunction allocationsfunction __cpuset_zone_allowedfunction cpuset_zone_allowedfunction cpuset_memory_pressure_bumpfunction cpuset_do_page_mem_spreadfunction read_mems_allowed_beginfunction read_mems_allowed_retryfunction set_mems_allowedfunction cpusets_enabledfunction cpusets_insane_configfunction cpuset_initfunction cpuset_init_smpfunction inc_dl_tasks_csfunction cpuset_cpus_allowedfunction cpuset_cpus_allowed_fallbackfunction cpuset_mems_allowedfunction cpuset_init_current_mems_allowedfunction __cpuset_zone_allowedfunction cpuset_zone_allowedfunction cpuset_mems_allowed_intersectsfunction cpuset_memory_pressure_bumpfunction cpuset_do_page_mem_spreadfunction current_cpuset_is_being_reboundfunction dl_rebuild_rd_accountingfunction cpuset_reset_sched_domainsfunction cpuset_print_current_mems_allowedfunction read_mems_allowed_retryfunction cpuset_nodes_allowed
Annotated Snippet
static inline void cpuset_memory_pressure_bump(void) { }
#endif
extern void cpuset_task_status_allowed(struct seq_file *m,
struct task_struct *task);
extern int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *tsk);
extern int cpuset_mem_spread_node(void);
static inline int cpuset_do_page_mem_spread(void)
{
return task_spread_page(current);
}
extern bool current_cpuset_is_being_rebound(void);
extern void dl_rebuild_rd_accounting(void);
extern void rebuild_sched_domains(void);
extern void cpuset_print_current_mems_allowed(void);
extern void cpuset_reset_sched_domains(void);
/*
* read_mems_allowed_begin is required when making decisions involving
* mems_allowed such as during page allocation. mems_allowed can be updated in
* parallel and depending on the new value an operation can fail potentially
* causing process failure. A retry loop with read_mems_allowed_begin and
* read_mems_allowed_retry prevents these artificial failures.
*/
static inline unsigned int read_mems_allowed_begin(void)
{
if (!static_branch_unlikely(&cpusets_pre_enable_key))
return 0;
return read_seqcount_begin(¤t->mems_allowed_seq);
}
/*
* If this returns true, the operation that took place after
* read_mems_allowed_begin may have failed artificially due to a concurrent
* update of mems_allowed. It is up to the caller to retry the operation if
* appropriate.
*/
static inline bool read_mems_allowed_retry(unsigned int seq)
{
if (!static_branch_unlikely(&cpusets_enabled_key))
return false;
return read_seqcount_retry(¤t->mems_allowed_seq, seq);
}
static inline void set_mems_allowed(nodemask_t nodemask)
{
unsigned long flags;
task_lock(current);
local_irq_save(flags);
write_seqcount_begin(¤t->mems_allowed_seq);
current->mems_allowed = nodemask;
write_seqcount_end(¤t->mems_allowed_seq);
local_irq_restore(flags);
task_unlock(current);
}
extern void cpuset_nodes_allowed(struct cgroup *cgroup, nodemask_t *mask);
#else /* !CONFIG_CPUSETS */
static inline bool cpusets_enabled(void) { return false; }
static inline bool cpusets_insane_config(void) { return false; }
static inline int cpuset_init(void) { return 0; }
static inline void cpuset_init_smp(void) {}
static inline void cpuset_force_rebuild(void) { }
static inline void cpuset_update_active_cpus(void)
{
partition_sched_domains(1, NULL, NULL);
}
static inline void inc_dl_tasks_cs(struct task_struct *task) { }
static inline void dec_dl_tasks_cs(struct task_struct *task) { }
static inline void cpuset_lock(void) { }
static inline void cpuset_unlock(void) { }
static inline void lockdep_assert_cpuset_lock_held(void) { }
static inline void cpuset_cpus_allowed_locked(struct task_struct *p,
struct cpumask *mask)
Annotation
- Immediate include surface: `linux/sched.h`, `linux/sched/topology.h`, `linux/sched/task.h`, `linux/cpumask.h`, `linux/nodemask.h`, `linux/mm.h`, `linux/mmu_context.h`, `linux/jump_label.h`.
- Detected declarations: `function cpusets_enabled`, `function cpuset_inc`, `function cpuset_dec`, `function allocations`, `function __cpuset_zone_allowed`, `function cpuset_zone_allowed`, `function cpuset_memory_pressure_bump`, `function cpuset_do_page_mem_spread`, `function read_mems_allowed_begin`, `function read_mems_allowed_retry`.
- 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.