All of lore.kernel.org
 help / color / mirror / Atom feed
* doubt on schedule_work() - work task getting scheduled lately
@ 2016-07-29 10:32 Muni Sekhar
  2016-07-29 10:44 ` Pranay Srivastava
  2016-08-05  5:44 ` Mulyadi Santosa
  0 siblings, 2 replies; 10+ messages in thread
From: Muni Sekhar @ 2016-07-29 10:32 UTC (permalink / raw)
  To: kernelnewbies

Hi All,

I have a doubt regarding the workqueue scheduling.

I am using the workqueue for processing the Rx Interrupt data. I am
calling schedule_work() on receiving the Rx interrupt from hardware.

I calculated the time between calling the schedule_work() and
workqueue task actually getting executed, Here I see many cases of
less than 100 us(It is fairly good).

But sometimes I see 10?s of ms and a lot in the 100?s of ms. I have
seen over 0.5 secs too. I would like to know why does sometimes kernel
takes longer time(in milli seconds) to schedule it? Is there any way
to reduce this time gap?


My code:

static void my_workqueuetask(struct work_struct *work)
{
    printk("In %s() \n",__func__);

    mutex_lock(&bh_mutex);

    //Do something here

    mutex_unlock(&bh_mutex);
}


static irqreturn_t my_irq_handler(int irq, void *dev)
{
        ??;

        if(Rx Interrupt)
             schedule_work(&rx_work);

return IRQ_HANDLED;
}

-- 
Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 10+ messages in thread
* doubt on schedule_work() - work task getting scheduled lately
@ 2016-07-29  9:39 Muni Sekhar
  0 siblings, 0 replies; 10+ messages in thread
From: Muni Sekhar @ 2016-07-29  9:39 UTC (permalink / raw)
  To: linux-kernel

Hi All,

I have a doubt regarding the workqueue scheduling.

I am using the workqueue for processing the Rx Interrupt data. I am
calling schedule_work() on receiving the Rx interrupt from hardware.

I calculated the time between calling the schedule_work() and
workqueue task actually getting executed, Here I see many cases of
less than 100 us(It is fairly good).

But sometimes I see 10’s of ms and a lot in the 100’s of ms. I have
seen over 0.5 secs too. I would like to know why does sometimes kernel
takes longer time(in milli seconds) to schedule it? Is there any way
to reduce this time gap?


My code:

static void my_workqueuetask(struct work_struct *work)
{
    printk("In %s() \n",__func__);

    mutex_lock(&rx_bh_mutex);

    //Do something here

    mutex_lock(&rx_bh_mutex);
}


static irqreturn_t my_irq_handler(int irq, void *dev)
{
        ……;

        if(Rx Interrupt)
             schedule_work(&rx_work);

return IRQ_HANDLED;
}




-- 
Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-08-05 13:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-29 10:32 doubt on schedule_work() - work task getting scheduled lately Muni Sekhar
2016-07-29 10:44 ` Pranay Srivastava
2016-07-29 13:48   ` Ricardo Ribalda Delgado
2016-07-29 15:35     ` Daniel.
2016-08-01 10:32       ` Muni Sekhar
2016-08-01 13:04         ` Daniel.
2016-08-05  7:22           ` Muni Sekhar
2016-08-05 13:09             ` Daniel.
2016-08-05  5:44 ` Mulyadi Santosa
  -- strict thread matches above, loose matches on Subject: below --
2016-07-29  9:39 Muni Sekhar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.