8 contexto de processo (chamada de sistema)
11 NOTA: work da wq executa em uma kthread e pode fazer copy_to_user e
12 copy_from_user, segundo esse comentário em kernel/kmod.c:
14 * Normally it is bogus to call wait4() from in-kernel because
15 * wait4() wants to write the exit code to a userspace address.
16 * But wait_for_helper() always runs as keventd, and put_user()
17 * to a kernel address works OK for kernel threads, due to their
18 * having an mm_segment_t which spans the entire address space.
20 * Thus the __user pointer cast is valid here.
42 scalable SMP: that's what's important (for most people, anyway)
44 Bottom Half: after handling interrupts, Linux executes the bottom half
46 Bottom Halves were "single-threaded": only one bottom half could
47 execute at a time (only one or only one NET_BH?).
48 UPDATE: only one. tasklets allow a single tasklet to run
49 on only one CPU at a time. But other tasklets may run on
51 Bottom Half now is softirq and tasklet (which is a softirq
54 Disables interrupts in the local CPU
55 Why? Explanation: CPU 1 grabs spinlock, CPU 1 is interrupted and
56 handler grabs same spinlock: spins forever (code will not
57 migrate? TODO). Second scenario: CPU 2 is interrupted and
58 grabs the same lock, CPU 1 has the chance to release the
59 lock and CPU 2 will go on.
61 If used only in process context and BHs
62 local_irq_disable() or local_irq_save(flags)
63 It's enough when data is per-CPU. That is, there will not be
64 concurrency between CPUs, but only between interrupt handler
66 CPU affinity: softirq runs on the same CPU it was raised on.
75 preempt_disable - disable preemption in current CPU TODO: check "current"
76 preempt_enable - enable preemption in current CPU
83 smp_processor_id() retorna ID do processador corrente: só pode ser utilizado se
84 a tarefa estiver amarrada a um processador ou em um contexto não
85 preemptível (preempt off)
86 get_cpu - desabilita preempção e retorna ID da CPU
87 put_cpu - reabilita preempção
91 "I'll Do It Later: Softirqs, Tasklets, Bottom Halves, Task Queues, Work Queues
92 and Timers" by Matthew Wilcox