Whamcloud - gitweb
b=19529
authordzogin <dzogin>
Wed, 15 Jul 2009 13:20:56 +0000 (13:20 +0000)
committerdzogin <dzogin>
Wed, 15 Jul 2009 13:20:56 +0000 (13:20 +0000)
i=andrew.perepechko
i=adilger
Description: Avoid deadlock for local client writes
Details    : Use new OBD_BRW_MEMALLOC flag to notify OST about writes in the
     memory freeing context. This allows OST threads to set the
     PF_MEMALLOC flag on task structures in order to allocate memory
     from reserved pools and complete IO.
     Use GFP_HIGHUSER for OST allocations for non-local client writes,
     so that the OST threads generate memory pressure and allow
     inactive pages to be reclaimed.

lnet/include/libcfs/linux/linux-mem.h

index d538ff0..8f0de46 100644 (file)
@@ -110,6 +110,10 @@ extern void __cfs_free_pages(cfs_page_t *page, unsigned int order);
 #define __cfs_free_page(page)  __cfs_free_pages(page, 0)
 #define cfs_free_page(p)       __free_pages(p, 0)
 
+#define libcfs_memory_pressure_get() (current->flags & PF_MEMALLOC)
+#define libcfs_memory_pressure_set() do { current->flags |= PF_MEMALLOC; } while(0)
+#define libcfs_memory_pressure_clr() do { current->flags &= ~PF_MEMALLOC; } while (0)
+
 /*
  * In Linux there is no way to determine whether current execution context is
  * blockable.