+/*
+ * Memory
+ */
+#if BITS_PER_LONG == 32
+/* limit to lowmem on 32-bit systems */
+#define NUM_CACHEPAGES \
+ min(cfs_totalram_pages(), 1UL << (30 - PAGE_SHIFT) * 3 / 4)
+#else
+#define NUM_CACHEPAGES cfs_totalram_pages()
+#endif
+
+#define wait_var_event_warning(var, condition, format, ...) \
+do { \
+ int counter = 4; \
+ might_sleep(); \
+ if (condition) \
+ break; \
+ ___wait_var_event(var, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
+ if (schedule_timeout(cfs_time_seconds(1)) == 0)\
+ CDEBUG(is_power_of_2(counter++) ? \
+ D_WARNING : D_NET, \
+ format, ## __VA_ARGS__) \
+ ); \
+} while (0)
+
+/* atomic-context safe vfree */
+void libcfs_vfree_atomic(const void *addr);
+
+/* interval tree */
+
+#ifdef HAVE_INTERVAL_TREE_CACHED
+#define interval_tree_root rb_root_cached
+#define INTERVAL_TREE_ROOT RB_ROOT_CACHED
+#else
+#define interval_tree_root rb_root
+#define INTERVAL_TREE_ROOT RB_ROOT
+#endif /* HAVE_INTERVAL_TREE_CACHED */
+