Skip to content

Commit b8d06fc

Browse files
ryaobehlendorf
authored andcommitted
Switch KM_SLEEP to KM_PUSHPAGE
Differences between how paging is done on Solaris and Linux can cause deadlocks if KM_SLEEP is used in any the following contexts. * The txg_sync thread * The zvol write/discard threads * The zpl_putpage() VFS callback This is because KM_SLEEP will allow for direct reclaim which may result in the VM calling back in to the filesystem or block layer to write out pages. If a lock is held over this operation the potential exists to deadlock the system. To ensure forward progress all memory allocations in these contexts must us KM_PUSHPAGE which disables performing any I/O to accomplish the memory allocation. Previously, this behavior was acheived by setting PF_MEMALLOC on the thread. However, that resulted in unexpected side effects such as the exhaustion of pages in ZONE_DMA. This approach touchs more of the zfs code, but it is more consistent with the right way to handle these cases under Linux. This is patch lays the ground work for being able to safely revert the following commits which used PF_MEMALLOC: 21ade34 Disable direct reclaim for z_wr_* threads cfc9a5c Fix zpl_writepage() deadlock eec8164 Fix ASSERTION(!dsl_pool_sync_context(tx->tx_pool)) Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #726
1 parent 991fc1d commit b8d06fc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+187
-185
lines changed

include/sys/dbuf.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -345,13 +345,13 @@ boolean_t dbuf_is_metadata(dmu_buf_impl_t *db);
345345
} \
346346
_NOTE(CONSTCOND) } while (0)
347347

348-
#define dprintf_dbuf_bp(db, bp, fmt, ...) do { \
349-
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
350-
char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_SLEEP); \
351-
sprintf_blkptr(__blkbuf, bp); \
352-
dprintf_dbuf(db, fmt " %s\n", __VA_ARGS__, __blkbuf); \
353-
kmem_free(__blkbuf, BP_SPRINTF_LEN); \
354-
} \
348+
#define dprintf_dbuf_bp(db, bp, fmt, ...) do { \
349+
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
350+
char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_PUSHPAGE); \
351+
sprintf_blkptr(__blkbuf, bp); \
352+
dprintf_dbuf(db, fmt " %s\n", __VA_ARGS__, __blkbuf); \
353+
kmem_free(__blkbuf, BP_SPRINTF_LEN); \
354+
} \
355355
_NOTE(CONSTCOND) } while (0)
356356

357357
#define DBUF_VERIFY(db) dbuf_verify(db)

include/sys/dsl_dataset.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ int dsl_destroy_inconsistent(const char *dsname, void *arg);
271271
#ifdef ZFS_DEBUG
272272
#define dprintf_ds(ds, fmt, ...) do { \
273273
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
274-
char *__ds_name = kmem_alloc(MAXNAMELEN, KM_SLEEP); \
274+
char *__ds_name = kmem_alloc(MAXNAMELEN, KM_PUSHPAGE); \
275275
dsl_dataset_name(ds, __ds_name); \
276276
dprintf("ds=%s " fmt, __ds_name, __VA_ARGS__); \
277277
kmem_free(__ds_name, MAXNAMELEN); \

include/sys/dsl_dir.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ timestruc_t dsl_dir_snap_cmtime(dsl_dir_t *dd);
150150
#define dprintf_dd(dd, fmt, ...) do { \
151151
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
152152
char *__ds_name = kmem_alloc(MAXNAMELEN + strlen(MOS_DIR_NAME) + 1, \
153-
KM_SLEEP); \
153+
KM_PUSHPAGE); \
154154
dsl_dir_name(dd, __ds_name); \
155155
dprintf("dd=%s " fmt, __ds_name, __VA_ARGS__); \
156156
kmem_free(__ds_name, MAXNAMELEN + strlen(MOS_DIR_NAME) + 1); \

include/sys/spa.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,12 @@ extern void spa_configfile_set(spa_t *, nvlist_t *, boolean_t);
690690
extern void spa_event_notify(spa_t *spa, vdev_t *vdev, const char *name);
691691

