cregit-Linux how code gets into the kernel

Release 4.15 include/linux/cpuset.h

Directory: include/linux
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _LINUX_CPUSET_H

#define _LINUX_CPUSET_H
/*
 *  cpuset interface
 *
 *  Copyright (C) 2003 BULL SA
 *  Copyright (C) 2004-2006 Silicon Graphics, Inc.
 *
 */

#include <linux/sched.h>
#include <linux/sched/topology.h>
#include <linux/sched/task.h>
#include <linux/cpumask.h>
#include <linux/nodemask.h>
#include <linux/mm.h>
#include <linux/jump_label.h>

#ifdef CONFIG_CPUSETS

/*
 * Static branch rewrites can happen in an arbitrary order for a given
 * key. In code paths where we need to loop with read_mems_allowed_begin() and
 * read_mems_allowed_retry() to get a consistent view of mems_allowed, we need
 * to ensure that begin() always gets rewritten before retry() in the
 * disabled -> enabled transition. If not, then if local irqs are disabled
 * around the loop, we can deadlock since retry() would always be
 * comparing the latest value of the mems_allowed seqcount against 0 as
 * begin() still would see cpusets_enabled() as false. The enabled -> disabled
 * transition should happen in reverse order for the same reasons (want to stop
 * looking at real value of mems_allowed.sequence in retry() first).
 */
extern struct static_key_false cpusets_pre_enable_key;
extern struct static_key_false cpusets_enabled_key;

static inline bool cpusets_enabled(void) { return static_branch_unlikely(&cpusets_enabled_key); }

Contributors

PersonTokensPropCommitsCommitProp
Mel Gorman1593.75%150.00%
Vlastimil Babka16.25%150.00%
Total16100.00%2100.00%


static inline void cpuset_inc(void) { static_branch_inc(&cpusets_pre_enable_key); static_branch_inc(&cpusets_enabled_key); }

Contributors

PersonTokensPropCommitsCommitProp
Mel Gorman1466.67%133.33%
Dima Zavin628.57%133.33%
Vlastimil Babka14.76%133.33%
Total21100.00%3100.00%


static inline void cpuset_dec(void) { static_branch_dec(&cpusets_enabled_key); static_branch_dec(&cpusets_pre_enable_key); }

Contributors

PersonTokensPropCommitsCommitProp
Mel Gorman1466.67%133.33%
Dima Zavin628.57%133.33%
Vlastimil Babka14.76%133.33%
Total21100.00%3100.00%

extern int cpuset_init(void); extern void cpuset_init_smp(void); extern void cpuset_force_rebuild(void); extern void cpuset_update_active_cpus(void); extern void cpuset_wait_for_hotplug(void); extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask); extern void cpuset_cpus_allowed_fallback(struct task_struct *p); extern nodemask_t cpuset_mems_allowed(struct task_struct *p); #define cpuset_current_mems_allowed (current->mems_allowed) void cpuset_init_current_mems_allowed(void); int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask); extern bool __cpuset_node_allowed(int node, gfp_t gfp_mask);
static inline bool cpuset_node_allowed(int node, gfp_t gfp_mask) { if (cpusets_enabled()) return __cpuset_node_allowed(node, gfp_mask); return true; }

Contributors

PersonTokensPropCommitsCommitProp
David Rientjes1551.72%120.00%
Vlastimil Babka931.03%120.00%
Vladimir Davydov26.90%120.00%
Paul Jackson26.90%120.00%
Mel Gorman13.45%120.00%
Total29100.00%5100.00%


static inline bool __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) { return __cpuset_node_allowed(zone_to_nid(z), gfp_mask); }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson1973.08%133.33%
David Rientjes415.38%133.33%
Vlastimil Babka311.54%133.33%
Total26100.00%3100.00%


static inline bool cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) { if (cpusets_enabled()) return __cpuset_zone_allowed(z, gfp_mask); return true; }

Contributors

PersonTokensPropCommitsCommitProp
Vlastimil Babka31100.00%1100.00%
Total31100.00%1100.00%

