From: Mike Travis <travis@sgi.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
James Morris <jmorris@namei.org>,
Patrick McHardy <kaber@trash.net>
Subject: [PATCH 08/10] net: remove NR_CPUS arrays in net/core/dev.c
Date: Mon, 24 Mar 2008 19:20:02 -0700 [thread overview]
Message-ID: <20080325021956.212787000@polaris-admin.engr.sgi.com> (raw)
In-Reply-To: <20080325021954.979158000@polaris-admin.engr.sgi.com>
[-- Attachment #1: nr_cpus-in-net_core_dev --]
[-- Type: text/plain, Size: 2201 bytes --]
Remove the fixed size channels[NR_CPUS] array in
net/core/dev.c and dynamically allocate array based on
nr_cpu_ids.
Based on linux-2.6.25-rc5-mm1
Cc: David S. Miller <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Patrick McHardy <kaber@trash.net>
Signed-off-by: Mike Travis <travis@sgi.com>
---
net/core/dev.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
--- linux-2.6.25-rc5.orig/net/core/dev.c
+++ linux-2.6.25-rc5/net/core/dev.c
@@ -162,7 +162,7 @@ struct net_dma {
struct dma_client client;
spinlock_t lock;
cpumask_t channel_mask;
- struct dma_chan *channels[NR_CPUS];
+ struct dma_chan **channels;
};
static enum dma_state_client
@@ -2448,7 +2448,7 @@ static struct netif_rx_stats *softnet_ge
{
struct netif_rx_stats *rc = NULL;
- while (*pos < NR_CPUS)
+ while (*pos < nr_cpu_ids)
if (cpu_online(*pos)) {
rc = &per_cpu(netdev_rx_stat, *pos);
break;
@@ -4320,7 +4320,7 @@ netdev_dma_event(struct dma_client *clie
spin_lock(&net_dma->lock);
switch (state) {
case DMA_RESOURCE_AVAILABLE:
- for (i = 0; i < NR_CPUS; i++)
+ for (i = 0; i < nr_cpu_ids; i++)
if (net_dma->channels[i] == chan) {
found = 1;
break;
@@ -4335,7 +4335,7 @@ netdev_dma_event(struct dma_client *clie
}
break;
case DMA_RESOURCE_REMOVED:
- for (i = 0; i < NR_CPUS; i++)
+ for (i = 0; i < nr_cpu_ids; i++)
if (net_dma->channels[i] == chan) {
found = 1;
pos = i;
@@ -4362,6 +4362,13 @@ netdev_dma_event(struct dma_client *clie
*/
static int __init netdev_dma_register(void)
{
+ net_dma.channels = kzalloc(nr_cpu_ids * sizeof(struct net_dma),
+ GFP_KERNEL);
+ if (unlikely(net_dma.channels)) {
+ printk(KERN_NOTICE
+ "netdev_dma: no memory for net_dma.channels\n");
+ return -ENOMEM;
+ }
spin_lock_init(&net_dma.lock);
dma_cap_set(DMA_MEMCPY, net_dma.client.cap_mask);
dma_async_client_register(&net_dma.client);
--
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-03-25 2:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-25 2:19 [PATCH 00/10] NR_CPUS: third reduction of NR_CPUS memory usage Mike Travis
2008-03-25 2:19 ` [PATCH 01/10] x86_64: Cleanup non-smp usage of cpu maps v4 Mike Travis
2008-03-25 2:19 ` [PATCH 02/10] init: move setup of nr_cpu_ids to as early as possible v4 Mike Travis
2008-03-25 2:19 ` [PATCH 03/10] cpufreq: change cpu freq arrays to per_cpu variables Mike Travis
2008-03-25 2:19 ` [PATCH 04/10] acpi: change processors from array to per_cpu variable Mike Travis
2008-03-25 2:19 ` [PATCH 05/10] cpumask: Add cpumask_scnprintf_len function Mike Travis
2008-03-25 2:20 ` [PATCH 06/10] x86: reduce memory and stack usage in intel_cacheinfo Mike Travis
2008-03-25 2:20 ` [PATCH 07/10] cpu: change cpu_sys_devices from array to per_cpu variable Mike Travis
2008-03-25 2:20 ` Mike Travis [this message]
2008-03-25 5:57 ` [PATCH 08/10] net: remove NR_CPUS arrays in net/core/dev.c Alexey Dobriyan
2008-03-25 15:02 ` Mike Travis
2008-03-25 2:20 ` [PATCH 09/10] x86: oprofile: remove NR_CPUS arrays in arch/x86/oprofile/nmi_int.c Mike Travis
2008-03-25 2:20 ` [PATCH 10/10] sched: Remove fixed NR_CPUS sized arrays in kernel_sched.c 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=20080325021956.212787000@polaris-admin.engr.sgi.com \
--to=travis@sgi.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=jmorris@namei.org \
--cc=kaber@trash.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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