692692
#ifdef ZFS_DEBUG
693-
#define dprintf_bp(bp, fmt, ...) do { \
694-
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
695-
char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_SLEEP); \
696-
sprintf_blkptr(__blkbuf, (bp)); \
697-
dprintf(fmt " %s\n", __VA_ARGS__, __blkbuf); \
698-
kmem_free(__blkbuf, BP_SPRINTF_LEN); \
693+
#define dprintf_bp(bp, fmt, ...) do { \
694+
if (zfs_flags & ZFS_DEBUG_DPRINTF) { \
695+
char *__blkbuf = kmem_alloc(BP_SPRINTF_LEN, KM_PUSHPAGE); \
696+
sprintf_blkptr(__blkbuf, (bp)); \
697+
dprintf(fmt " %s\n", __VA_ARGS__, __blkbuf); \
698+
kmem_free(__blkbuf, BP_SPRINTF_LEN); \
699699
} \
700700
_NOTE(CONSTCOND) } while (0)
701701
#else

module/zcommon/zprop_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ zprop_iter_common(zprop_func func, void *cb, boolean_t show_all,
171171
size = num_props * sizeof (zprop_desc_t *);
172172

173173
#if defined(_KERNEL)
174-
order = kmem_alloc(size, KM_SLEEP);
174+
order = kmem_alloc(size, KM_PUSHPAGE);
175175
#else
176176
if ((order = malloc(size)) == NULL)
177177
return (ZPROP_CONT);

module/zfs/arc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3547,7 +3547,7 @@ arc_write(zio_t *pio, spa_t *spa, uint64_t txg,
35473547
ASSERT(hdr->b_acb == NULL);
35483548
if (l2arc)
35493549
hdr->b_flags |= ARC_L2CACHE;
3550-
callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_SLEEP);
3550+
callback = kmem_zalloc(sizeof (arc_write_callback_t), KM_PUSHPAGE);
35513551
callback->awcb_ready = ready;
35523552
callback->awcb_done = done;
35533553
callback->awcb_private = private;

module/zfs/bplist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bplist_destroy(bplist_t *bpl)
4444
void
4545
bplist_append(bplist_t *bpl, const blkptr_t *bp)
4646
{
47-
bplist_entry_t *bpe = kmem_alloc(sizeof (*bpe), KM_SLEEP);
47+
bplist_entry_t *bpe = kmem_alloc(sizeof (*bpe), KM_PUSHPAGE);
4848

4949
mutex_enter(&bpl->bpl_lock);
5050
bpe->bpe_blk = *bp;

module/zfs/dbuf.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ dbuf_init(void)
298298
#if defined(_KERNEL) && defined(HAVE_SPL)
299299
/* Large allocations which do not require contiguous pages
300300
* should be using vmem_alloc() in the linux kernel */
301-
h->hash_table = vmem_zalloc(hsize * sizeof (void *), KM_SLEEP);
301+
h->hash_table = vmem_zalloc(hsize * sizeof (void *), KM_PUSHPAGE);
302302
#else
303303
h->hash_table = kmem_zalloc(hsize * sizeof (void *), KM_NOSLEEP);
304304
#endif
@@ -1719,7 +1719,7 @@ dbuf_create(dnode_t *dn, uint8_t level, uint64_t blkid,
17191719
ASSERT(RW_LOCK_HELD(&dn->dn_struct_rwlock));
17201720
ASSERT(dn->dn_type != DMU_OT_NONE);
17211721

1722-
db = kmem_cache_alloc(dbuf_cache, KM_SLEEP);
1722+
db = kmem_cache_alloc(dbuf_cache, KM_PUSHPAGE);
17231723

17241724
db->db_objset = os;
17251725
db->db.db_object = dn->dn_object;
@@ -2019,7 +2019,7 @@ dbuf_hold_impl(dnode_t *dn, uint8_t level, uint64_t blkid, int fail_sparse,
20192019
int error;
20202020

20212021
dh = kmem_zalloc(sizeof(struct dbuf_hold_impl_data) *
2022-
DBUF_HOLD_IMPL_MAX_DEPTH, KM_SLEEP);
2022+
DBUF_HOLD_IMPL_MAX_DEPTH, KM_PUSHPAGE);
20232023
__dbuf_hold_impl_init(dh, dn, level, blkid, fail_sparse, tag, dbp, 0);
20242024

20252025
error = __dbuf_hold_impl(dh);

module/zfs/ddt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ ddt_get_dedup_stats(spa_t *spa, ddt_stat_t *dds_total)
504504
ddt_histogram_t *ddh_total;
505505

506506
/* XXX: Move to a slab */
507-
ddh_total = kmem_zalloc(sizeof (ddt_histogram_t), KM_SLEEP);
507+
ddh_total = kmem_zalloc(sizeof (ddt_histogram_t), KM_PUSHPAGE);
508508
ddt_get_dedup_histogram(spa, ddh_total);
509509
ddt_histogram_stat(dds_total, ddh_total);
510510
kmem_free(ddh_total, sizeof (ddt_histogram_t));

module/zfs/dmu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ dmu_buf_hold_array_by_dnode(dnode_t *dn, uint64_t offset, uint64_t length,
381381
}
382382
nblks = 1;
383383
}
384-
dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks, KM_SLEEP | KM_NODEBUG);
384+
dbp = kmem_zalloc(sizeof (dmu_buf_t *) * nblks, KM_PUSHPAGE | KM_NODEBUG);
385385

386386
if (dn->dn_objset->os_dsl_dataset)
387387
dp = dn->dn_objset->os_dsl_dataset->ds_dir->dd_pool;
@@ -863,11 +863,11 @@ dmu_xuio_init(xuio_t *xuio, int nblk)
863863
uio_t *uio = &xuio->xu_uio;
864864

865865
uio->uio_iovcnt = nblk;
866-
uio->uio_iov = kmem_zalloc(nblk * sizeof (iovec_t), KM_SLEEP);
866+
uio->uio_iov = kmem_zalloc(nblk * sizeof (iovec_t), KM_PUSHPAGE);
867867

868-
priv = kmem_zalloc(sizeof (dmu_xuio_t), KM_SLEEP);
868+
priv = kmem_zalloc(sizeof (dmu_xuio_t), KM_PUSHPAGE);
869869
priv->cnt = nblk;
870-
priv->bufs = kmem_zalloc(nblk * sizeof (arc_buf_t *), KM_SLEEP);
870+
priv->bufs = kmem_zalloc(nblk * sizeof (arc_buf_t *), KM_PUSHPAGE);
871871
priv->iovp = uio->uio_iov;
872872
XUIO_XUZC_PRIV(xuio) = priv;
873873

@@ -1431,7 +1431,7 @@ dmu_sync_late_arrival(zio_t *pio, objset_t *os, dmu_sync_cb_t *done, zgd_t *zgd,
14311431
return (EIO); /* Make zl_get_data do txg_waited_synced() */
14321432
}
14331433

1434-
dsa = kmem_alloc(sizeof (dmu_sync_arg_t), KM_SLEEP);
1434+
dsa = kmem_alloc(sizeof (dmu_sync_arg_t), KM_PUSHPAGE);
14351435
dsa->dsa_dr = NULL;
14361436
dsa->dsa_done = done;
14371437
dsa->dsa_zgd = zgd;
@@ -1555,7 +1555,7 @@ dmu_sync(zio_t *pio, uint64_t txg, dmu_sync_cb_t *done, zgd_t *zgd)
15551555
dr->dt.dl.dr_override_state = DR_IN_DMU_SYNC;
15561556
mutex_exit(&db->db_mtx);
15571557

1558-
dsa = kmem_alloc(sizeof (dmu_sync_arg_t), KM_SLEEP);
1558+
dsa = kmem_alloc(sizeof (dmu_sync_arg_t), KM_PUSHPAGE);
15591559
dsa->dsa_dr = dr;
15601560
dsa->dsa_done = done;
15611561
dsa->dsa_zgd = zgd;

module/zfs/dmu_objset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ dmu_objset_open_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
262262

263263
ASSERT(ds == NULL || MUTEX_HELD(&ds->ds_opening_lock));
264264

265-
os = kmem_zalloc(sizeof (objset_t), KM_SLEEP);
265+
os = kmem_zalloc(sizeof (objset_t), KM_PUSHPAGE);
266266
os->os_dsl_dataset = ds;
267267
os->os_spa = spa;
268268
os->os_rootbp = bp;

module/zfs/dmu_traverse.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,9 @@ traverse_impl(spa_t *spa, dsl_dataset_t *ds, blkptr_t *rootbp,
361361
zbookmark_t *czb;
362362
int err;
363363

364-
td = kmem_alloc(sizeof(traverse_data_t), KM_SLEEP);
365-
pd = kmem_zalloc(sizeof(prefetch_data_t), KM_SLEEP);
366-
czb = kmem_alloc(sizeof(zbookmark_t), KM_SLEEP);
364+
td = kmem_alloc(sizeof(traverse_data_t), KM_PUSHPAGE);
365+
pd = kmem_zalloc(sizeof(prefetch_data_t), KM_PUSHPAGE);
366+
czb = kmem_alloc(sizeof(zbookmark_t), KM_PUSHPAGE);
367367

368368
td->td_spa = spa;
369369
td->td_objset = ds ? ds->ds_object : 0;

module/zfs/dmu_tx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static kstat_t *dmu_tx_ksp;
6363
dmu_tx_t *
6464
dmu_tx_create_dd(dsl_dir_t *dd)
6565
{
66-
dmu_tx_t *tx = kmem_zalloc(sizeof (dmu_tx_t), KM_SLEEP);
66+
dmu_tx_t *tx = kmem_zalloc(sizeof (dmu_tx_t), KM_PUSHPAGE);
6767
tx->tx_dir = dd;
6868
if (dd)
6969
tx->tx_pool = dd->dd_pool;
@@ -141,7 +141,7 @@ dmu_tx_hold_object_impl(dmu_tx_t *tx, objset_t *os, uint64_t object,
141141
}
142142
}
143143

144-
txh = kmem_zalloc(sizeof (dmu_tx_hold_t), KM_SLEEP);
144+
txh = kmem_zalloc(sizeof (dmu_tx_hold_t), KM_PUSHPAGE);
145145
txh->txh_tx = tx;
146146
txh->txh_dnode = dn;
147147
#ifdef DEBUG_DMU_TX
@@ -1241,7 +1241,7 @@ dmu_tx_callback_register(dmu_tx_t *tx, dmu_tx_callback_func_t *func, void *data)
12411241
{
12421242
dmu_tx_callback_t *dcb;
12431243

1244-
dcb = kmem_alloc(sizeof (dmu_tx_callback_t), KM_SLEEP);
1244+
dcb = kmem_alloc(sizeof (dmu_tx_callback_t), KM_PUSHPAGE);
12451245

12461246
dcb->dcb_func = func;
12471247
dcb->dcb_data = data;

module/zfs/dmu_zfetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ dmu_zfetch(zfetch_t *zf, uint64_t offset, uint64_t size, int prefetched)
699699
if (cur_streams >= max_streams) {
700700
return;
701701
}
702-
newstream = kmem_zalloc(sizeof (zstream_t), KM_SLEEP);
702+
newstream = kmem_zalloc(sizeof (zstream_t), KM_PUSHPAGE);
703703
}
704704

705705
newstream->zst_offset = zst.zst_offset;

module/zfs/dnode.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ static dnode_t *
372372
dnode_create(objset_t *os, dnode_phys_t *dnp, dmu_buf_impl_t *db,
373373
uint64_t object, dnode_handle_t *dnh)
374374
{
375-
dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_SLEEP);
375+
dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_PUSHPAGE);
376376

377377
ASSERT(!POINTER_IS_VALID(dn->dn_objset));
378378
dn->dn_moved = 0;
@@ -1491,7 +1491,7 @@ dnode_clear_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx)
14911491
} else if (blkid > rp->fr_blkid && endblk < fr_endblk) {
14921492
/* clear a chunk out of this range */
14931493
free_range_t *new_rp =
1494-
kmem_alloc(sizeof (free_range_t), KM_SLEEP);
1494+
kmem_alloc(sizeof (free_range_t), KM_PUSHPAGE);
14951495

14961496
new_rp->fr_blkid = endblk;
14971497
new_rp->fr_nblks = fr_endblk - endblk;
@@ -1669,7 +1669,7 @@ dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx)
16691669
avl_tree_t *tree = &dn->dn_ranges[tx->tx_txg&TXG_MASK];
16701670

