All of lore.kernel.org
 help / color / mirror / Atom feed
From: Muni Sekhar <munisekharrms@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: doubt on schedule_work() - work task getting scheduled lately
Date: Fri, 29 Jul 2016 15:09:42 +0530	[thread overview]
Message-ID: <CAHhAz+hSxgDDt8DVzO2w0k8x98ONejuvLKX+jbYOz7Lx0cPP4A@mail.gmail.com> (raw)

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

             reply	other threads:[~2016-07-29  9:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-29  9:39 Muni Sekhar [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHhAz+hSxgDDt8DVzO2w0k8x98ONejuvLKX+jbYOz7Lx0cPP4A@mail.gmail.com \
    --to=munisekharrms@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.