23 #include <linux/version.h> 32 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_LIB 69 if (current->journal_info ==
NULL) {
74 return current->journal_info;
124 current->journal_info = &
t->
t_tls;
139 current->journal_info =
NULL;
140 set_current_state(TASK_INTERRUPTIBLE);
141 while (!kthread_should_stop()) {
143 set_current_state(TASK_INTERRUPTIBLE);
145 set_current_state(TASK_RUNNING);
153 struct task_struct *task;
159 result = PTR_ERR(
q->t_h.h_tsk);
163 q->t_h.h_pid = task->pid;
164 wake_up_process(task);
174 M0_PRE(
q->t_h.h_tsk != current);
177 if (
q->t_init ==
NULL)
185 result = kthread_stop(
q->t_h.h_tsk);
202 size_t nr_bits =
min64u(processors->
b_nr, nr_cpu_ids);
203 cpumask_var_t cpuset;
204 struct task_struct *
p =
q->t_h.h_tsk;
207 if (!zalloc_cpumask_var(&cpuset, GFP_KERNEL))
210 for (idx = 0; idx < nr_bits; ++idx)
212 cpumask_set_cpu(idx, cpuset);
213 nr_allowed = cpumask_weight(cpuset);
215 if (nr_allowed == 0) {
230 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,18,0) || defined (CONFIG_AARCH64) 231 cpumask_copy(&
p->cpus_allowed, cpuset);
233 cpumask_copy(&
p->cpus_mask, cpuset);
235 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) 236 p->rt.nr_cpus_allowed = nr_allowed;
238 p->nr_cpus_allowed = nr_allowed;
242 if (
p == current && !cpumask_test_cpu(task_cpu(
p), cpuset))
243 schedule_timeout_uninterruptible(1);
245 free_cpumask_var(cpuset);
287 current->journal_info =
tls;
327 current->journal_info = prev;
331 #undef M0_TRACE_SUBSYSTEM M0_INTERNAL void m0_enter_awkward(void)
M0_INTERNAL uint64_t m0_process(void)
static struct m0_addb2_philter p
M0_INTERNAL void m0_thread_tls_back(struct m0_thread_tls *tls)
M0_INTERNAL int m0_thread_init_impl(struct m0_thread *q, const char *name)
static struct m0_semaphore q
M0_INTERNAL int m0_thread_confine(struct m0_thread *q, const struct m0_bitmap *processors)
int m0_thread_join(struct m0_thread *q)
M0_INTERNAL void m0_threads_fini(void)
#define M0_LOG(level,...)
M0_INTERNAL void m0_set(struct m0 *instance)
struct task_struct * h_tsk
struct m0_thread_tls t_tls
struct m0_semaphore t_wait
M0_INTERNAL void m0_thread_leave(void)
M0_INTERNAL struct m0_thread_tls * m0_thread_tls(void)
struct m0_thread_arch_tls tls_arch
static int kthread_trampoline(void *arg)
return M0_ERR(-EOPNOTSUPP)
M0_INTERNAL void m0_addb2_global_thread_leave(void)
static struct m0 * __instance
M0_INTERNAL int m0_thread_signal(struct m0_thread *q, int sig)
M0_INTERNAL void * m0_thread_trampoline(void *arg)
static struct m0_thread t[8]
M0_INTERNAL void m0_thread_enter(struct m0_thread *thread, bool full)
M0_INTERNAL void m0_addb2_global_thread_enter(void)
M0_INTERNAL struct m0_thread_tls * m0_thread_tls_pop(void)
M0_INTERNAL void m0_threads_once_fini(void)
M0_INTERNAL bool m0_is_awkward(void)
static __thread struct m0_thread_tls * tls
static uint64_t min64u(uint64_t a, uint64_t b)
M0_INTERNAL bool m0_bitmap_get(const struct m0_bitmap *map, size_t idx)
M0_INTERNAL int m0_threads_once_init(void)
static struct m0 instance
struct m0_thread * tls_self
struct m0_thread_handle t_h
M0_INTERNAL void m0_exit_awkward(void)
M0_INTERNAL void m0_semaphore_down(struct m0_semaphore *semaphore)
M0_INTERNAL uint64_t m0_pid(void)
M0_INTERNAL void m0_semaphore_up(struct m0_semaphore *semaphore)
M0_INTERNAL int m0_threads_init(struct m0 *instance)
M0_INTERNAL int m0_thread_arch_adopt(struct m0_thread *thread, struct m0 *instance, bool full)
M0_INTERNAL void m0_thread__cleanup(struct m0_thread *bye)
static void tls_fini(struct m0_thread_tls *tls)
M0_INTERNAL void m0_thread_arch_shun(void)