16711671
/* Add new range to dn_ranges */
1672-
rp = kmem_alloc(sizeof (free_range_t), KM_SLEEP);
1672+
rp = kmem_alloc(sizeof (free_range_t), KM_PUSHPAGE);
16731673
rp->fr_blkid = blkid;
16741674
rp->fr_nblks = nblks;
16751675
found = avl_find(tree, rp, &where);

module/zfs/dsl_dataset.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ dsl_dataset_get_ref(dsl_pool_t *dp, uint64_t dsobj, void *tag,
390390
if (ds == NULL) {
391391
dsl_dataset_t *winner = NULL;
392392

393-
ds = kmem_zalloc(sizeof (dsl_dataset_t), KM_SLEEP);
393+
ds = kmem_zalloc(sizeof (dsl_dataset_t), KM_PUSHPAGE);
394394
ds->ds_dbuf = dbuf;
395395
ds->ds_object = dsobj;
396396
ds->ds_phys = dbuf->db_data;

module/zfs/dsl_deadlist.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ dsl_deadlist_load_tree(dsl_deadlist_t *dl)
8080
for (zap_cursor_init(&zc, dl->dl_os, dl->dl_object);
8181
zap_cursor_retrieve(&zc, &za) == 0;
8282
zap_cursor_advance(&zc)) {
83-
dsl_deadlist_entry_t *dle = kmem_alloc(sizeof (*dle), KM_SLEEP);
83+
dsl_deadlist_entry_t *dle;
84+
85+
dle = kmem_alloc(sizeof (*dle), KM_PUSHPAGE);
8486
dle->dle_mintxg = strtonum(za.za_name, NULL);
8587
VERIFY3U(0, ==, bpobj_open(&dle->dle_bpobj, dl->dl_os,
8688
za.za_first_integer));
@@ -215,7 +217,7 @@ dsl_deadlist_add_key(dsl_deadlist_t *dl, uint64_t mintxg, dmu_tx_t *tx)
215217

216218
dsl_deadlist_load_tree(dl);
217219

218-
dle = kmem_alloc(sizeof (*dle), KM_SLEEP);
220+
dle = kmem_alloc(sizeof (*dle), KM_PUSHPAGE);
219221
dle->dle_mintxg = mintxg;
220222
obj = bpobj_alloc(dl->dl_os, SPA_MAXBLOCKSIZE, tx);
221223
VERIFY3U(0, ==, bpobj_open(&dle->dle_bpobj, dl->dl_os, obj));

module/zfs/dsl_dir.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ dsl_dir_open_obj(dsl_pool_t *dp, uint64_t ddobj,
9696
if (dd == NULL) {
9797
dsl_dir_t *winner;
9898

99-
dd = kmem_zalloc(sizeof (dsl_dir_t), KM_SLEEP);
99+
dd = kmem_zalloc(sizeof (dsl_dir_t), KM_PUSHPAGE);
100100
dd->dd_object = ddobj;
101101
dd->dd_dbuf = dbuf;
102102
dd->dd_pool = dp;
@@ -791,7 +791,7 @@ dsl_dir_tempreserve_impl(dsl_dir_t *dd, uint64_t asize, boolean_t netfree,
791791
asize - ref_rsrv);
792792
mutex_exit(&dd->dd_lock);
793793

794-
tr = kmem_zalloc(sizeof (struct tempreserve), KM_SLEEP);
794+
tr = kmem_zalloc(sizeof (struct tempreserve), KM_PUSHPAGE);
795795
tr->tr_ds = dd;
796796
tr->tr_size = asize;
797797
list_insert_tail(tr_list, tr);
@@ -825,7 +825,7 @@ dsl_dir_tempreserve_space(dsl_dir_t *dd, uint64_t lsize, uint64_t asize,
825825
return (0);
826826
}
827827

828-
tr_list = kmem_alloc(sizeof (list_t), KM_SLEEP);
828+
tr_list = kmem_alloc(sizeof (list_t), KM_PUSHPAGE);
829829
list_create(tr_list, sizeof (struct tempreserve),
830830
offsetof(struct tempreserve, tr_node));
831831
ASSERT3S(asize, >, 0);
@@ -835,7 +835,7 @@ dsl_dir_tempreserve_space(dsl_dir_t *dd, uint64_t lsize, uint64_t asize,
835835
if (err == 0) {
836836
struct tempreserve *tr;
837837

838-
tr = kmem_zalloc(sizeof (struct tempreserve), KM_SLEEP);
838+
tr = kmem_zalloc(sizeof (struct tempreserve), KM_PUSHPAGE);
839839
tr->tr_size = lsize;
840840
list_insert_tail(tr_list, tr);
841841

@@ -851,7 +851,7 @@ dsl_dir_tempreserve_space(dsl_dir_t *dd, uint64_t lsize, uint64_t asize,
851851
if (err == 0) {
852852
struct tempreserve *tr;
853853

854-
tr = kmem_zalloc(sizeof (struct tempreserve), KM_SLEEP);
854+
tr = kmem_zalloc(sizeof (struct tempreserve), KM_PUSHPAGE);
855855
tr->tr_dp = dd->dd_pool;
856856
tr->tr_size = asize;
857857
list_insert_tail(tr_list, tr);

module/zfs/dsl_prop.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ dsl_prop_register(dsl_dataset_t *ds, const char *propname,
247247
return (err);
248248
}
249249

250-
cbr = kmem_alloc(sizeof (dsl_prop_cb_record_t), KM_SLEEP);
250+
cbr = kmem_alloc(sizeof (dsl_prop_cb_record_t), KM_PUSHPAGE);
251251
cbr->cbr_ds = ds;
252-
cbr->cbr_propname = kmem_alloc(strlen(propname)+1, KM_SLEEP);
252+
cbr->cbr_propname = kmem_alloc(strlen(propname)+1, KM_PUSHPAGE);
253253
(void) strcpy((char *)cbr->cbr_propname, propname);
254254
cbr->cbr_func = callback;
255255
cbr->cbr_arg = cbarg;
@@ -534,7 +534,7 @@ dsl_prop_changed_notify(dsl_pool_t *dp, uint64_t ddobj,
534534
}
535535
mutex_exit(&dd->dd_lock);
536536

537-
za = kmem_alloc(sizeof (zap_attribute_t), KM_SLEEP);
537+
za = kmem_alloc(sizeof (zap_attribute_t), KM_PUSHPAGE);
538538
for (zap_cursor_init(&zc, mos,
539539
dd->dd_phys->dd_child_dir_zapobj);
540540
zap_cursor_retrieve(&zc, za) == 0;

module/zfs/lzjb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ lzjb_compress(void *s_start, void *d_start, size_t s_len, size_t d_len, int n)
5656
uint16_t *hp;
5757
uint16_t *lempel;
5858

59-
lempel = kmem_zalloc(LEMPEL_SIZE * sizeof (uint16_t), KM_SLEEP);
59+
lempel = kmem_zalloc(LEMPEL_SIZE * sizeof (uint16_t), KM_PUSHPAGE);
6060
while (src < (uchar_t *)s_start + s_len) {
6161
if ((copymask <<= 1) == (1 << NBBY)) {
6262
if (dst >= (uchar_t *)d_start + d_len - 1 - 2 * NBBY) {

module/zfs/metaslab.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ metaslab_class_create(spa_t *spa, space_map_ops_t *ops)
102102
{
103103
metaslab_class_t *mc;
104104

105-
mc = kmem_zalloc(sizeof (metaslab_class_t), KM_SLEEP);
105+
mc = kmem_zalloc(sizeof (metaslab_class_t), KM_PUSHPAGE);
106106

107107
mc->mc_spa = spa;
108108
mc->mc_rotor = NULL;
@@ -217,7 +217,7 @@ metaslab_group_create(metaslab_class_t *mc, vdev_t *vd)
217217
{
218218
metaslab_group_t *mg;
219219

220-
mg = kmem_zalloc(sizeof (metaslab_group_t), KM_SLEEP);
220+
mg = kmem_zalloc(sizeof (metaslab_group_t), KM_PUSHPAGE);
221221
mutex_init(&mg->mg_lock, NULL, MUTEX_DEFAULT, NULL);
222222
avl_create(&mg->mg_metaslab_tree, metaslab_compare,
223223
sizeof (metaslab_t), offsetof(struct metaslab, ms_group_node));
@@ -422,9 +422,9 @@ metaslab_pp_load(space_map_t *sm)
422422
space_seg_t *ss;
423423

424424
ASSERT(sm->sm_ppd == NULL);
425-
sm->sm_ppd = kmem_zalloc(64 * sizeof (uint64_t), KM_SLEEP);
425+
sm->sm_ppd = kmem_zalloc(64 * sizeof (uint64_t), KM_PUSHPAGE);
426426

427-
sm->sm_pp_root = kmem_alloc(sizeof (avl_tree_t), KM_SLEEP);
427+
sm->sm_pp_root = kmem_alloc(sizeof (avl_tree_t), KM_PUSHPAGE);
428428
avl_create(sm->sm_pp_root, metaslab_segsize_compare,
429429
sizeof (space_seg_t), offsetof(struct space_seg, ss_pp_node));
430430

@@ -725,7 +725,7 @@ metaslab_init(metaslab_group_t *mg, space_map_obj_t *smo,
725725
vdev_t *vd = mg->mg_vd;
726726
metaslab_t *msp;
727727

728-
msp = kmem_zalloc(sizeof (metaslab_t), KM_SLEEP);
728+
msp = kmem_zalloc(sizeof (metaslab_t), KM_PUSHPAGE);
729729
mutex_init(&msp->ms_lock, NULL, MUTEX_DEFAULT, NULL);
730730

731731
msp->ms_smo_syncing = *smo;

0 commit comments

Comments
 (0)