Mark
Mark

Reputation: 6484

one tasklet used by different drivers

Is it possible to define a single tasklet in one module, and "export" it for use by others? I wonder if this is theoretically possible, what about synchronization and ordered access to the tasklet? Or such idea is stupid?

Thanks.

Upvotes: 0

Views: 100

Answers (1)

Gil Hamilton
Gil Hamilton

Reputation: 12347

Sure. No reason why you could not do so. I can't see why it would be a good idea to do so, but there's nothing stopping you. The tasklet framework makes certain guarantees, one of which is that the tasklet will not run on more than one CPU at a time. So there's no real synchronization issue.

However, there is also no "ordered access" to the tasklet in the sense that you can queue up work for it. If you call tasklet_schedule while the tasklet is already running, the tasklet will be executed again, but its execution may be deferred to the ksoftirqd thread.

You should probably read the LDD3 section on tasklets at http://www.makelinux.net/ldd3/chp-7-sect-5.shtml

Upvotes: 1

Related Questions