Re: [RFC PATCH] LTTng instrumentation mm (updated)

Dave Hansen
2007-11-30T16:47:19Z

On Fri, 2007-11-30 at 11:11 -0500, Mathieu Desnoyers wrote:
> +static inline swp_entry_t page_swp_entry(struct page *page)
> +{
> + swp_entry_t entry;
> + VM_BUG_ON(!PageSwapCache(page));
> + entry.val = page_private(page);
> + return entry;
> +}

This probably needs to be introduced (and used) in a separate patch.
Please fix up those other places in the code that can take advantage of
it.

> #ifdef CONFIG_MIGRATION
> static inline swp_entry_t make_migration_entry(struct page *page, int
> write)
> {
> Index: linux-2.6-lttng/mm/swapfile.c
> ===================================================================
> --- linux-2.6-lttng.orig/mm/swapfile.c 2007-11-30 09:18:38.000000000
> -0500
> +++ linux-2.6-lttng/mm/swapfile.c 2007-11-30 10:21:50.000000000
> -0500
> @@ -1279,6 +1279,7 @@ asmlinkage long sys_swapoff(const char _
> swap_map = p->swap_map;
> p->swap_map = NULL;
> p->flags = 0;
> + trace_mark(mm_swap_file_close, "filp %p", swap_file);
> spin_unlock(&swap_lock);
> mutex_unlock(&swapon_mutex);
> vfree(swap_map);
> @@ -1660,6 +1661,8 @@ asmlinkage long sys_swapon(const char __
> } else {
> swap_info[prev].next = p - swap_info;
> }
> + trace_mark(mm_swap_file_open, "filp %p filename %s",
> + swap_file, name);

You print out the filp a number of times here, but how does that help in
a trace? If I was trying to figure out which swapfile, I'd probably
just want to know the swp_entry_t->type, then I could look at this:

dave@foo:~/garbage$ cat /proc/swaps
Filename Type Size Used Priority
/dev/sda2 partition 1992052 649336 -1

to see the ordering.

-- Dave