public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Dave Jones <davej@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: excessive kworker activity when idle. (was Re: vma corruption in today's -git)
Date: Thu, 31 Mar 2011 08:56:42 +0200	[thread overview]
Message-ID: <20110331065642.GA3385@htj.dyndns.org> (raw)
In-Reply-To: <AANLkTikYAAYcYxTdKAxQjDxVQ7qrZGEfXg+gpfwcj1=-@mail.gmail.com>

Hello,

On Wed, Mar 30, 2011 at 08:37:21PM -0700, Linus Torvalds wrote:
> On Wed, Mar 30, 2011 at 8:09 PM, Dave Jones <davej@redhat.com> wrote:
> >
> > But rerunning the same tests on current head (6aba74f2791287ec407e0f92487a725a25908067)
> > I can still reproduce the problem where kworker threads go nutso
> > when the machine should be completely idle.
> >
> > top shows two kworker threads constantly at >80% cpu.
> 
> Ok, I've seen that "tons of cpu by kworker" triggered by a few
> different issues. One was the intel graphics driver doing monitor
> detection constantly, and spending all its time in one of the worker
> threads doing __udelay() for the stupid i2c driver.
> 
> The other case I've seen is a wireless thing that falls back to GPIO,
> and spends a lot of CPU time on that.
> 
> I'm not saying yours is either of those cases, but one of the problems
> with that behavior is that it's actually fairly hard to figure out
> what the hell is happening. You don't see some nice thread description
> in 'top' any more (like you used to when everybody created their own
> threads and didn't do the common worker thread thing), and the best
> approach literally seems to be something like

Yes, not having dedicated workers decrease immediate visibility via
ps/top but I don't think the actual vsibility is worse.  There are two
types for kworker looping - something being scheduled in rapid
succession or a single work consuming lots of CPU cycles.

The first one can be tracked using tracing.

  $ echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event
  $ cat /sys/kernel/debug/tracing/trace_pipe > out.txt
  (wait a few secs)
  ^C

If something is busy looping on work queueing, it would be dominating
the output and the offender can be determined with the work item
function.

For the second type, "cat /proc/THE_OFFENDING_KWORKER/stack" is the
easiest.  The work item function will be trivially visible in the
stack trace.

Thanks.

-- 
tejun

  parent reply	other threads:[~2011-03-31  6:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29  4:09 vma corruption in today's -git Dave Jones
2011-03-29  4:19 ` Américo Wang
2011-03-29  4:26   ` Dave Jones
2011-03-29  4:22 ` Linus Torvalds
2011-03-31  3:09   ` excessive kworker activity when idle. (was Re: vma corruption in today's -git) Dave Jones
2011-03-31  3:34     ` Dave Jones
2011-03-31  3:44       ` Linus Torvalds
2011-03-31  4:08         ` Dave Jones
2011-03-31 15:53           ` Linus Torvalds
2011-03-31 16:21             ` Linus Torvalds
2011-03-31 21:38               ` Linus Torvalds
2011-03-31 14:59         ` Paul E. McKenney
2011-03-31  3:37     ` Linus Torvalds
2011-03-31  3:55       ` Dave Jones
2011-03-31  5:32         ` Linus Torvalds
2011-03-31 14:21           ` Arnaldo Carvalho de Melo
2011-03-31 14:58           ` Dave Jones
2011-03-31 15:03             ` Dave Jones
2011-03-31 15:09               ` Dave Jones
2011-03-31 15:45                 ` Linus Torvalds
2011-03-31 15:25               ` Linus Torvalds
2011-03-31 15:49                 ` Dave Jones
2011-03-31 15:58                   ` Linus Torvalds
2011-03-31 16:13                     ` Dave Jones
2011-03-31  6:56       ` Tejun Heo [this message]
2011-03-31 10:37         ` [PATCH] workqueue: document debugging tricks Florian Mickler
2011-03-31 11:41           ` Tejun Heo

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=20110331065642.GA3385@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.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