Whamcloud - gitweb
LU-9859 libcfs: replace memory_presure functions by standard interfaces
[fs/lustre-release.git] / libcfs / include / libcfs / libcfs_prim.h
index 6ad1ecb..c753ab5 100644 (file)
 #if BITS_PER_LONG == 32
 /* limit to lowmem on 32-bit systems */
 # define NUM_CACHEPAGES \
-       min(totalram_pages, 1UL << (30 - PAGE_SHIFT) * 3 / 4)
+       min(cfs_totalram_pages(), 1UL << (30 - PAGE_SHIFT) * 3 / 4)
 #else
-# define NUM_CACHEPAGES totalram_pages
+# define NUM_CACHEPAGES cfs_totalram_pages()
 #endif
 
-static inline unsigned int memory_pressure_get(void)
-{
-       return current->flags & PF_MEMALLOC;
-}
-
-static inline void memory_pressure_set(void)
-{
-       current->flags |= PF_MEMALLOC;
-}
-
-static inline void memory_pressure_clr(void)
-{
-       current->flags &= ~PF_MEMALLOC;
-}
-
-static inline int cfs_memory_pressure_get_and_set(void)
-{
-       int old = memory_pressure_get();
-
-       if (!old)
-               memory_pressure_set();
-       return old;
-}
-
-static inline void cfs_memory_pressure_restore(int old)
-{
-       if (old)
-               memory_pressure_set();
-       else
-               memory_pressure_clr();
-       return;
-}
 #endif