From: Baoquan He <bhe@redhat.com>
To: Song Liu <song@kernel.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
songliubraving@fb.com, Uladzislau Rezki <urezki@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm/vmalloc: Extend find_vmap_lowest_match_check with extra arguments
Date: Wed, 31 Aug 2022 15:37:32 +0800 [thread overview]
Message-ID: <Yw8PvP/SjDCE6DDX@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20220831052734.3423079-1-song@kernel.org>
On 08/30/22 at 10:27pm, Song Liu wrote:
> find_vmap_lowest_match() is now able to handle different roots. Make
> similar changes to find_vmap_lowest_match_check() and
> find_vmap_lowest_linear_match() to handle different trees.
Good catch. Guess usually nobody eables DEBUG_AUGMENT_LOWEST_MATCH_CHECK
to trigger compilation of the code.
Reviewed-by: Baoquan He <bhe@redhat.com>
>
> Fixes: f9863be49312 ("mm/vmalloc: extend __alloc_vmap_area() with extra arguments")
> Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Cc: Baoquan He <bhe@redhat.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Song Liu <song@kernel.org>
> ---
> mm/vmalloc.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index dd6cdb201195..088b421601c4 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -1300,12 +1300,12 @@ find_vmap_lowest_match(struct rb_root *root, unsigned long size,
> #include <linux/random.h>
>
> static struct vmap_area *
> -find_vmap_lowest_linear_match(unsigned long size,
> +find_vmap_lowest_linear_match(struct list_head *head, unsigned long size,
> unsigned long align, unsigned long vstart)
> {
> struct vmap_area *va;
>
> - list_for_each_entry(va, &free_vmap_area_list, list) {
> + list_for_each_entry(va, head, list) {
> if (!is_within_this_va(va, size, align, vstart))
> continue;
>
> @@ -1316,7 +1316,8 @@ find_vmap_lowest_linear_match(unsigned long size,
> }
>
> static void
> -find_vmap_lowest_match_check(unsigned long size, unsigned long align)
> +find_vmap_lowest_match_check(struct rb_root *root, struct list_head *head,
> + unsigned long size, unsigned long align)
> {
> struct vmap_area *va_1, *va_2;
> unsigned long vstart;
> @@ -1325,8 +1326,8 @@ find_vmap_lowest_match_check(unsigned long size, unsigned long align)
> get_random_bytes(&rnd, sizeof(rnd));
> vstart = VMALLOC_START + rnd;
>
> - va_1 = find_vmap_lowest_match(size, align, vstart, false);
> - va_2 = find_vmap_lowest_linear_match(size, align, vstart);
> + va_1 = find_vmap_lowest_match(root, size, align, vstart, false);
> + va_2 = find_vmap_lowest_linear_match(head, size, align, vstart);
>
> if (va_1 != va_2)
> pr_emerg("not lowest: t: 0x%p, l: 0x%p, v: 0x%lx\n",
> @@ -1513,7 +1514,7 @@ __alloc_vmap_area(struct rb_root *root, struct list_head *head,
> return vend;
>
> #if DEBUG_AUGMENT_LOWEST_MATCH_CHECK
> - find_vmap_lowest_match_check(size, align);
> + find_vmap_lowest_match_check(root, head, size, align);
> #endif
>
> return nva_start_addr;
> --
> 2.30.2
>
next prev parent reply other threads:[~2022-08-31 7:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-31 5:27 [PATCH] mm/vmalloc: Extend find_vmap_lowest_match_check with extra arguments Song Liu
2022-08-31 7:37 ` Baoquan He [this message]
2022-08-31 15:34 ` Uladzislau Rezki
2022-08-31 23:01 ` Andrew Morton
2022-09-01 0:47 ` Song Liu
2022-09-01 12:16 ` Uladzislau Rezki
2022-09-02 3:39 ` Baoquan He
2022-09-02 16:45 ` Uladzislau Rezki
2022-09-03 1:54 ` Baoquan He
2022-09-04 9:36 ` Uladzislau Rezki
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=Yw8PvP/SjDCE6DDX@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=song@kernel.org \
--cc=songliubraving@fb.com \
--cc=urezki@gmail.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).