From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] uprobes: Use better bitmap_zalloc()
Date: Mon, 31 May 2021 08:54:15 +0800 [thread overview]
Message-ID: <d0adc27d-0654-385b-0f07-2232aa65c576@huawei.com> (raw)
In-Reply-To: <20210529111553.186630-1-wangkefeng.wang@huawei.com>
sorry for the mistake, will fix.
On 2021/5/29 19:15, Kefeng Wang wrote:
> Use better bitmap_zalloc() to allocate bitmap.
>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> kernel/events/uprobes.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 907d4ee00cb2..8160d2e53219 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1487,8 +1487,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
> if (unlikely(!area))
> goto out;
>
> - area->bitmap = kcalloc(BITS_TO_LONGS(UINSNS_PER_PAGE), sizeof(long),
> - GFP_KERNEL);
> + area->bitmap = bitmap_kzalloc(UINSNS_PER_PAGE, GFP_KERNEL);
> if (!area->bitmap)
> goto free_area;
>
> @@ -1512,7 +1511,7 @@ static struct xol_area *__create_xol_area(unsigned long vaddr)
>
> __free_page(area->pages[0]);
> free_bitmap:
> - kfree(area->bitmap);
> + bitmap_kfree(area->bitmap);
> free_area:
> kfree(area);
> out:
> @@ -1553,7 +1552,7 @@ void uprobe_clear_state(struct mm_struct *mm)
> return;
>
> put_page(area->pages[0]);
> - kfree(area->bitmap);
> + bitmap_kfree(area->bitmap);
> kfree(area);
> }
>
next prev parent reply other threads:[~2021-05-31 0:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-29 11:15 Kefeng Wang
2021-05-29 13:23 ` kernel test robot
2021-05-29 14:31 ` kernel test robot
2021-05-29 15:56 ` kernel test robot
2021-05-31 0:54 ` Kefeng Wang [this message]
2021-05-31 1:38 ` [PATCH v2] uprobes: Use better bitmap_zalloc/free Kefeng Wang
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=d0adc27d-0654-385b-0f07-2232aa65c576@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®