For Kernel_Newbies By a Kernel_Newbie
- |
- softirq->yes->handle_softirq->ret_from_intr->(mode ==
USER_MODE) ? ret_with_reschedule:RESTORE_ALL
- |no
- signal_pending->yes->signal_return->do_signal->restore_all->RESTORE_ALL
- |no
- ret_with_reschedule:need_resched->yes->reschedule->schedule->ret_from_sys_call
- |no
- restore_all->RESTORE_ALL
Task Queues and Bottom Halves :
Task_Queues are extended bottom halves which define functions to be either
called at specific points by using pre-defined task_queues
(tq_immediate,tq_timer,tq_disk.I dont see tq_scheduler in my 2.4s
include/tqueue.h file, where as its there in 2.2.x. and sched.c in my 2.4 source
doesnt call run_task_queue(&tq_scheduler). To understand task_queues you
should first understand bottom_halves or tasklets,and to understand them you
should have a look at linux/softirq.c. Its judicial and advisable to split the
job of the interrupt handler into 2 halves. While the interrupt handler runs by
disabling the interrupt occured,it should be fast in processing the interrupt.
Any processing of data or other stuffs can be taken up by a bottom half. For
example an interrupt handler can fetch the data,and mark up a task to be
executed at known points. What are these known points and when are they
processed ? Bottom halves are consumed in 2 places. In the ret_from_sys_call or
ret_from_exception or in schedule(), by calling do_softirq (defined
linux/kernel/softirq.c). The do_softirq goes through the list of active_softirq
(which is a bitmask of softirq_active(cpu).(check include/linux/interrupt.h,and
follow up the headers in that file.) It goes through each softirq_action
structure and calls the function registered. The tasklets
TASKLET_SOFTIRQ,HI_SOFTIRQ ,each having an instance of tasklet_struct,queue
themselves by calling either tasklet_schedule or tasklet_hi_schedule. The latter
being used by mark_bh routine which is retained for backwards compatibility. The
softirqs are initialised at system startup by calling softirq_init,which opens
up the softirqs TASKLET_SOFTIRQ and HI_SOFTIRQ. The older versions of
bottom_half,are also initialised. If one queues up tasklets by calling
tasklet_schedule, they will be consumed by calling tasklet_action defined in
softirq.c. The older ones using mark_bh are consumed by calling
- « first
- ‹ previous
- of 24
- next ›
- last »