staging: lustre: libcfs: move memory_pressure functions to libcfs_prim.h
authorJames Simmons <jsimmons@infradead.org>
Thu, 31 Mar 2016 14:18:36 +0000 (10:18 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Mar 2016 20:04:45 +0000 (13:04 -0700)
Long ago libcfs_prim.h was used for userland code which is why
memory_pressure_*() handling is in both libcfs_prim.h and
linux-mem.h headers. So lets just move the memory_pressure_*()
to libcfs_prim.h.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/13841
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/libcfs_prim.h
drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h

index d7846e86f9258fcae1aa1dfbde78024c00919030..d97060b8be74414f17193845216f3a1b2334be8f 100644 (file)
 /*
  * Memory
  */
-#ifndef memory_pressure_get
-#define memory_pressure_get() (0)
-#endif
-#ifndef memory_pressure_set
-#define memory_pressure_set() do {} while (0)
-#endif
-#ifndef memory_pressure_clr
-#define memory_pressure_clr() do {} while (0)
-#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)
 {
index 448379b2a01ec15f824b5900a5b6124808462d6a..c50ef8352b10e58b19872a1f5c5ecf659ddff2ad 100644 (file)
 
 #define page_index(p)       ((p)->index)
 
-#define memory_pressure_get() (current->flags & PF_MEMALLOC)
-#define memory_pressure_set() do { current->flags |= PF_MEMALLOC; } while (0)
-#define memory_pressure_clr() do { current->flags &= ~PF_MEMALLOC; } while (0)
-
 #if BITS_PER_LONG == 32
 /* limit to lowmem on 32-bit systems */
 #define NUM_CACHEPAGES \