extern int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, const struct task_struct *tsk2); #define cpuset_memory_pressure_bump() \ do { \ if (cpuset_memory_pressure_enabled) \ __cpuset_memory_pressure_bump(); \ } while (0) extern int cpuset_memory_pressure_enabled; extern void __cpuset_memory_pressure_bump(void); 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); extern int cpuset_slab_spread_node(void);
static inline int cpuset_do_page_mem_spread(void) { return task_spread_page(current); }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson1280.00%150.00%
Li Zefan320.00%150.00%
Total15100.00%2100.00%


static inline int cpuset_do_slab_mem_spread(void) { return task_spread_slab(current); }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson1280.00%150.00%
Li Zefan320.00%150.00%
Total15100.00%2100.00%

extern int current_cpuset_is_being_rebound(void); extern void rebuild_sched_domains(void); extern void cpuset_print_current_mems_allowed(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(&current->mems_allowed_seq); }

Contributors

PersonTokensPropCommitsCommitProp
Mel Gorman1754.84%360.00%
Miao Xie929.03%120.00%
Dima Zavin516.13%120.00%
Total31100.00%5100.00%

/* * 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(&current->mems_allowed_seq, seq); }

Contributors

PersonTokensPropCommitsCommitProp
Mel Gorman1955.88%360.00%
Miao Xie1029.41%120.00%
Dima Zavin514.71%120.00%
Total34100.00%5100.00%


static inline void set_mems_allowed(nodemask_t nodemask) { unsigned long flags; task_lock(current); local_irq_save(flags); write_seqcount_begin(&current->mems_allowed_seq); current->mems_allowed = nodemask; write_seqcount_end(&current->mems_allowed_seq); local_irq_restore(flags); task_unlock(current); }

Contributors

PersonTokensPropCommitsCommitProp
Miao Xie2035.71%240.00%
Mel Gorman1628.57%120.00%
John Stultz1425.00%120.00%
Paul Jackson610.71%120.00%
Total56100.00%5100.00%

#else /* !CONFIG_CPUSETS */
static inline bool cpusets_enabled(void) { return false; }

Contributors

PersonTokensPropCommitsCommitProp
Mel Gorman12100.00%1100.00%
Total12100.00%1100.00%


static inline int cpuset_init(void) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson12100.00%1100.00%
Total12100.00%1100.00%


static inline void cpuset_init_smp(void) {}

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson8100.00%1100.00%
Total8100.00%1100.00%


static inline void cpuset_force_rebuild(void) { }

Contributors

PersonTokensPropCommitsCommitProp
Peter Zijlstra8100.00%1100.00%
Total8100.00%1100.00%


static inline void cpuset_update_active_cpus(void) { partition_sched_domains(1, NULL, NULL); }

Contributors

PersonTokensPropCommitsCommitProp
Tejun Heo1794.44%150.00%
Rakib Mullick15.56%150.00%
Total18100.00%2100.00%


static inline void cpuset_wait_for_hotplug(void) { }

Contributors

PersonTokensPropCommitsCommitProp
Peter Zijlstra8100.00%1100.00%
Total8100.00%1100.00%


static inline void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask) { cpumask_copy(mask, cpu_possible_mask); }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson1145.83%125.00%
Mike Travis625.00%125.00%
Rusty Russell520.83%125.00%
Li Zefan28.33%125.00%
Total24100.00%4100.00%


static inline void cpuset_cpus_allowed_fallback(struct task_struct *p) { }

Contributors

PersonTokensPropCommitsCommitProp
Oleg Nesterov981.82%150.00%
Peter Zijlstra218.18%150.00%
Total11100.00%2100.00%


static inline nodemask_t cpuset_mems_allowed(struct task_struct *p) { return node_possible_map; }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson15100.00%1100.00%
Total15100.00%1100.00%

#define cpuset_current_mems_allowed (node_states[N_MEMORY])
static inline void cpuset_init_current_mems_allowed(void) {}

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson8100.00%1100.00%
Total8100.00%1100.00%


static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask) { return 1; }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson1178.57%150.00%
Mel Gorman321.43%150.00%
Total14100.00%2100.00%


