diff options
author | Avik Sil <avik.sil@linaro.org> | 2011-03-31 11:06:38 +0000 |
---|---|---|
committer | Avik Sil <avik.sil@linaro.org> | 2011-03-31 11:06:38 +0000 |
commit | ebb688e3183bd5891312bdb8f4e2f520d70b36b6 (patch) | |
tree | c30d1abefaccc8cd1baa4944aae3348668e13bde /mm | |
parent | 8061f3a885ec3538bf405ff3957c205b1ab2aae4 (diff) | |
parent | b2afcd30fff4c24290a63a2497de301864d9726d (diff) |
Merge remote branch 'lttng/2.6.38-lttng-0.247'
Conflicts:
arch/arm/kernel/traps.c
arch/arm/mach-omap2/clock34xx.c
arch/arm/mach-omap2/pm34xx.c
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 10 | ||||
-rw-r--r-- | mm/hugetlb.c | 63 | ||||
-rw-r--r-- | mm/memory.c | 10 | ||||
-rw-r--r-- | mm/page_alloc.c | 7 | ||||
-rw-r--r-- | mm/page_io.c | 4 | ||||
-rw-r--r-- | mm/swapfile.c | 32 | ||||
-rw-r--r-- | mm/vmalloc.c | 2 |
7 files changed, 110 insertions, 18 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 83a45d35468..74bb9f8acf3 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -34,6 +34,7 @@ #include <linux/hardirq.h> /* for BUG_ON(!in_atomic()) only */ #include <linux/memcontrol.h> #include <linux/mm_inline.h> /* for page_is_file_cache() */ +#include <trace/filemap.h> #include "internal.h" /* @@ -43,6 +44,11 @@ #include <asm/mman.h> +DEFINE_TRACE(wait_on_page_start); +DEFINE_TRACE(wait_on_page_end); +DEFINE_TRACE(add_to_page_cache); +DEFINE_TRACE(remove_from_page_cache); + /* * Shared mappings implemented 30.11.1994. It's not fully working yet, * though. @@ -120,6 +126,7 @@ void __remove_from_page_cache(struct page *page) page->mapping = NULL; mapping->nrpages--; __dec_zone_page_state(page, NR_FILE_PAGES); + trace_remove_from_page_cache(mapping); if (PageSwapBacked(page)) __dec_zone_page_state(page, NR_SHMEM); BUG_ON(page_mapped(page)); @@ -419,6 +426,7 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping, if (likely(!error)) { mapping->nrpages++; __inc_zone_page_state(page, NR_FILE_PAGES); + trace_add_to_page_cache(mapping, offset); if (PageSwapBacked(page)) __inc_zone_page_state(page, NR_SHMEM); spin_unlock_irq(&mapping->tree_lock); @@ -511,9 +519,11 @@ void wait_on_page_bit(struct page *page, int bit_nr) { DEFINE_WAIT_BIT(wait, &page->flags, bit_nr); + trace_wait_on_page_start(page, bit_nr); if (test_bit(bit_nr, &page->flags)) __wait_on_bit(page_waitqueue(page), &wait, sync_page, TASK_UNINTERRUPTIBLE); + trace_wait_on_page_end(page, bit_nr); } EXPORT_SYMBOL(wait_on_page_bit); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index bb0b7c12801..2114fb2615e 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -21,6 +21,7 @@ #include <linux/rmap.h> #include <linux/swap.h> #include <linux/swapops.h> +#include <trace/hugetlb.h> #include <asm/page.h> #include <asm/pgtable.h> @@ -53,6 +54,14 @@ static unsigned long __initdata default_hstate_size; */ static DEFINE_SPINLOCK(hugetlb_lock); +DEFINE_TRACE(hugetlb_page_release); +DEFINE_TRACE(hugetlb_page_grab); +DEFINE_TRACE(hugetlb_buddy_pgalloc); +DEFINE_TRACE(hugetlb_page_alloc); +DEFINE_TRACE(hugetlb_page_free); +DEFINE_TRACE(hugetlb_pages_reserve); +DEFINE_TRACE(hugetlb_pages_unreserve); + /* * Region tracking -- allows tracking of reservations and instantiated pages * across the pages in a mapping. @@ -500,6 +509,7 @@ static void update_and_free_page(struct hstate *h, struct page *page) VM_BUG_ON(h->order >= MAX_ORDER); + trace_hugetlb_page_release(page); h->nr_huge_pages--; h->nr_huge_pages_node[page_to_nid(page)]--; for (i = 0; i < pages_per_huge_page(h); i++) { @@ -534,6 +544,7 @@ static void free_huge_page(struct page *page) int nid = page_to_nid(page); struct address_space *mapping; + trace_hugetlb_page_free(page); mapping = (struct address_space *) page_private(page); set_page_private(page, 0); page->mapping = NULL; @@ -598,8 +609,10 @@ static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid) { struct page *page; - if (h->order >= MAX_ORDER) - return NULL; + if (h->order >= MAX_ORDER) { + page = NULL; + goto end; + } page = alloc_pages_exact_node(nid, htlb_alloc_mask|__GFP_COMP|__GFP_THISNODE| @@ -608,11 +621,13 @@ static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid) if (page) { if (arch_prepare_hugepage(page)) { __free_pages(page, huge_page_order(h)); - return NULL; + page = NULL; + goto end; } prep_new_huge_page(h, page, nid); } - +end: + trace_hugetlb_page_grab(page); return page; } @@ -781,7 +796,8 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, int nid) spin_lock(&hugetlb_lock); if (h->surplus_huge_pages >= h->nr_overcommit_huge_pages) { spin_unlock(&hugetlb_lock); - return NULL; + page = NULL; + goto end; } else { h->nr_huge_pages++; h->surplus_huge_pages++; @@ -818,7 +834,8 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, int nid) __count_vm_event(HTLB_BUDDY_PGALLOC_FAIL); } spin_unlock(&hugetlb_lock); - +end: + trace_hugetlb_buddy_pgalloc(page); return page; } @@ -1054,6 +1071,7 @@ static struct page *alloc_huge_page(struct vm_area_struct *vma, vma_commit_reservation(h, vma, addr); + trace_hugetlb_page_alloc(page); return page; } @@ -2837,7 +2855,8 @@ int hugetlb_reserve_pages(struct inode *inode, struct vm_area_struct *vma, int acctflag) { - long ret, chg; + int ret = 0; + long chg; struct hstate *h = hstate_inode(inode); /* @@ -2846,7 +2865,7 @@ int hugetlb_reserve_pages(struct inode *inode, * and filesystem quota without using reserves */ if (acctflag & VM_NORESERVE) - return 0; + goto end; /* * Shared mappings base their reservation on the number of pages that @@ -2858,8 +2877,10 @@ int hugetlb_reserve_pages(struct inode *inode, chg = region_chg(&inode->i_mapping->private_list, from, to); else { struct resv_map *resv_map = resv_map_alloc(); - if (!resv_map) - return -ENOMEM; + if (!resv_map) { + ret = -ENOMEM; + goto end; + } chg = to - from; @@ -2867,12 +2888,16 @@ int hugetlb_reserve_pages(struct inode *inode, set_vma_resv_flags(vma, HPAGE_RESV_OWNER); } - if (chg < 0) - return chg; + if (chg < 0) { + ret = chg; + goto end; + } /* There must be enough filesystem quota for the mapping */ - if (hugetlb_get_quota(inode->i_mapping, chg)) - return -ENOSPC; + if (hugetlb_get_quota(inode->i_mapping, chg)) { + ret = -ENOSPC; + goto end; + } /* * Check enough hugepages are available for the reservation. @@ -2881,7 +2906,7 @@ int hugetlb_reserve_pages(struct inode *inode, ret = hugetlb_acct_memory(h, chg); if (ret < 0) { hugetlb_put_quota(inode->i_mapping, chg); - return ret; + goto end; } /* @@ -2897,14 +2922,18 @@ int hugetlb_reserve_pages(struct inode *inode, */ if (!vma || vma->vm_flags & VM_MAYSHARE) region_add(&inode->i_mapping->private_list, from, to); - return 0; +end: + trace_hugetlb_pages_reserve(inode, from, to, ret); + return ret; } void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed) { struct hstate *h = hstate_inode(inode); - long chg = region_truncate(&inode->i_mapping->private_list, offset); + long chg; + trace_hugetlb_pages_unreserve(inode, offset, freed); + chg = region_truncate(&inode->i_mapping->private_list, offset); spin_lock(&inode->i_lock); inode->i_blocks -= (blocks_per_huge_page(h) * freed); spin_unlock(&inode->i_lock); diff --git a/mm/memory.c b/mm/memory.c index 5823698c2b7..dc955dad52a 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -57,6 +57,8 @@ #include <linux/swapops.h> #include <linux/elf.h> #include <linux/gfp.h> +#include <trace/swap.h> +#include <trace/fault.h> #include <asm/io.h> #include <asm/pgalloc.h> @@ -67,6 +69,10 @@ #include "internal.h" +DEFINE_TRACE(swap_in); +DEFINE_TRACE(page_fault_get_user_entry); +DEFINE_TRACE(page_fault_get_user_exit); + #ifndef CONFIG_NEED_MULTIPLE_NODES /* use the per-pgdat data instead for discontigmem - mbligh */ unsigned long max_mapnr; @@ -1516,6 +1522,8 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, int ret; unsigned int fault_flags = 0; + trace_page_fault_get_user_entry(mm, + vma, start, foll_flags & FOLL_WRITE); if (foll_flags & FOLL_WRITE) fault_flags |= FAULT_FLAG_WRITE; if (nonblocking) @@ -1523,6 +1531,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, ret = handle_mm_fault(mm, vma, start, fault_flags); + trace_page_fault_get_user_exit(ret); if (ret & VM_FAULT_ERROR) { if (ret & VM_FAULT_OOM) @@ -2747,6 +2756,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, /* Had to read the page from swap area: Major fault */ ret = VM_FAULT_MAJOR; count_vm_event(PGMAJFAULT); + trace_swap_in(page, entry); } else if (PageHWPoison(page)) { /* * hwpoisoned dirty swapcache pages are kept for killing diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 28280375327..0e01d7400d1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -53,6 +53,7 @@ #include <linux/compaction.h> #include <trace/events/kmem.h> #include <linux/ftrace_event.h> +#include <trace/page_alloc.h> #include <asm/tlbflush.h> #include <asm/div64.h> @@ -129,6 +130,9 @@ void pm_restrict_gfp_mask(void) int pageblock_order __read_mostly; #endif +DEFINE_TRACE(page_alloc); +DEFINE_TRACE(page_free); + static void __free_pages_ok(struct page *page, unsigned int order); /* @@ -647,6 +651,8 @@ static bool free_pages_prepare(struct page *page, unsigned int order) trace_mm_page_free_direct(page, order); kmemcheck_free_shadow(page, order); + trace_page_free(page, order); + if (PageAnon(page)) page->mapping = NULL; for (i = 0; i < (1 << order); i++) @@ -2165,6 +2171,7 @@ nopage: } return page; got_pg: + trace_page_alloc(page, order); if (kmemcheck_enabled) kmemcheck_pagealloc_alloc(page, order, gfp_mask); return page; diff --git a/mm/page_io.c b/mm/page_io.c index 2dee975bf46..d262ffb0c2d 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -18,8 +18,11 @@ #include <linux/bio.h> #include <linux/swapops.h> #include <linux/writeback.h> +#include <trace/swap.h> #include <asm/pgtable.h> +DEFINE_TRACE(swap_out); + static struct bio *get_swap_bio(gfp_t gfp_flags, struct page *page, bio_end_io_t end_io) { @@ -109,6 +112,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) rw |= REQ_SYNC | REQ_UNPLUG; count_vm_event(PSWPOUT); set_page_writeback(page); + trace_swap_out(page); unlock_page(page); submit_bio(rw, bio); out: diff --git a/mm/swapfile.c b/mm/swapfile.c index 6d6d28c0a72..f7932adb960 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); @@ -2285,6 +2291,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. * @@ -2565,3 +2578,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); diff --git a/mm/vmalloc.c b/mm/vmalloc.c index f9b166732e7..f2df4585ae2 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2059,7 +2059,7 @@ EXPORT_SYMBOL(remap_vmalloc_range); void __attribute__((weak)) vmalloc_sync_all(void) { } - +EXPORT_SYMBOL_GPL(vmalloc_sync_all); static int f(pte_t *pte, pgtable_t table, unsigned long addr, void *data) { |