aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/rionet.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2012-03-29 21:01:46 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-01 23:17:16 -0400
commitacc656323ab904803393acefdc8e1b78cde752e5 (patch)
tree4d11bd3fc1c943d639af8d1bd68c0eb211309d55 /drivers/net/rionet.c
parent3f8c91a7398b9266fbe7abcbe4bd5dffef907643 (diff)
rionet: fix page allocation order of rionet_active
rionet_active is allocated from the page allocator and the allocation order is calculated on the assumption that the page size is 4KB, so it wastes memory on more than 4K page systems. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Alexandre Bounine <alexandre.bounine@idt.com> Cc: netdev@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/rionet.c')
-rw-r--r--drivers/net/rionet.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c
index a57f05726b57..91d25888a1b9 100644
--- a/drivers/net/rionet.c
+++ b/drivers/net/rionet.c
@@ -375,8 +375,8 @@ static void rionet_remove(struct rio_dev *rdev)
375 struct net_device *ndev = rio_get_drvdata(rdev); 375 struct net_device *ndev = rio_get_drvdata(rdev);
376 struct rionet_peer *peer, *tmp; 376 struct rionet_peer *peer, *tmp;
377 377
378 free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? 378 free_pages((unsigned long)rionet_active, get_order(sizeof(void *) *
379 __fls(sizeof(void *)) + 4 : 0); 379 RIO_MAX_ROUTE_ENTRIES(rdev->net->hport->sys_size)));
380 unregister_netdev(ndev); 380 unregister_netdev(ndev);
381 free_netdev(ndev); 381 free_netdev(ndev);
382 382
@@ -432,15 +432,16 @@ static int rionet_setup_netdev(struct rio_mport *mport, struct net_device *ndev)
432 int rc = 0; 432 int rc = 0;
433 struct rionet_private *rnet; 433 struct rionet_private *rnet;
434 u16 device_id; 434 u16 device_id;
435 const size_t rionet_active_bytes = sizeof(void *) *
436 RIO_MAX_ROUTE_ENTRIES(mport->sys_size);
435 437
436 rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL, 438 rionet_active = (struct rio_dev **)__get_free_pages(GFP_KERNEL,
437 mport->sys_size ? __fls(sizeof(void *)) + 4 : 0); 439 get_order(rionet_active_bytes));
438 if (!rionet_active) { 440 if (!rionet_active) {
439 rc = -ENOMEM; 441 rc = -ENOMEM;
440 goto out; 442 goto out;
441 } 443 }
442 memset((void *)rionet_active, 0, sizeof(void *) * 444 memset((void *)rionet_active, 0, rionet_active_bytes);
443 RIO_MAX_ROUTE_ENTRIES(mport->sys_size));
444 445
445 /* Set up private area */ 446 /* Set up private area */
446 rnet = netdev_priv(ndev); 447 rnet = netdev_priv(ndev);