static inline bool cpuset_node_allowed(int node, gfp_t gfp_mask) { return true; }

Contributors

PersonTokensPropCommitsCommitProp
David Rientjes1168.75%133.33%
Vlastimil Babka425.00%133.33%
Vladimir Davydov16.25%133.33%
Total16100.00%3100.00%


static inline bool __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) { return true; }

Contributors

PersonTokensPropCommitsCommitProp
Vlastimil Babka1688.89%150.00%
David Rientjes211.11%150.00%
Total18100.00%2100.00%


static inline bool cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) { return true; }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson1477.78%240.00%
Vlastimil Babka211.11%120.00%
Al Viro15.56%120.00%
Vladimir Davydov15.56%120.00%
Total18100.00%5100.00%


static inline int cpuset_mems_allowed_intersects(const struct task_struct *tsk1, const struct task_struct *tsk2) { return 1; }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson1463.64%150.00%
David Rientjes836.36%150.00%
Total22100.00%2100.00%


static inline void cpuset_memory_pressure_bump(void) {}

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson8100.00%1100.00%
Total8100.00%1100.00%


static inline void cpuset_task_status_allowed(struct seq_file *m, struct task_struct *task) { }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson956.25%150.00%
Eric W. Biedermann743.75%150.00%
Total16100.00%2100.00%


static inline int cpuset_mem_spread_node(void) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson12100.00%1100.00%
Total12100.00%1100.00%


static inline int cpuset_slab_spread_node(void) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Jack Steiner12100.00%1100.00%
Total12100.00%1100.00%


static inline int cpuset_do_page_mem_spread(void) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson12100.00%1100.00%
Total12100.00%1100.00%


static inline int cpuset_do_slab_mem_spread(void) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson12100.00%1100.00%
Total12100.00%1100.00%


static inline int current_cpuset_is_being_rebound(void) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Paul Menage12100.00%1100.00%
Total12100.00%1100.00%


static inline void rebuild_sched_domains(void) { partition_sched_domains(1, NULL, NULL); }

Contributors

PersonTokensPropCommitsCommitProp
Maksim Krasnyanskiy18100.00%2100.00%
Total18100.00%2100.00%


static inline void cpuset_print_current_mems_allowed(void) { }

Contributors

PersonTokensPropCommitsCommitProp
David Rientjes8100.00%2100.00%
Total8100.00%2100.00%


static inline void set_mems_allowed(nodemask_t nodemask) { }

Contributors

PersonTokensPropCommitsCommitProp
Miao Xie9100.00%1100.00%
Total9100.00%1100.00%


static inline unsigned int read_mems_allowed_begin(void) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Mel Gorman861.54%266.67%
Miao Xie538.46%133.33%
Total13100.00%3100.00%


static inline bool read_mems_allowed_retry(unsigned int seq) { return false; }

Contributors

PersonTokensPropCommitsCommitProp
Mel Gorman1071.43%266.67%
Miao Xie428.57%133.33%
Total14100.00%3100.00%

#endif /* !CONFIG_CPUSETS */ #endif /* _LINUX_CPUSET_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
Paul Jackson32435.26%1123.40%
Mel Gorman13915.13%510.64%
Vlastimil Babka707.62%12.13%
David Rientjes667.18%48.51%
Miao Xie606.53%24.26%
Peter Zijlstra333.59%24.26%
Dima Zavin283.05%12.13%
Maksim Krasnyanskiy252.72%24.26%
Li Zefan242.61%36.38%
Tejun Heo232.50%12.13%
Paul Menage202.18%12.13%
Jack Steiner192.07%12.13%
Oleg Nesterov181.96%12.13%
John Stultz141.52%12.13%
Al Viro131.41%24.26%
Eric W. Biedermann131.41%12.13%
Mike Travis101.09%12.13%
Ingo Molnar60.65%24.26%
Vladimir Davydov50.54%12.13%
Rusty Russell50.54%12.13%
Rakib Mullick20.22%12.13%
Lai Jiangshan10.11%12.13%
Greg Kroah-Hartman10.11%12.13%
Total919100.00%47100.00%
Directory: include/linux
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.