lkml.org 
[lkml]   [2009]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: mmotm 2009-04-10-02-21 uploaded - forkbombed by work_for_cpu

    * 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


    \
     
     \ /
      Last update: 2009-04-13 20:15    [W:0.023 / U:78.620 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site