Re: [PATCH 4/5] cpumask: convert drivers/net/sfc

From: Ben Hutchings
Date: Mon Jan 19 2009 - 12:11:11 EST


On Wed, 2009-01-07 at 11:58 -0800, Mike Travis wrote:
> From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxx>
> Signed-off-by: Mike Travis <travis@xxxxxxx>
> Cc: Ben Hutchings <bhutchings@xxxxxxxxxxxxxx>
> Cc: linux-net-drivers@xxxxxxxxxxxxxx
Acked-by: Ben Hutchings <bhutchings@xxxxxxxxxxxxxx>

This seems to work.

> ---
> 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");
[...]

This is an exceedingly unlikely error case so the error message is not
that important, but if you don't mind re-spinning this then please make
it "sfc: RSS disabled due to allocation failure\n".

(Device-related log messages should also include the device address, but
I don't want to add a device parameter to the function just for that.
Maybe we should call this function just once at module init time since
the result is not device-specific.)

Ben.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/