Skip to content

Commit

Permalink
Fix Large kmem_alloc in vdev_metaslab_init
Browse files Browse the repository at this point in the history
This allocation can go way over 1MB, so we should use vmem_alloc instead of
kmem_alloc.

[  135.552116] Large kmem_alloc(1430784, 0x1000), please file an issue at:
[  135.552116] https://github.com/zfsonlinux/zfs/issues/new
[  135.552125] CPU: 5 PID: 8789 Comm: zpool Tainted: P           O  3.16.0-4-amd64 #1 Debian 3.16.7-ckt25-2
[  135.552127] Hardware name: IBM System x3650 M2 -[794732U]-/49Y6498     , BIOS -[D6E128AUS-1.03]- 08/20/2009
[  135.552129]  0000000000000000 ffffffff8150e835 0000000000000000 000000000000c210
[  135.552133]  ffffffffa0324aff ffff880fe84a8000 ffff880fe84a8000 0000000000000000
[  135.552136]  000000000002baa0 ffff880fe89e9000 ffffffffa17d0c8d 0000000000000000
[  135.552140] Call Trace:
[  135.552150]  [<ffffffff8150e835>] ? dump_stack+0x5d/0x78
[  135.552167]  [<ffffffffa0324aff>] ? spl_kmem_zalloc+0xef/0x160 [spl]
[  135.552197]  [<ffffffffa17d0c8d>] ? vdev_metaslab_init+0x9d/0x1f0 [zfs]
[  135.552216]  [<ffffffffa17d46d0>] ? vdev_load+0xc0/0xd0 [zfs]
[  135.552231]  [<ffffffffa17d4643>] ? vdev_load+0x33/0xd0 [zfs]
[  135.552247]  [<ffffffffa17c0004>] ? spa_load+0xfc4/0x1b60 [zfs]
[  135.552264]  [<ffffffffa17c1838>] ? spa_tryimport+0x98/0x430 [zfs]
[  135.552277]  [<ffffffffa17f28b1>] ? zfs_ioc_pool_tryimport+0x41/0x80 [zfs]
[  135.552291]  [<ffffffffa17f5669>] ? zfsdev_ioctl+0x4a9/0x4e0 [zfs]
[  135.552294]  [<ffffffff811bacdf>] ? do_vfs_ioctl+0x2cf/0x4b0
[  135.552297]  [<ffffffff810852e1>] ? task_work_run+0x91/0xb0
[  135.552299]  [<ffffffff811baf41>] ? SyS_ioctl+0x81/0xa0
[  135.552301]  [<ffffffff81516a28>] ? page_fault+0x28/0x30
[  135.552303]  [<ffffffff81514a0d>] ? system_call_fast_compare_end+0x10/0x15

Signed-off-by: Chunwei Chen <[email protected]>
Closes #4752
  • Loading branch information
Chunwei Chen committed Jul 7, 2016
1 parent 3e783da commit 69bc382
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,11 +892,11 @@ vdev_metaslab_init(vdev_t *vd, uint64_t txg)

ASSERT(oldc <= newc);

mspp = kmem_zalloc(newc * sizeof (*mspp), KM_SLEEP);
mspp = vmem_zalloc(newc * sizeof (*mspp), KM_SLEEP);

if (oldc != 0) {
bcopy(vd->vdev_ms, mspp, oldc * sizeof (*mspp));
kmem_free(vd->vdev_ms, oldc * sizeof (*mspp));
vmem_free(vd->vdev_ms, oldc * sizeof (*mspp));
}

vd->vdev_ms = mspp;
Expand Down Expand Up @@ -950,7 +950,7 @@ vdev_metaslab_fini(vdev_t *vd)
if (msp != NULL)
metaslab_fini(msp);
}
kmem_free(vd->vdev_ms, count * sizeof (metaslab_t *));
vmem_free(vd->vdev_ms, count * sizeof (metaslab_t *));
vd->vdev_ms = NULL;
}

Expand Down

0 comments on commit 69bc382

Please sign in to comment.