Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / libcfs / include / libcfs / linux / linux-mem.h
index 21a17d9..8fb2184 100644 (file)
@@ -16,8 +16,8 @@
  * in the LICENSE file that accompanied this code).
  *
  * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see [sun.com URL with a
- * copy of GPLv2].
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
  *
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  * CA 95054 USA or visit www.sun.com if you need additional information or
@@ -47,7 +47,7 @@
 
 #ifndef __KERNEL__
 #error This include is only for kernel use.
-#endif 
+#endif
 
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
@@ -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.
@@ -129,6 +133,7 @@ extern cfs_mem_cache_t * cfs_mem_cache_create (const char *, size_t, size_t, uns
 extern int cfs_mem_cache_destroy ( cfs_mem_cache_t * );
 extern void *cfs_mem_cache_alloc ( cfs_mem_cache_t *, int);
 extern void cfs_mem_cache_free ( cfs_mem_cache_t *, void *);
+extern int cfs_mem_is_in_cache(const void *addr, const cfs_mem_cache_t *kmem);
 
 /*
  */