Demo entry 6770107

cpp

   

Submitted by czn on Nov 11, 2018 at 17:34
Language: C++. Code size: 839 Bytes.

static void tasklet_action(struct softirq_action *a)
{
	struct tasklet_struct *list;

	local_irq_disable(); 
		list = __this_cpu_read(tasklet_vec.head);
	__this_cpu_write(tasklet_vec.head, NULL);
	__this_cpu_write(tasklet_vec.tail, this_cpu_ptr(&tasklet_vec.head));
	local_irq_enable();

	while (list) {
		struct tasklet_struct *t = list;

		list = list->next;

		if (tasklet_trylock(t)) {
				if (!atomic_read(&t->count)) {
						if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
							BUG();
					t->func(t->data);
					tasklet_unlock(t);
					continue; 
				}
			tasklet_unlock(t); 
		}

		local_irq_disable(); 
			t->next = NULL;
		*__this_cpu_read(tasklet_vec.tail) = t;
		__this_cpu_write(tasklet_vec.tail, &(t->next));
		__raise_softirq_irqoff(TASKLET_SOFTIRQ);
			local_irq_enable();
	}
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).