Re: [net-next v3 05/15] net: cavium/liquidio: Convert tasklet API to new bottom half workqueue mechanism

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > > Could you shed some light in the cover letter or this patch why
> > > tasklet_enable() is converted to enable_and_queue_work() at
> > > the face of it those two do not appear to do the same thing?
> >
> > With the transition to workqueues, the implementation on the workqueue side is:
> >
> > tasklet_enable() -> enable_work() + queue_work()
> >
> > Ref: https://lore.kernel.org/all/20240227172852.2386358-7-tj@xxxxxxxxxx/
> >
> > enable_and_queue_work() is a helper which combines the two calls.
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=474a549ff4c989427a14fdab851e562c8a63fe24
> >
> > Hope this answers your question.
>
> To an extent. tj says "unconditionally scheduling the work item after
> enable_work() returns %true should work for most users."
> You need to include the explanation of the conversion not being 1:1
> in the commit message, and provide some analysis why it's fine for this
> user.


Sure, please review the explanation below and let me
know if it is clear enough:

tasklet_enable() is used to enable a tasklet, which defers
work to be executed in an interrupt context. It relies on the
tasklet mechanism for deferred execution.

enable_and_queue_work() combines enabling the work with
scheduling it on a workqueue. This approach not only enables
the work but also schedules it for execution by the workqueue
system, which is more flexible and suitable for tasks needing
process context rather than interrupt context.

enable_and_queue_work() internally calls enable_work() to enable
the work item and then uses queue_work() to add it to the workqueue.
This ensures that the work item is both enabled and explicitly
scheduled for execution within the workqueue system's context.

As mentioned, "unconditionally scheduling the work item after
enable_work() returns true should work for most users." This
ensures that the work is consistently scheduled for execution,
aligning with the typical workqueue usage pattern. Most users
expect that enabling a work item implies it will be scheduled for
execution without additional conditional logic.

Thanks,
- Allen




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux