gator-driver: Stop using VM_EXECUTABLE
authorJon Medhurst <tixy@linaro.org>
Thu, 25 Oct 2012 09:42:03 +0000 (10:42 +0100)
committerJon Medhurst <tixy@linaro.org>
Fri, 26 Oct 2012 16:07:07 +0000 (17:07 +0100)
In Linux 3.7, commit e9714acf (mm: kill vma flag VM_EXECUTABLE and
mm->num_exe_file_vmas) breaks Gator's get_exec_cookie() as it uses the
removed flag.

Fix this in a similar as commit 2dd8ad81 (mm: use mm->exe_file instead
of first VM_EXECUTABLE vma->vm_file)

Signed-off-by: Jon Medhurst <tixy@linaro.org>
driver/gator_cookies.c

index b2ed68665321816ba08e1f4bbc2ee53ba87d2557..21dc4eb1ad30449cddb46a70451921478e2ecf65 100644 (file)
@@ -232,10 +232,13 @@ static inline uint32_t get_cookie(int cpu, struct task_struct *task, struct vm_a
        if (mod) {
                text = mod->name;
        } else {
-               if (!vma || !vma->vm_file) {
+               if (vma && vma->vm_file) {
+                       path = &vma->vm_file->f_path;
+               } else if (task && task->mm && task->mm->exe_file) {
+                       path = &task->mm->exe_file->f_path;
+               } else {
                        return INVALID_COOKIE;
                }
-               path = &vma->vm_file->f_path;
                if (!path || !path->dentry) {
                        return INVALID_COOKIE;
                }
@@ -275,20 +278,12 @@ static int get_exec_cookie(int cpu, struct task_struct *task)
 {
        unsigned long cookie = NO_COOKIE;
        struct mm_struct *mm = task->mm;
-       struct vm_area_struct *vma;
 
        // kernel threads have no address space
        if (!mm)
                return cookie;
 
-       for (vma = mm->mmap; vma; vma = vma->vm_next) {
-               if (!vma->vm_file)
-                       continue;
-               if (!(vma->vm_flags & VM_EXECUTABLE))
-                       continue;
-               cookie = get_cookie(cpu, task, vma, NULL, true);
-               break;
-       }
+       cookie = get_cookie(cpu, task, NULL, NULL, true);
 
        return cookie;
 }