From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexey Dobriyan Subject: [PATCH 7/9] exec_path 7/9: switch cell SPU thing to ->exec_path Date: Thu, 4 Jun 2009 03:07:12 +0400 Message-ID: <20090603230712.GH853@x200.localdomain> References: <20090526113618.GJ28083@us.ibm.com> <20090526162415.fb9cefef.akpm@linux-foundation.org> <20090531215427.GA29534@x200.localdomain> <20090531151953.8f8b14b5.akpm@linux-foundation.org> <20090603230422.GB853@x200.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Matt Helsley , xemul@parallels.com, containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, dave@linux.vnet.ibm.com, mingo@elte.hu, torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org To: Andrew Morton Return-path: Received: from fg-out-1718.google.com ([72.14.220.154]:11635 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755223AbZFCXHO (ORCPT ); Wed, 3 Jun 2009 19:07:14 -0400 Content-Disposition: inline In-Reply-To: <20090603230422.GB853@x200.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Signed-off-by: Alexey Dobriyan --- arch/powerpc/oprofile/cell/spu_task_sync.c | 28 ++++++++++++---------------- 1 files changed, 12 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/oprofile/cell/spu_task_sync.c b/arch/powerpc/oprofile/cell/spu_task_sync.c index 6b793ae..fe17a0a 100644 --- a/arch/powerpc/oprofile/cell/spu_task_sync.c +++ b/arch/powerpc/oprofile/cell/spu_task_sync.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "pr_util.h" @@ -303,9 +304,8 @@ static inline unsigned long fast_get_dcookie(struct path *path) return cookie; } -/* Look up the dcookie for the task's first VM_EXECUTABLE mapping, - * which corresponds loosely to "application name". Also, determine - * the offset for the SPU ELF object. If computed offset is +/* + * Determine the offset for the SPU ELF object. If computed offset is * non-zero, it implies an embedded SPU object; otherwise, it's a * separate SPU binary, in which case we retrieve it's dcookie. * For the embedded case, we must determine if SPU ELF is embedded @@ -320,26 +320,22 @@ get_exec_dcookie_and_offset(struct spu *spu, unsigned int *offsetp, { unsigned long app_cookie = 0; unsigned int my_offset = 0; - struct file *app = NULL; struct vm_area_struct *vma; + struct task_struct *tsk = spu->tsk; struct mm_struct *mm = spu->mm; + struct path exec_path; if (!mm) goto out; - down_read(&mm->mmap_sem); - - for (vma = mm->mmap; vma; vma = vma->vm_next) { - if (!vma->vm_file) - continue; - if (!(vma->vm_flags & VM_EXECUTABLE)) - continue; - app_cookie = fast_get_dcookie(&vma->vm_file->f_path); - pr_debug("got dcookie for %s\n", - vma->vm_file->f_dentry->d_name.name); - app = vma->vm_file; - break; + get_task_exec_path(tsk, &exec_path); + if (exec_path.mnt && exec_path.dentry) { + app_cookie = fast_get_dcookie(&exec_path); + pr_debug("got dcookie for %s\n", exec_path.dentry->d_name.name); } + path_put(&exec_path); + + down_read(&mm->mmap_sem); for (vma = mm->mmap; vma; vma = vma->vm_next) { if (vma->vm_start > spu_ref || vma->vm_end <= spu_ref)