Lines Matching +full:timer +full:- +full:cannot +full:- +full:wake +full:- +full:cpu

1 // SPDX-License-Identifier: GPL-2.0-only
7 * Rewritten. Old one was good in 2.2, but in 2.3 it was immoral. --ANK (990903)
20 #include <linux/cpu.h>
38 - No shared variables, all the data are CPU local.
39 - If a softirq needs serialization, let it serialize itself
41 - Even if softirq is serialized, only local cpu is marked for
42 execution. Hence, we get something sort of weak cpu binding.
47 - NET RX softirq. It is multithreaded and does not require
49 - NET TX softirq. It kicks software netdevice queues, hence
52 - Tasklets: serialized wrt itself.
65 "HI", "TIMER", "NET_TX", "NET_RX", "BLOCK", "IRQ_POLL",
70 * we cannot loop indefinitely here to avoid userspace starvation,
95 * to a per CPU counter and to task::softirqs_disabled_cnt.
97 * - count is changed by SOFTIRQ_OFFSET on entering or leaving softirq
100 * - count is changed by SOFTIRQ_DISABLE_OFFSET (= 2 * SOFTIRQ_OFFSET)
110 * also in per CPU softirq_ctrl::cnt. This is necessary to allow tasks in a
117 * The per CPU counter prevents pointless wakeups of ksoftirqd in case that
142 * local_bh_blocked() - Check for idle whether BH processing is blocked
144 * Returns false if the per CPU softirq::cnt is 0 otherwise true.
148 * softirq_ctrl::lock was the only running task on the CPU and blocks on
166 if (!current->softirq_disable_cnt) {
177 * Track the per CPU softirq disabled state. On RT this is per CPU
185 current->softirq_disable_cnt = newcnt;
200 DEBUG_LOCKS_WARN_ON(current->softirq_disable_cnt !=
210 current->softirq_disable_cnt = newcnt;
245 * If this was called from non preemptible context, wake up the
269 * to acquire the per CPU local lock for reentrancy protection.
324 * This one is for softirq.c-internal use, where hardirqs are disabled
338 * is set and before current->softirq_enabled is cleared.
352 current->preempt_disable_ip = get_lock_parent_ip();
374 * Special-case - softirqs can safely be enabled by __do_softirq(),
375 * without processing still-pending softirqs:
400 __preempt_count_sub(cnt - 1);
496 * The two things to balance is latency against fairness -
507 * not miss-qualify lock contexts and miss possible deadlocks.
539 unsigned long old_flags = current->flags;
551 current->flags &= ~PF_MEMALLOC;
571 h += softirq_bit - 1;
573 vec_nr = h - softirq_vec;
579 h->action();
583 vec_nr, softirq_to_name[vec_nr], h->action,
599 --max_restart)
617 * irq_enter_rcu - Enter an interrupt context with RCU watching
631 * irq_enter - Enter an interrupt context including RCU update
642 int cpu = smp_processor_id();
644 /* Make sure that timer wheel updates are propagated */
645 if ((sched_core_idle_cpu(cpu) && !need_resched()) || tick_nohz_full_cpu(cpu)) {
690 * irq_exit_rcu() - Exit an interrupt context without updating RCU
702 * irq_exit - Exit an interrupt context, update RCU and lockdep
723 * (this also catches softirq-disabled code). We will
727 * Otherwise we wake up ksoftirqd to make sure we
775 t->next = NULL;
776 *head->tail = t;
777 head->tail = &(t->next);
798 if (test_and_clear_wake_up_bit(TASKLET_STATE_SCHED, &t->state))
802 t->use_callback ? "callback" : "func",
803 t->use_callback ? (void *)t->callback : (void *)t->func);
814 list = tl_head->head;
815 tl_head->head = NULL;
816 tl_head->tail = &tl_head->head;
822 list = list->next;
825 if (!atomic_read(&t->count)) {
827 if (t->use_callback) {
828 trace_tasklet_entry(t, t->callback);
829 t->callback(t);
830 trace_tasklet_exit(t, t->callback);
832 trace_tasklet_entry(t, t->func);
833 t->func(t->data);
834 trace_tasklet_exit(t, t->func);
844 t->next = NULL;
845 *tl_head->tail = t;
846 tl_head->tail = &t->next;
867 t->next = NULL;
868 t->state = 0;
869 atomic_set(&t->count, 0);
870 t->callback = callback;
871 t->use_callback = true;
872 t->data = 0;
879 t->next = NULL;
880 t->state = 0;
881 atomic_set(&t->count, 0);
882 t->func = func;
883 t->use_callback = false;
884 t->data = data;
895 while (test_bit(TASKLET_STATE_RUN, &(t)->state)) {
900 * running. If the tasklet runs on a different CPU
919 wait_on_bit_lock(&t->state, TASKLET_STATE_SCHED, TASK_UNINTERRUPTIBLE);
929 clear_and_wake_up_bit(TASKLET_STATE_RUN, &t->state);
935 wait_on_bit(&t->state, TASKLET_STATE_RUN, TASK_UNINTERRUPTIBLE);
942 int cpu;
944 for_each_possible_cpu(cpu) {
945 per_cpu(tasklet_vec, cpu).tail =
946 &per_cpu(tasklet_vec, cpu).head;
947 per_cpu(tasklet_hi_vec, cpu).tail =
948 &per_cpu(tasklet_hi_vec, cpu).head;
955 static int ksoftirqd_should_run(unsigned int cpu)
960 static void run_ksoftirqd(unsigned int cpu)
977 static int takeover_tasklets(unsigned int cpu)
979 workqueue_softirq_dead(cpu);
981 /* CPU is dead, so no lock needed. */
984 /* Find end, append list for that CPU. */
985 if (&per_cpu(tasklet_vec, cpu).head != per_cpu(tasklet_vec, cpu).tail) {
986 *__this_cpu_read(tasklet_vec.tail) = per_cpu(tasklet_vec, cpu).head;
987 __this_cpu_write(tasklet_vec.tail, per_cpu(tasklet_vec, cpu).tail);
988 per_cpu(tasklet_vec, cpu).head = NULL;
989 per_cpu(tasklet_vec, cpu).tail = &per_cpu(tasklet_vec, cpu).head;
993 if (&per_cpu(tasklet_hi_vec, cpu).head != per_cpu(tasklet_hi_vec, cpu).tail) {
994 *__this_cpu_read(tasklet_hi_vec.tail) = per_cpu(tasklet_hi_vec, cpu).head;
995 __this_cpu_write(tasklet_hi_vec.tail, per_cpu(tasklet_hi_vec, cpu).tail);
996 per_cpu(tasklet_hi_vec, cpu).head = NULL;
997 per_cpu(tasklet_hi_vec, cpu).tail = &per_cpu(tasklet_hi_vec, cpu).head;
1016 static void ktimerd_setup(unsigned int cpu)
1022 static int ktimerd_should_run(unsigned int cpu)
1033 static void run_ktimerd(unsigned int cpu)