diff options
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index 0341c5700e3..41a00cead75 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -31,12 +31,16 @@ #include <linux/syscalls.h> #include <linux/memcontrol.h> #include <linux/poll.h> +#include <trace/swap.h> #include <asm/pgtable.h> #include <asm/tlbflush.h> #include <linux/swapops.h> #include <linux/page_cgroup.h> +DEFINE_TRACE(swap_file_open); +DEFINE_TRACE(swap_file_close); + static bool swap_count_continued(struct swap_info_struct *, pgoff_t, unsigned char); static void free_swap_count_continuations(struct swap_info_struct *); @@ -1669,6 +1673,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) swap_map = p->swap_map; p->swap_map = NULL; p->flags = 0; + trace_swap_file_close(swap_file); spin_unlock(&swap_lock); mutex_unlock(&swapon_mutex); vfree(swap_map); @@ -2129,6 +2134,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) swap_list.head = swap_list.next = type; else swap_info[prev]->next = type; + trace_swap_file_open(swap_file, name); spin_unlock(&swap_lock); mutex_unlock(&swapon_mutex); atomic_inc(&proc_poll_event); @@ -2280,6 +2286,13 @@ int swap_duplicate(swp_entry_t entry) return err; } +struct swap_info_struct * +get_swap_info_struct(unsigned type) +{ + return swap_info[type]; +} +EXPORT_SYMBOL_GPL(get_swap_info_struct); + /* * @entry: swap entry for which we allocate swap cache. * @@ -2560,3 +2573,22 @@ static void free_swap_count_continuations(struct swap_info_struct *si) } } } + +void ltt_dump_swap_files(void *call_data) +{ + int type; + struct swap_info_struct *p = NULL; + + mutex_lock(&swapon_mutex); + for (type = swap_list.head; type >= 0; type = swap_info[type]->next) { + p = swap_info[type]; + if (!(p->flags & SWP_WRITEOK)) + continue; + __trace_mark(0, swap_state, statedump_swap_files, call_data, + "filp %p vfsmount %p dname %s", + p->swap_file, p->swap_file->f_vfsmnt, + p->swap_file->f_dentry->d_name.name); + } + mutex_unlock(&swapon_mutex); +} +EXPORT_SYMBOL_GPL(ltt_dump_swap_files); |