From: Rusty Russell <rusty@rustcorp.com.au>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: Mike Travis <travis@sgi.com>, Ingo Molnar <mingo@redhat.com>,
linux-kernel@vger.kernel.org, Dean Nelson <dcn@sgi.com>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Robert Richter <robert.richter@amd.com>
Subject: Re: [PATCH 7/8] cpumask: convert misc driver functions
Date: Mon, 29 Dec 2008 12:58:35 +1030 [thread overview]
Message-ID: <200812291258.36437.rusty@rustcorp.com.au> (raw)
In-Reply-To: <1229815359.2723.19.camel@hashbaz.i.decadent.org.uk>
On Sunday 21 December 2008 09:52:39 Ben Hutchings wrote:
> I assume you're moving the allocation up to efx_probe_nic() because
> efx_wanted_rx_queues() and efx_probe_interrupts() cannot return failure.
> It really isn't worth exposing that detail up the call chain though. I
> think it's acceptable for efx_wanted_rx_queues() to log an error message
> and return 1 in the exceedingly unlikely case that the allocation fails.
OK, fair call. I was trying trying hard not to break anything.
How's this?
cpumask: convert drivers/net/sfc
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>
Cc: Ben Hutchings <bhutchings@solarflare.com>
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;
}
next prev parent reply other threads:[~2008-12-29 2:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-19 16:01 [PATCH 0/8] x86 cpumask: more cpumask updates to core kernel routines Mike Travis
2008-12-19 16:01 ` [PATCH 1/8] cpumask: convert kernel/compat.c Mike Travis
2008-12-19 16:01 ` [PATCH 2/8] cpumask: convert kernel/workqueue.c Mike Travis
2008-12-19 16:01 ` [PATCH 3/8] cpumask: convert kernel time functions Mike Travis
2008-12-20 11:29 ` Rusty Russell
2008-12-19 16:01 ` [PATCH 4/8] cpumask: convert kernel trace functions Mike Travis
2008-12-19 16:16 ` Steven Rostedt
2008-12-19 16:54 ` Mike Travis
2008-12-19 17:01 ` Steven Rostedt
2008-12-20 1:41 ` Steven Rostedt
2008-12-20 11:22 ` Rusty Russell
2008-12-19 16:01 ` [PATCH 5/8] cpumask: convert rest of files in kernel/ Mike Travis
2008-12-20 1:33 ` Lai Jiangshan
2008-12-20 13:02 ` Rusty Russell
2008-12-19 16:01 ` [PATCH 6/8] cpumask: convert kernel mm functions Mike Travis
2008-12-19 18:08 ` Christoph Lameter
2008-12-19 16:01 ` [PATCH 7/8] cpumask: convert misc driver functions Mike Travis
2008-12-20 23:22 ` Ben Hutchings
2008-12-29 2:28 ` Rusty Russell [this message]
2008-12-29 15:37 ` Dean Nelson
2008-12-19 16:01 ` [PATCH 8/8] cpumask: convert other misc kernel functions Mike Travis
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=200812291258.36437.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=bhutchings@solarflare.com \
--cc=dcn@sgi.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=robert.richter@amd.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox