lkml.org 
[lkml]   [2009]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 4/5] cpumask: convert drivers/net/sfc
    From: Rusty Russell <rusty@rustcorp.com.au>

    Impact: reduce stack usage, use new cpumask API.

    Remove a cpumask from the stack. Ben Hutchings indicated that printing
    a warning and returning 1 was acceptable for the corner case where allocation
    fails.

    Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: Mike Travis <travis@sgi.com>
    Cc: Ben Hutchings <bhutchings@solarflare.com>
    Cc: linux-net-drivers@solarflare.com
    ---
    drivers/net/sfc/efx.c | 15 +++++++++++----
    1 file changed, 11 insertions(+), 4 deletions(-)

    diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c
    --- a/drivers/net/sfc/efx.c
    +++ b/drivers/net/sfc/efx.c
    @@ -854,20 +854,27 @@ static void efx_fini_io(struct efx_nic *
    * interrupts across them. */
    static int efx_wanted_rx_queues(void)
    {
    - cpumask_t core_mask;
    + cpumask_var_t core_mask;
    int count;
    int cpu;

    - cpus_clear(core_mask);
    + if (!alloc_cpumask_var(&core_mask, GFP_KERNEL)) {
    + printk(KERN_WARNING
    + "efx.c: allocation failure, irq balancing hobbled\n");
    + return 1;
    + }
    +
    + cpumask_clear(core_mask);
    count = 0;
    for_each_online_cpu(cpu) {
    - if (!cpu_isset(cpu, core_mask)) {
    + if (!cpumask_test_cpu(cpu, core_mask)) {
    ++count;
    - cpumask_or(&core_mask, &core_mask,
    + cpumask_or(core_mask, core_mask,
    topology_core_cpumask(cpu));
    }
    }

    + free_cpumask_var(core_mask);
    return count;
    }

    --


    \
     
     \ /
      Last update: 2009-01-07 21:01    [W:0.049 / U:60.516 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site