Frontswap [PATCH 3/4] (was Transcendent Memory): add hooks in swap subsystem
Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Diffstat:
page_io.c | 12 ++++
swap.c | 4 +
swapfile.c | 58 +++++++++++++++++----
3 files changed, 65 insertions(+), 9 deletions(-)
--- linux-2.6.34-rc5/mm/swapfile.c 2010-04-19 17:29:56.000000000 -0600
+++ linux-2.6.34-rc5-frontswap/mm/swapfile.c 2010-04-21 09:37:03.000000000 -0600
@@ -35,13 +35,15 @@
#include <asm/tlbflush.h>
#include <linux/swapops.h>
#include <linux/page_cgroup.h>
+#include <linux/frontswap.h>
+#include <linux/swapfile.h>
static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
unsigned char);
static void free_swap_count_continuations(struct swap_info_struct *);
static sector_t map_swap_entry(swp_entry_t, struct block_device**);
-static DEFINE_SPINLOCK(swap_lock);
+DEFINE_SPINLOCK(swap_lock);
static unsigned int nr_swapfiles;
long nr_swap_pages;
long total_swap_pages;
@@ -52,9 +54,9 @@ static const char Unused_file[] = "Unuse
static const char Bad_offset[] = "Bad swap offset entry ";
static const char Unused_offset[] = "Unused swap offset entry ";
-static struct swap_list_t swap_list = {-1, -1};
+struct swap_list_t swap_list = {-1, -1};
-static struct swap_info_struct *swap_info[MAX_SWAPFILES];
+struct swap_info_struct *swap_info[MAX_SWAPFILES];
static DEFINE_MUTEX(swapon_mutex);
@@ -583,6 +585,7 @@ static unsigned char swap_entry_free(str
swap_list.next = p->type;
nr_swap_pages++;
p->inuse_pages--;
+ frontswap_flush_page(p->type, offset);
}
return usage;
@@ -1025,7 +1028,7 @@ static int unuse_mm(struct mm_struct *mm
* Recycle to start on reaching the end, returning 0 when empty.
*/
static unsigned int find_next_to_unuse(struct swap_info_struct *si,
- unsigned int prev)
+ unsigned int prev, bool frontswap)
{
unsigned int ...