mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Valdis.Kletnieks@vt.edu, Mike Travis <travis@sgi.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	mm-commits@vger.kernel.org, Rusty Russell <rusty@rustcorp.com.au>,
	Dave Jones <davej@redhat.com>, Ingo Molnar <mingo@elte.hu>
Subject: Re: mmotm 2009-04-10-02-21 uploaded - forkbombed by work_for_cpu
Date: Mon, 13 Apr 2009 09:04:23 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.2.00.0904130847500.4583@localhost.localdomain> (raw)
In-Reply-To: <4609.1239456126@turing-police.cc.vt.edu>



On Sat, 11 Apr 2009, Valdis.Kletnieks@vt.edu wrote:
> 
> Probable cause for my problem:
> 
> arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c calls work_on_cpu(). We get into a
> state where we have enough activity to kick us to a high CPU speed, and then
> the activity of writing 90 acct records per sec keeps us there - with continual
> callbacks to see if we can drop the CPU speed.

Ok, I think that that work_on_cpu() commit is broken, but I _also_ think 
that cpufreq is doing something fairly insane.

This behavior seems to be triggered by the "ondemand" policy case, btw, 
and it literally does basically:

  dbs_check_cpu:
    for_each_cpu(j, policy->cpus)
      ...
      freq_avg = __cpufreq_driver_getavg(policy, j);

where "__cpufreq_driver_getavg()" will do "freq->getavg(policy, cpu)" and 
then acpi-cpufreq.c will do that "work_on_cpu()" as part of the call to 
"get_measured_perf()".

So pretty much _all_ use is going to always effectively do a broadcast 
"work on each cpu" thing. That's always going to be pretty damn expensive.

And there's no _reason_. As far as I can tell, that ACPI cpufreq thing 
doesn't _need_ any "process context".  That "get_measured_perf()" will 
just do a single read_measured_perf_ctrs() call, and all that does is two 
'rdmsr()' calls.

So afaik, acpi-cpufreq.c should not use "work_on_cpu()" for that at all. 
It should just do a smp_call_function_single(). 

So I do think Andrew's commit is broken and we should think about it a bit 
more, but I also think that Valdis' problem comes from acpi-cpufreq just 
being damn stupid. Doing a smp_call_function_single() to read two MSR's is 
going to be a _lot_ more efficient than doing that crazy work_on_cpu() for 
that.

So the _real_ problem came through the commits like

    cpufreq: use work_on_cpu in acpi-cpufreq.c for drv_read and drv_write
    cpumask: use work_on_cpu in acpi-cpufreq.c for read_measured_perf_ctrs

that were meant to reduce stack usage with big cpu masks. And sure, the 
_old_ way of doing it was also stupid (it rescheduled the process to the 
other CPU by using cpus_allowed()).

Mike, Ingo?

		Linus

  reply	other threads:[~2009-04-13 16:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200904100922.n3A9MOIV013828@imap1.linux-foundation.org>
2009-04-10 19:53 ` mmotm 2009-04-10-02-21 uploaded (shmem) Randy Dunlap
2009-04-10 20:00   ` Andrew Morton
2009-04-10 20:04     ` Randy Dunlap
2009-04-10 20:16     ` Hugh Dickins
2009-04-11 13:22 ` mmotm 2009-04-10-02-21 uploaded - forkbombed by work_for_cpu Valdis.Kletnieks
2009-04-13 16:04   ` Linus Torvalds [this message]
2009-04-13 16:34     ` Mike Galbraith
2009-04-13 17:18     ` Ingo Molnar
2009-04-13 17:27       ` Andrew Morton
2009-04-13 17:41         ` Ingo Molnar
2009-04-13 17:45         ` Linus Torvalds
2009-04-13 18:11           ` Ingo Molnar
2009-04-13 18:49           ` Andrew Morton
2009-04-13 19:03             ` Jeremy Fitzhardinge
2009-04-13 19:03             ` Dave Jones
2009-04-13 19:40               ` Ingo Molnar
2009-04-13 19:27         ` Valdis.Kletnieks
2009-04-13 23:50         ` Linus Torvalds
2009-04-14  0:31           ` Andrew Morton
2009-04-15  8:15         ` Ali Gholami Rudi
2009-04-15  8:34           ` Andrew Morton
2009-04-15  9:08             ` Ali Gholami Rudi
2009-04-15 14:45             ` Linus Torvalds
2009-04-14 12:42     ` Rusty Russell

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=alpine.LFD.2.00.0904130847500.4583@localhost.localdomain \
    --to=torvalds@linux-foundation.org \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mm-commits@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=travis@sgi.com \
    /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

all inboxes | Powered by JetHome®