From: John L. <mov...@us...> - 2002-01-17 11:00:35
|
Update of /cvsroot/oprofile/oprofile/module In directory usw-pr-cvs1:/tmp/cvs-serv29106/module Modified Files: compat22.h compat24.h op_syscalls.c Log Message: fix deadlock on 2.2 SMP Index: compat22.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/module/compat22.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- compat22.h 2002/01/17 09:15:06 1.5 +++ compat22.h 2002/01/17 11:00:31 1.6 @@ -26,8 +26,6 @@ /* FIXME: didn't this change in 2.2.21 ? */ #define pte_page_address(x) pte_page(x) #define GET_VM_OFFSET(v) ((v)->vm_offset) -#define take_mmap_sem(mm) down(&mm->mmap_sem) -#define release_mmap_sem(mm) up(&mm->mmap_sem) #define MODULE_LICENSE(l) #define NEED_2_2_DENTRIES #define INC_USE_COUNT_MAYBE MOD_INC_USE_COUNT @@ -35,6 +33,10 @@ #define op_nmi op_nmi22 #define lock_execve lock_kernel #define unlock_execve unlock_kernel + +/* BKL-protected on 2.2 */ +#define lock_mmap(mm) do {} while (0) +#define unlock_mmap(mm) do {} while (0) // FIXME: untested static inline int wq_is_lockable(void) Index: compat24.h =================================================================== RCS file: /cvsroot/oprofile/oprofile/module/compat24.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- compat24.h 2002/01/17 09:15:06 1.6 +++ compat24.h 2002/01/17 11:00:31 1.7 @@ -50,11 +50,11 @@ /* 2.4.3 introduced rw mmap semaphore */ #if VATLEAST(2,4,3) - #define take_mmap_sem(mm) down_read(&mm->mmap_sem) - #define release_mmap_sem(mm) up_read(&mm->mmap_sem) + #define lock_mmap(mm) down_read(&mm->mmap_sem) + #define unlock_mmap(mm) up_read(&mm->mmap_sem) #else - #define take_mmap_sem(mm) down(&mm->mmap_sem) - #define release_mmap_sem(mm) up(&mm->mmap_sem) + #define lock_mmap(mm) down(&mm->mmap_sem) + #define unlock_mmap(mm) up(&mm->mmap_sem) #endif #if VBEFORE(2,4,10) Index: op_syscalls.c =================================================================== RCS file: /cvsroot/oprofile/oprofile/module/op_syscalls.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- op_syscalls.c 2002/01/17 09:15:06 1.7 +++ op_syscalls.c 2002/01/17 11:00:31 1.8 @@ -322,8 +322,7 @@ if (!(mm = task->mm)) goto out; - - take_mmap_sem(mm); + lock_mmap(mm); spin_lock(&map_lock); for (map = mm->mmap; map; map = map->vm_next) { if (!(map->vm_flags & VM_EXEC) || !map->vm_file) @@ -334,7 +333,7 @@ is_execve = 0; } spin_unlock(&map_lock); - release_mmap_sem(mm); + unlock_mmap(mm); out: return size; |