linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Deepawali Verma <dverma249@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Work queue questions
Date: Fri, 21 Sep 2012 20:26:01 +0100	[thread overview]
Message-ID: <CAHCeSFpa28d-7ruMKSw6z2EYKYN-5udVouUJOi4cnj4dPad-TA@mail.gmail.com> (raw)
In-Reply-To: <20120921183515.GI7264@google.com>

Hi Tejun,

I have put the ftrace markers in my code:

     kworker/u:1-21    [000]   110.964895: task_event: MYTASKJOB2381 XStarted
     kworker/u:1-21    [000]   110.964909: task_event: MYTASKJOB2381 Xstopped
     kworker/u:1-21    [000]   110.965137: task_event: MYTASKJOB2382 XStarted
     kworker/u:1-21    [000]   110.965154: task_event: MYTASKJOB2382 Xstopped
     kworker/u:5-3724  [000]   110.965311: task_event: MYTASKJOB2383 XStarted
     kworker/u:5-3724  [000]   110.965325: task_event: MYTASKJOB2383 Xstopped

I have this one big task to whom I divided into small sub tasks. These
are numbered 2381, 2382 and 2383, what was I expecting that task 2381,
2382, 2383 run in parallel. I have put start and stop markers here so
that I can see how this concurrency managed work queue is distributing
the load.

I found that task no 2381 is started first and exited before starting
task 2382 and so on. What I expected that it should start the three
sub tasks in parallel, not one by one.

Where is concurrency here?

Regards,
Deepa



On Fri, Sep 21, 2012 at 7:35 PM, Tejun Heo <tj@kernel.org> wrote:
> Hello,
>
> On Fri, Sep 21, 2012 at 07:30:21PM +0100, Deepawali Verma wrote:
>> Actually I want to make parallelization of one task into three tasks.
>> Therefore I created three single threaded work queues means divide the
>> task into three tasks. You are right that I can use one work queue as
>> well. But when I am doing three times schedule on different work
>> queues, I am seeing only one worker thread is processing the three
>> times schedule though I created three different workqueues and I
>> believe from previous kernel versions that there is one worker thread
>> associated with one queue. If one thread does this task then there is
>> no difference between doing the same task in one thread and using
>> three threads.
>>
>> If we create different work queues, why always one worker thread is
>> processing the all tasks instead I want another two threads also work
>> in parallel?
>
> Well, that was the whole point of concurrency managed workqueue.  You
> don't need to worry about the number of workers.  Concurrency is
> automatically managed.  If you queue three work items on, say,
> system_wq and none of them sleeps, a single worker will execute them
> back to back.  If a work item sleeps, another worker will kick in.
> So, in most cases, there's no need to worry about concurrency - just
> use system_wq.
>
> Thanks.
>
> --
> tejun

  reply	other threads:[~2012-09-21 19:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 17:35 Work queue questions Dinky Verma
2012-09-21 17:49 ` Tejun Heo
2012-09-21 18:30   ` Deepawali Verma
2012-09-21 18:35     ` Tejun Heo
2012-09-21 19:26       ` Deepawali Verma [this message]
2012-09-21 19:27         ` Tejun Heo
2012-09-21 19:35           ` Deepawali Verma
2012-09-21 19:40             ` Tejun Heo
2012-09-22  4:24             ` anish singh
2012-09-22  5:27               ` Daniel Taylor
2012-09-22  6:05                 ` anish singh
2012-09-22  6:12                   ` Tejun Heo
2012-09-22  6:18                   ` Daniel Taylor
2012-09-24  7:25                     ` Deepawali Verma
     [not found]                       ` <CAK-9PRB7KvPNgcsXiNG08-7OdrkkNc2ushusXh9rVm93J0xcHA@mail.gmail.com>
     [not found]                         ` <CAHCeSFqmeOkKySxMUXgtnev+HL-NC6MdmeuDYONymYaNczb7RA@mail.gmail.com>
2012-09-24 16:56                           ` Deepawali Verma
2012-09-24 18:10                             ` Tejun Heo
2012-09-24 19:57                               ` Deepawali Verma
2012-09-24 20:08                                 ` Tejun Heo
2012-09-24 20:52                                   ` Deepawali Verma
2012-09-24 20:54                                     ` Tejun Heo
2012-09-25  3:05                                   ` anish singh
2012-09-24 17:07                           ` Chinmay V S

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=CAHCeSFpa28d-7ruMKSw6z2EYKYN-5udVouUJOi4cnj4dPad-TA@mail.gmail.com \
    --to=dverma249@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).