[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20121213143044.GE3902@linux.vnet.ibm.com>
Date: Thu, 13 Dec 2012 20:00:44 +0530
From: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Anton Arapov <anton@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] uprobes: Kill uprobe->copy_mutex
* Oleg Nesterov <oleg@...hat.com> [2012-11-24 19:02:36]:
> Now that ->register_rwsem is safe under ->mmap_sem we can kill
> ->copy_mutex and abuse down_write(&uprobe->consumer_rwsem).
>
> This makes prepare_uprobe() even more ugly, but we should kill
> it anyway.
>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
Acked-by: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
> ---
> kernel/events/uprobes.c | 7 +++----
> 1 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 97c3874..1e047f8 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -91,7 +91,6 @@ struct uprobe {
> atomic_t ref;
> struct rw_semaphore register_rwsem;
> struct rw_semaphore consumer_rwsem;
> - struct mutex copy_mutex; /* TODO: kill me and UPROBE_COPY_INSN */
> struct list_head pending_list;
> struct uprobe_consumer *consumers;
> struct inode *inode; /* Also hold a ref to inode */
> @@ -450,7 +449,6 @@ static struct uprobe *alloc_uprobe(struct inode *inode, loff_t offset)
> uprobe->offset = offset;
> init_rwsem(&uprobe->register_rwsem);
> init_rwsem(&uprobe->consumer_rwsem);
> - mutex_init(&uprobe->copy_mutex);
> /* For now assume that the instruction need not be single-stepped */
> __set_bit(UPROBE_SKIP_SSTEP, &uprobe->flags);
>
> @@ -578,7 +576,8 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
> if (test_bit(UPROBE_COPY_INSN, &uprobe->flags))
> return ret;
>
> - mutex_lock(&uprobe->copy_mutex);
> + /* TODO: move this into _register, until then we abuse this sem. */
> + down_write(&uprobe->consumer_rwsem);
> if (test_bit(UPROBE_COPY_INSN, &uprobe->flags))
> goto out;
>
> @@ -602,7 +601,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct file *file,
> set_bit(UPROBE_COPY_INSN, &uprobe->flags);
>
> out:
> - mutex_unlock(&uprobe->copy_mutex);
> + up_write(&uprobe->consumer_rwsem);
>
> return ret;
> }
> --
> 1.5.5.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists