mm: let swap use exceptional entries
[pandora-kernel.git] / include / linux / swapops.h
index cd42e30..2189d3f 100644 (file)
@@ -1,3 +1,8 @@
+#ifndef _LINUX_SWAPOPS_H
+#define _LINUX_SWAPOPS_H
+
+#include <linux/radix-tree.h>
+
 /*
  * swapcache pages are stored in the swapper_space radix tree.  We want to
  * get good packing density in that tree, so the index should be dense in
@@ -76,6 +81,22 @@ static inline pte_t swp_entry_to_pte(swp_entry_t entry)
        return __swp_entry_to_pte(arch_entry);
 }
 
+static inline swp_entry_t radix_to_swp_entry(void *arg)
+{
+       swp_entry_t entry;
+
+       entry.val = (unsigned long)arg >> RADIX_TREE_EXCEPTIONAL_SHIFT;
+       return entry;
+}
+
+static inline void *swp_to_radix_entry(swp_entry_t entry)
+{
+       unsigned long value;
+
+       value = entry.val << RADIX_TREE_EXCEPTIONAL_SHIFT;
+       return (void *)(value | RADIX_TREE_EXCEPTIONAL_ENTRY);
+}
+
 #ifdef CONFIG_MIGRATION
 static inline swp_entry_t make_migration_entry(struct page *page, int write)
 {
@@ -169,3 +190,5 @@ static inline int non_swap_entry(swp_entry_t entry)
        return 0;
 }
 #endif
+
+#endif /* _LINUX_SWAPOPS_H */