From: Jes Sorensen Migrate perfmon from using an old semaphore to a completion handler. Signed-off-by: Jes Sorensen Signed-off-by: Ingo Molnar Cc: "Luck, Tony" Signed-off-by: Andrew Morton --- arch/ia64/kernel/perfmon.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff -puN arch/ia64/kernel/perfmon.c~sem2mutex-arch-ia64-kernel-perfmonc arch/ia64/kernel/perfmon.c --- 25/arch/ia64/kernel/perfmon.c~sem2mutex-arch-ia64-kernel-perfmonc Fri Jan 13 15:58:06 2006 +++ 25-akpm/arch/ia64/kernel/perfmon.c Fri Jan 13 15:58:06 2006 @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -286,7 +287,7 @@ typedef struct pfm_context { unsigned long ctx_ovfl_regs[4]; /* which registers overflowed (notification) */ - struct semaphore ctx_restart_sem; /* use for blocking notification mode */ + struct completion ctx_restart_done; /* use for blocking notification mode */ unsigned long ctx_used_pmds[4]; /* bitmask of PMD used */ unsigned long ctx_all_pmds[4]; /* bitmask of all accessible PMDs */ @@ -1989,7 +1990,7 @@ pfm_close(struct inode *inode, struct fi /* * force task to wake up from MASKED state */ - up(&ctx->ctx_restart_sem); + complete(&ctx->ctx_restart_done); DPRINT(("waking up ctx_state=%d\n", state)); @@ -2704,7 +2705,7 @@ pfm_context_create(pfm_context_t *ctx, v /* * init restart semaphore to locked */ - sema_init(&ctx->ctx_restart_sem, 0); + init_completion(&ctx->ctx_restart_done); /* * activation is used in SMP only @@ -3685,7 +3686,7 @@ pfm_restart(pfm_context_t *ctx, void *ar */ if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) { DPRINT(("unblocking [%d] \n", task->pid)); - up(&ctx->ctx_restart_sem); + complete(&ctx->ctx_restart_done); } else { DPRINT(("[%d] armed exit trap\n", task->pid)); @@ -5087,7 +5088,7 @@ pfm_handle_work(void) * may go through without blocking on SMP systems * if restart has been received already by the time we call down() */ - ret = down_interruptible(&ctx->ctx_restart_sem); + ret = wait_for_completion_interruptible(&ctx->ctx_restart_done); DPRINT(("after block sleeping ret=%d\n", ret)); _