#define list_to_maps_list(list_head) \
container_of((list_head), struct maps_list, list)
+#define BITRANGE(first, last) (((2ll << (last - first)) - 1) << first)
+
struct pageframe {
struct bintree tree;
struct maps_list ml; /* List to mappings which point to this pfn */
- unsigned long pfn; /* page frame number */
- int swap_type;
- int swap_offset;
- int page_shift;
- int page_swapped;
- int page_present;
+
+ unsigned long long pf; /* page frame entry from /proc/pid/pagemap */
+
int refcount;
};
#define tree_to_pageframe(tree_struct) \
container_of((tree_struct), struct pageframe, tree)
+static inline int page_present(struct pageframe *p)
+{
+ return !!(BITRANGE(63, 63) & p->pf);
+}
+
+static inline int page_swapped(struct pageframe *p)
+{
+ return !!(BITRANGE(62, 62) & p->pf);
+}
+
+static inline int page_shift(struct pageframe *p)
+{
+ return (BITRANGE(55, 60) & p->pf) >> 55;
+}
+
+static inline long int pfn(struct pageframe *p)
+{
+ return (BITRANGE(0, 54) & p->pf);
+}
+
+static inline int swap_type(struct pageframe *p)
+{
+ return (BITRANGE(0, 4) & p->pf);
+}
+
+static inline int swap_offset(struct pageframe *p)
+{
+ return (BITRANGE(5, 54) & p->pf) >> 5;
+}
+
struct maps {
struct list_head list;