From: Dev Jain <dev.jain@arm.com>
To: Ye Liu <ye.liu@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Uladzislau Rezki <urezki@gmail.com>
Cc: linux-mm@kvack.org, Ye Liu <liuye@kylinos.cn>
Subject: Re: [PATCH 1/8] mm/vmalloc: use ALIGN_DOWN for vmalloc end alignment
Date: Thu, 3 Dec 2026 10:59:06 +0530 [thread overview]
Message-ID: <3906ecb0-f548-4695-b024-23a235ee3ce9@arm.com> (raw)
In-Reply-To: <20261203-vmalloc_cleanup_1-v1-1-6ebde19040f4@linux.dev>
On 03/12/26 6:52 am, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
>
> Replace open-coded & ~(align - 1) with the standard ALIGN_DOWN()
> macro, matching the existing ALIGN() usage on the adjacent
> vmalloc_start line. No functional change.
>
> Signed-off-by: Ye Liu <liuye@kylinos.cn>
> ---
Reviewed-by: Dev Jain <dev.jain@arm.com>
Might as well do for addr_to_vb_idx()? Also could you confirm whether
VMAP_BLOCK_SIZE is always a power of 2?
> mm/vmalloc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index ee722162da7c..56f0bfc3147c 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -5166,13 +5166,13 @@ pvm_find_va_enclose_addr(unsigned long addr)
> static unsigned long
> pvm_determine_end_from_reverse(struct vmap_area **va, unsigned long align)
> {
> - unsigned long vmalloc_end = VMALLOC_END & ~(align - 1);
> + unsigned long vmalloc_end = ALIGN_DOWN(VMALLOC_END, align);
> unsigned long addr;
>
> if (likely(*va)) {
> list_for_each_entry_from_reverse((*va),
> &free_vmap_area_list, list) {
> - addr = min((*va)->va_end & ~(align - 1), vmalloc_end);
> + addr = min(ALIGN_DOWN((*va)->va_end, align), vmalloc_end);
> if ((*va)->va_start < addr)
> return addr;
> }
> @@ -5211,7 +5211,7 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
> size_t align, gfp_t gfp)
> {
> const unsigned long vmalloc_start = ALIGN(VMALLOC_START, align);
> - const unsigned long vmalloc_end = VMALLOC_END & ~(align - 1);
> + const unsigned long vmalloc_end = ALIGN_DOWN(VMALLOC_END, align);
> struct vmap_area **vas, *va;
> struct vm_struct **vms;
> int area, area2, last_area, term_area;
>
next prev parent reply other threads:[~2026-12-03 5:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 1:22 [PATCH 0/8] mm/vmalloc: assorted cleanups and minor fixes Ye Liu
2026-12-03 1:22 ` [PATCH 1/8] mm/vmalloc: use ALIGN_DOWN for vmalloc end alignment Ye Liu
2026-12-03 5:29 ` Dev Jain [this message]
2026-12-06 15:28 ` Uladzislau Rezki
2026-12-03 1:22 ` [PATCH 2/8] mm/vmalloc: extract pcpu_release_va helper Ye Liu
2026-12-06 15:44 ` Uladzislau Rezki
2026-12-03 1:22 ` [PATCH 3/8] mm/vmalloc: fix misleading pr_warn in alloc_vmap_area Ye Liu
2026-12-03 1:22 ` [PATCH 4/8] mm/vmalloc: simplify is_vn_id_valid predicate Ye Liu
2026-12-03 1:22 ` [PATCH 5/8] mm/vmalloc: move pool length update under pool_lock in decay_va_pool_node() Ye Liu
2026-12-03 1:22 ` [PATCH 6/8] mm/vmalloc: report node count when falling back to a single node Ye Liu
2026-12-03 1:22 ` [PATCH 7/8] mm/vmalloc: drop the double negation in vmap_insert_free_area() Ye Liu
2026-12-03 1:22 ` [PATCH 8/8] mm/vmalloc: compare addresses directly in vmap_init_free_space() Ye Liu
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=3906ecb0-f548-4695-b024-23a235ee3ce9@arm.com \
--to=dev.jain@arm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=liuye@kylinos.cn \
--cc=urezki@gmail.com \
--cc=ye.liu@linux.dev \
/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