0

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.

Mark
  • 6,052
  • 8
  • 61
  • 129
  • My vote is for > such idea is stupid? <. It is more likely that you would be able to share tasklet pointer between modules, but this breaks concept of a tasklet as a unit of work. Also, how do you handle situation when both modules will call `tasklet_schedule()`? – myaut Mar 20 '15 at 20:50

1 Answers1

1

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

Gil Hamilton
  • 11,973
  • 28
  • 51