Tasklet APIs

There are a number of APIs that are defined for Tasklet operation in the Linux kernel. The below table provides a list of Tasklet APIs with a brief description of the APIs. For a more comprehensive list – refer /linux/interrupt.h file in the Linux kernel

Tasklet APIDescription
tasklet_initInitialize the tasklet. Used in dynamic initialization of tasklet
tasklet_killKill the tasklet instance
tasklet_scheduleSchedule the tasklet
tasklet_enableEnable the tasklet. This function is used after tasklet_disable or if the tasklet is created with DECLARE_TASKLET_DISABLED Macro
tasklet_disableDisable the tasklet
tasklet_hi_scheduleSchedule the tasklet. But the HI_SOFTIRQ is used instead of TASKLET_SOFTIRQ as in the case of tasklet_schedule

In addition to the above APIs, the “tasklet_init” API is being phased out and the API “tasklet_setup” is being introduced.

In addition to the APIs, the following Macros are also defined which provide static initialization for a tasklet. Even amongst these macros, the earlier MACROS are now marked as OLD and can work with the previous implementation of Tasklet invocation passing “unsigned long” data.

Tasklet MACRODescription
DECLARE_TASKLET / DECLARE_TASKLET_OLDStatically declare a Tasklet
DECLARE_TASKLET_DISABLED / DECLARE_TASKLET_DISABLED_OLDStatically declare a Tasklet and disable the tasklet

Tasklet Example Code with statically initialized Tasklet

Comments

  1. Pingback: Tasklets in the Linux kernel | Hitch Hiker's Guide to Learning

Leave a Reply

Your email address will not be published. Required fields are marked *