[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120620122939.GA4018@bandura.brq.redhat.com>
Date: Wed, 20 Jun 2012 14:29:39 +0200
From: Anton Arapov <anton@...hat.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
Hugh Dickins <hughd@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/5] uprobes: write_opcode: alloc the new page outside of
"retry" loop
On Tue, Jun 19, 2012 at 09:47:59PM +0200, Oleg Nesterov wrote:
> It is ugly to free and re-alloc new_page if write_opcode() needs to
> retry. Move alloc_page_vma/page_cache_release outside of "retry" loop.
>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> ---
> kernel/events/uprobes.c | 26 +++++++++++---------------
> 1 files changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 442064d..3fd7bdf 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -214,19 +214,18 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
> struct vm_area_struct *vma;
> int ret;
>
> -retry:
> - /* Read the page with vaddr into memory */
> - ret = get_user_pages(NULL, mm, vaddr, 1, 0, 0, &old_page, &vma);
> - if (ret <= 0)
> - return ret;
> -
> - ret = -ENOMEM;
> new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, vaddr);
Should we want NULL instead of vma in alloc_page_vma()? Or
initialize vma with NULL...
> if (!new_page)
> - goto put_old;
> + return -ENOMEM;
>
> __SetPageUptodate(new_page);
>
> + retry:
> + /* Read the page with vaddr into memory */
> + ret = get_user_pages(NULL, mm, vaddr, 1, 0, 0, &old_page, &vma);
> + if (ret <= 0)
> + goto out;
> +
[cut]
Anton.
--
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