From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Anton Arapov <anton@redhat.com>, Frank Eigler <fche@redhat.com>,
Josh Stone <jistone@redhat.com>,
"Suzuki K. Poulose" <suzuki@in.ibm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/7] uprobes: Move alloc_page() from xol_add_vma() to xol_alloc_area()
Date: Tue, 8 Jan 2013 17:16:07 +0530 [thread overview]
Message-ID: <20130108114607.GD1325@linux.vnet.ibm.com> (raw)
In-Reply-To: <20121231175212.GA32088@redhat.com>
* Oleg Nesterov <oleg@redhat.com> [2012-12-31 18:52:12]:
> Move alloc_page() from xol_add_vma() to xol_alloc_area() to cleanup
> the code. This separates the memory allocations and consolidates the
> -EALREADY cleanups and the error handling.
>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
(One simple check below)
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> ---
> kernel/events/uprobes.c | 32 +++++++++++++-------------------
> 1 files changed, 13 insertions(+), 19 deletions(-)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index f883813..1456f7d 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1041,22 +1041,14 @@ void uprobe_munmap(struct vm_area_struct *vma, unsigned long start, unsigned lon
> /* Slot allocation for XOL */
> static int xol_add_vma(struct xol_area *area)
> {
> - struct mm_struct *mm;
> - int ret;
> -
> - area->page = alloc_page(GFP_HIGHUSER);
> - if (!area->page)
> - return -ENOMEM;
> -
> - ret = -EALREADY;
> - mm = current->mm;
> + struct mm_struct *mm = current->mm;
> + int ret = -EALREADY;
>
> down_write(&mm->mmap_sem);
> if (mm->uprobes_state.xol_area)
> goto fail;
>
> ret = -ENOMEM;
> -
> /* Try to map as high as possible, this is only a hint. */
> area->vaddr = get_unmapped_area(NULL, TASK_SIZE - PAGE_SIZE, PAGE_SIZE, 0, 0);
> if (area->vaddr & ~PAGE_MASK) {
> @@ -1072,11 +1064,8 @@ static int xol_add_vma(struct xol_area *area)
> smp_wmb(); /* pairs with get_xol_area() */
> mm->uprobes_state.xol_area = area;
> ret = 0;
> -
> -fail:
> + fail:
Not sure if the space before label is intentional?
Its true of other labels below also.
> up_write(&mm->mmap_sem);
> - if (ret)
> - __free_page(area->page);
>
> return ret;
> }
> @@ -1104,21 +1093,26 @@ static struct xol_area *xol_alloc_area(void)
>
> area = kzalloc(sizeof(*area), GFP_KERNEL);
> if (unlikely(!area))
> - return NULL;
> + goto out;
>
> area->bitmap = kzalloc(BITS_TO_LONGS(UINSNS_PER_PAGE) * sizeof(long), GFP_KERNEL);
> -
> if (!area->bitmap)
> - goto fail;
> + goto free_area;
> +
> + area->page = area->page = alloc_page(GFP_HIGHUSER);
> + if (!area->page)
> + goto free_bitmap;
>
> init_waitqueue_head(&area->wq);
> if (!xol_add_vma(area))
> return area;
>
> -fail:
> + __free_page(area->page);
> + free_bitmap:
> kfree(area->bitmap);
> + free_area:
> kfree(area);
> -
> + out:
> return get_xol_area(current->mm);
> }
>
> --
> 1.5.5.1
>
next prev parent reply other threads:[~2013-01-08 11:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-31 17:51 [PATCH 0/7] uprobes: alloc utask/xol_area cleanups and minor fix Oleg Nesterov
2012-12-31 17:52 ` [PATCH 1/7] uprobes: Move alloc_page() from xol_add_vma() to xol_alloc_area() Oleg Nesterov
2013-01-07 9:16 ` Anton Arapov
2013-01-07 16:11 ` Oleg Nesterov
2013-01-08 11:46 ` Srikar Dronamraju [this message]
2013-01-08 17:58 ` Oleg Nesterov
2013-01-09 17:44 ` Srikar Dronamraju
2012-12-31 17:52 ` [PATCH 2/7] uprobes: Fold xol_alloc_area() into get_xol_area() Oleg Nesterov
2013-01-08 11:55 ` Srikar Dronamraju
2013-01-09 10:16 ` Anton Arapov
2013-01-09 15:51 ` Oleg Nesterov
2012-12-31 17:52 ` [PATCH 3/7] uprobes: Turn add_utask() into get_utask() Oleg Nesterov
2013-01-08 11:57 ` Srikar Dronamraju
2012-12-31 17:52 ` [PATCH 4/7] uprobes: Do not play with utask in xol_get_insn_slot() Oleg Nesterov
2013-01-08 12:07 ` Srikar Dronamraju
2012-12-31 17:52 ` [PATCH 5/7] uprobes: Fix utask->xol_vaddr leak in pre_ssout() Oleg Nesterov
2013-01-08 12:13 ` Srikar Dronamraju
2013-01-08 17:44 ` Oleg Nesterov
2013-01-10 12:48 ` Srikar Dronamraju
2012-12-31 17:52 ` [PATCH 6/7] uprobes: Do not allocate current->utask unnecessary Oleg Nesterov
2013-01-08 12:20 ` Srikar Dronamraju
2013-01-08 18:13 ` Oleg Nesterov
2012-12-31 17:52 ` [PATCH 7/7] uprobes: Kill the bogus IS_ERR_VALUE(xol_vaddr) check Oleg Nesterov
2013-01-08 12:23 ` Srikar Dronamraju
2013-01-09 10:25 ` [PATCH 0/7] uprobes: alloc utask/xol_area cleanups and minor fix Anton Arapov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130108114607.GD1325@linux.vnet.ibm.com \
--to=srikar@linux.vnet.ibm.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=fche@redhat.com \
--cc=jistone@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=suzuki@in.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).