staging/wlan-ng, prism2usb: replace reaper_bh tasklet with work

Tasklets have long been deprecated as being too heavy on the system
by running in irq context - and this is not a performance critical
path. If a higher priority process wants to run, it must wait for
the tasklet to finish before doing so.

The reaper_bh tasklet will now run in process context and have further
concurrency (tasklets being serialized among themselves), but this
is done holding the ctlxq.lock, so it should be fine.

Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-3-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Davidlohr Bueso 2022-04-11 08:16:16 -07:00 committed by Greg Kroah-Hartman
parent 5fb6bc718c
commit cbe0f674a2
3 changed files with 9 additions and 9 deletions

View file

@ -1227,7 +1227,7 @@ struct hfa384x {
struct timer_list throttle;
struct tasklet_struct reaper_bh;
struct work_struct reaper_bh;
struct tasklet_struct completion_bh;
struct work_struct usb_work;

View file

@ -193,7 +193,7 @@ static void hfa384x_usb_throttlefn(struct timer_list *t);
static void hfa384x_usbctlx_completion_task(struct tasklet_struct *t);
static void hfa384x_usbctlx_reaper_task(struct tasklet_struct *t);
static void hfa384x_usbctlx_reaper_task(struct work_struct *work);
static int hfa384x_usbctlx_submit(struct hfa384x *hw,
struct hfa384x_usbctlx *ctlx);
@ -539,7 +539,7 @@ void hfa384x_create(struct hfa384x *hw, struct usb_device *usb)
/* Initialize the authentication queue */
skb_queue_head_init(&hw->authq);
tasklet_setup(&hw->reaper_bh, hfa384x_usbctlx_reaper_task);
INIT_WORK(&hw->reaper_bh, hfa384x_usbctlx_reaper_task);
tasklet_setup(&hw->completion_bh, hfa384x_usbctlx_completion_task);
INIT_WORK(&hw->link_bh, prism2sta_processing_defer);
INIT_WORK(&hw->usb_work, hfa384x_usb_defer);
@ -2585,7 +2585,7 @@ void hfa384x_tx_timeout(struct wlandevice *wlandev)
/*----------------------------------------------------------------
* hfa384x_usbctlx_reaper_task
*
* Tasklet to delete dead CTLX objects
* Deferred work to delete dead CTLX objects
*
* Arguments:
* data ptr to a struct hfa384x
@ -2593,12 +2593,12 @@ void hfa384x_tx_timeout(struct wlandevice *wlandev)
* Returns:
*
* Call context:
* Interrupt
* Task
*----------------------------------------------------------------
*/
static void hfa384x_usbctlx_reaper_task(struct tasklet_struct *t)
static void hfa384x_usbctlx_reaper_task(struct work_struct *work)
{
struct hfa384x *hw = from_tasklet(hw, t, reaper_bh);
struct hfa384x *hw = container_of(work, struct hfa384x, reaper_bh);
struct hfa384x_usbctlx *ctlx, *temp;
unsigned long flags;
@ -2686,7 +2686,7 @@ static void hfa384x_usbctlx_completion_task(struct tasklet_struct *t)
spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
if (reap)
tasklet_schedule(&hw->reaper_bh);
schedule_work(&hw->reaper_bh);
}
/*----------------------------------------------------------------

View file

@ -182,7 +182,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface)
usb_kill_urb(&hw->ctlx_urb);
tasklet_kill(&hw->completion_bh);
tasklet_kill(&hw->reaper_bh);
cancel_work_sync(&hw->reaper_bh);
cancel_work_sync(&hw->link_bh);
cancel_work_sync(&hw->commsqual_bh);