All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Valdis.Kletnieks@vt.edu, Mike Travis <travis@sgi.com>,
	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>, Len Brown <lenb@kernel.org>
Subject: Re: mmotm 2009-04-10-02-21 uploaded - forkbombed by work_for_cpu
Date: Mon, 13 Apr 2009 20:11:26 +0200	[thread overview]
Message-ID: <20090413181126.GA6669@elte.hu> (raw)
In-Reply-To: <alpine.LFD.2.00.0904131040350.4583@localhost.localdomain>


* Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Mon, 13 Apr 2009, Andrew Morton wrote:
> >
> >  static void drv_write(struct drv_cmd *cmd)
> >  {
> > -	unsigned int i;
> > +	unsigned int cpu;
> >  
> > -	for_each_cpu(i, cmd->mask) {
> > -		work_on_cpu(i, do_drv_write, cmd);
> > -	}
> > +	for_each_cpu(cpu, cmd->mask)
> > +		smp_call_function_single(cpu, do_drv_write, cmd, 1);
> 
> Ok, that's just -wrong-.
> 
> Doesn't anybody else see anything odd in doing
> 
> 	for_each_cpu(cpu, cmd->mask)
> 		smp_call_function_single(cpu, ..);
> 
> and react to it?
> 
> IOW, why not just do
> 
> 	smp_call_function_many(cmd->mask, do_drv_write, cmd, 1);
> 
> here?

Uhm, yes. The ancient version did:

        for_each_cpu_mask(i, cmd->mask) {
                set_cpus_allowed(current, cpumask_of_cpu(i));
                do_drv_write(cmd);
        }

and we just kept that pattern while somewhat mindlessly converting 
it around, and never realized how it collapses to a nice masked API 
version when the right IPI-call primitive is used.

	Ingo

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

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-10  9:22 mmotm 2009-04-10-02-21 uploaded akpm
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
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:27         ` Andrew Morton
2009-04-13 17:41         ` Ingo Molnar
2009-04-13 17:45         ` Linus Torvalds
2009-04-13 18:11           ` Ingo Molnar [this message]
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  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=20090413181126.GA6669@elte.hu \
    --to=mingo@elte.hu \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@linux-foundation.org \
    --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 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.