From: Vyacheslav Cherkashin Date: Fri, 7 Nov 2014 18:53:34 +0000 (+0400) Subject: [FEATURE] 'on the go' US probe X-Git-Tag: submit/tizen/20151123.110932~81 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0041ac34f8a20ac55b4236620809a02f267a961;p=kernel%2Fswap-modules.git [FEATURE] 'on the go' US probe Change-Id: Ia3501c4ed5a95a3c190dfe38730a8636801eb034 Signed-off-by: Vyacheslav Cherkashin --- diff --git a/us_manager/sspt/sspt_proc.c b/us_manager/sspt/sspt_proc.c index c573e4d..5152925 100644 --- a/us_manager/sspt/sspt_proc.c +++ b/us_manager/sspt/sspt_proc.c @@ -268,6 +268,35 @@ struct sspt_file *sspt_proc_find_file(struct sspt_proc *proc, return NULL; } +void sspt_proc_install_probe(struct sspt_proc *proc, unsigned long vaddr, + struct probe_info *probe_i) +{ + struct vm_area_struct *vma; + struct task_struct *task = proc->task; + struct mm_struct *mm = task->mm; + unsigned long page_vaddr = vaddr & PAGE_MASK; + + vma = find_vma_intersection(mm, page_vaddr, page_vaddr + 1); + if (vma && check_vma(vma)) { + struct sspt_file *file; + struct dentry *dentry = vma->vm_file->f_dentry; + + file = sspt_proc_find_file_or_new(proc, dentry); + if (file) { + unsigned long addr = vaddr - vma->vm_start; + struct sspt_page *page; + + sspt_file_set_mapping(file, vma); + sspt_file_add_ip(file, addr, probe_i); + + page = sspt_find_page_mapped(file, page_vaddr); + if (page) + sspt_register_page(page, file); + } + } +} +EXPORT_SYMBOL_GPL(sspt_proc_install_probe); + /** * @brief Install probes on the page to monitored process * diff --git a/us_manager/sspt/sspt_proc.h b/us_manager/sspt/sspt_proc.h index 8659648..9fcee58 100644 --- a/us_manager/sspt/sspt_proc.h +++ b/us_manager/sspt/sspt_proc.h @@ -72,6 +72,8 @@ struct sspt_file *sspt_proc_find_file(struct sspt_proc *proc, struct sspt_file *sspt_proc_find_file_or_new(struct sspt_proc *proc, struct dentry *dentry); +void sspt_proc_install_probe(struct sspt_proc *proc, unsigned long vaddr, + struct probe_info *probe_i); void sspt_proc_install_page(struct sspt_proc *proc, unsigned long page_addr); void sspt_proc_install(struct sspt_proc *proc); int sspt_proc_uninstall(struct sspt_proc *proc,