aboutsummaryrefslogtreecommitdiffstats
path: root/include/sys/kmem.h
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-07-13 21:30:56 -0700
committerBrian Behlendorf <[email protected]>2010-07-13 21:30:56 -0700
commit82b8c8fa64737edfb203156b245b48840139d2c1 (patch)
treec8299064646021889d84d0aa4e07776a2ba7f4f7 /include/sys/kmem.h
parenta4bfd8ea1b58d8797ec91b18982de243675e63bc (diff)
Proposed fix for low memory ZFS deadlocks
Deadlocks in the zvol were observed when one of the ZFS threads performing IO trys to allocate memory while the system is low on memory. The low memory condition causes dirty pages to be synced to the zvol but this can't progress because the original thread is blocked waiting on a memory allocation. Thus we end up deadlocking. A proper solution proposed by Wizeman is to change KM_SLEEP from GFP_KERNEL top GFP_NOFS. This will prevent the memory allocation which is trying to allocate memory from forcing a sync to the zvol in shrink_page_list()->pageout(). The down side to all of this is that we are using a pretty big hammer by changing KM_SLEEP. This change means ALL of the zfs memory allocations will be until to trigger dirty data to be synced. The caller still should be able to reclaim memory from the various slab caches. We will be totally dependent of other kernel processes which happen to be running and a small number of asynchronous reclaim threads to trigger the reclaim of dirty data pages. This should be OK but I think we may see some slightly longer allocation times when under memory pressure. We shall see.
Diffstat (limited to 'include/sys/kmem.h')
-rw-r--r--include/sys/kmem.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sys/kmem.h b/include/sys/kmem.h
index 9688b116d..a5758bd61 100644
--- a/include/sys/kmem.h
+++ b/include/sys/kmem.h
@@ -42,7 +42,7 @@
/*
* Memory allocation interfaces
*/
-#define KM_SLEEP GFP_KERNEL
+#define KM_SLEEP GFP_NOFS
#define KM_NOSLEEP GFP_ATOMIC
#undef KM_PANIC /* No linux analog */
#define KM_PUSHPAGE (KM_SLEEP | __GFP_HIGH)