aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/arc.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-03-19 14:34:30 -0700
committerBrian Behlendorf <[email protected]>2011-03-22 12:14:55 -0700
commit691f6ac4c2858d64afc2a0dc1bd2b8c041d68502 (patch)
tree97cd5916e20c2f6dbc535246c86a4947f1aeabb8 /module/zfs/arc.c
parentf47c42e2143ccf83bb5ddca4251c9db14859a0b5 (diff)
Use KM_PUSHPAGE instead of KM_SLEEP
It used to be the case that all KM_SLEEP allocations were GFS_NOFS. Unfortunately this often resulted in the kernel being unable to reclaim the ARC, inode, and dentry caches in a timely manor. The fix was to make KM_SLEEP a GFP_KERNEL allocation in the SPL. However, this increases the posibility of deadlocking the system on a zfs write thread. If a zfs write thread attempts to perform an allocation it may trigger synchronous reclaim. This reclaim may attempt to flush dirty data/inode to disk to free memory. Unforunately, this write cannot finish because the write thread which would handle it is holding the previous transaction open. Deadlock. To avoid this all allocations in the zfs write thread path must use KM_PUSHPAGE which prohibits synchronous reclaim for that thread. In this way forward progress in ensured. The risk with this change is I missed updating an allocation for the write threads leaving an increased posibility of deadlock. If any deadlocks remain they will be unlikely but we'll have to make sure they all get fixed.
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r--module/zfs/arc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 808c8e8df..3a4573027 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -2720,7 +2720,7 @@ top:
arc_callback_t *acb = NULL;
acb = kmem_zalloc(sizeof (arc_callback_t),
- KM_SLEEP);
+ KM_PUSHPAGE);
acb->acb_done = done;
acb->acb_private = private;
if (pio != NULL)
@@ -2836,7 +2836,7 @@ top:
ASSERT(!GHOST_STATE(hdr->b_state));
- acb = kmem_zalloc(sizeof (arc_callback_t), KM_SLEEP);
+ acb = kmem_zalloc(sizeof (arc_callback_t), KM_PUSHPAGE);
acb->acb_done = done;
acb->acb_private = private;
@@ -2885,7 +2885,7 @@ top:
ARCSTAT_BUMP(arcstat_l2_hits);
cb = kmem_zalloc(sizeof (l2arc_read_callback_t),
- KM_SLEEP);
+ KM_PUSHPAGE);
cb->l2rcb_buf = buf;
cb->l2rcb_spa = spa;
cb->l2rcb_bp = *bp;