lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090413181126.GA6669@elte.hu>
Date:	Mon, 13 Apr 2009 20:11:26 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>, Valdis.Kletnieks@...edu,
	Mike Travis <travis@....com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	mm-commits@...r.kernel.org, Rusty Russell <rusty@...tcorp.com.au>,
	Dave Jones <davej@...hat.com>, Len Brown <lenb@...nel.org>
Subject: Re: mmotm 2009-04-10-02-21 uploaded - forkbombed by work_for_cpu


* Linus Torvalds <torvalds@...ux-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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