From: Tiwei Bie <tiwei.bie@linux.dev>
To: richard@nod.at, anton.ivanov@cambridgegreys.com,
johannes@sipsolutions.net
Cc: linux-um@lists.infradead.org, tiwei.btw@antgroup.com,
tiwei.bie@linux.dev
Subject: [PATCH v2 2/4] um: Use PAGE_ALIGN() for address alignment
Date: Mon, 27 Oct 2025 13:45:17 +0800 [thread overview]
Message-ID: <20251027054519.1996090-3-tiwei.bie@linux.dev> (raw)
In-Reply-To: <20251027054519.1996090-1-tiwei.bie@linux.dev>
From: Tiwei Bie <tiwei.btw@antgroup.com>
Use PAGE_ALIGN() instead of open-coded calculations.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
---
arch/um/kernel/um_arch.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 5b982031e5ae..c54d5ed91bb8 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -296,10 +296,7 @@ static unsigned long __init get_top_address(char **envp)
top_addr = (unsigned long) envp[i];
}
- top_addr &= ~(UM_KERN_PAGE_SIZE - 1);
- top_addr += UM_KERN_PAGE_SIZE;
-
- return top_addr;
+ return PAGE_ALIGN(top_addr + 1);
}
int __init linux_main(int argc, char **argv, char **envp)
@@ -368,8 +365,8 @@ int __init linux_main(int argc, char **argv, char **envp)
setup_machinename(init_utsname()->machine);
- physmem_size = (physmem_size + PAGE_SIZE - 1) & PAGE_MASK;
- iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
+ physmem_size = PAGE_ALIGN(physmem_size);
+ iomem_size = PAGE_ALIGN(iomem_size);
max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC;
if (physmem_size > max_physmem) {
--
2.34.1
next prev parent reply other threads:[~2025-10-27 5:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 5:45 [PATCH v2 0/4] um: Memory related cleanups Tiwei Bie
2025-10-27 5:45 ` [PATCH v2 1/4] um: Make host_task_size a local variable Tiwei Bie
2025-10-27 5:45 ` Tiwei Bie [this message]
2025-10-27 5:45 ` [PATCH v2 3/4] um: Replace UML_ROUND_UP() with PAGE_ALIGN() Tiwei Bie
2025-10-27 5:45 ` [PATCH v2 4/4] um: Remove file-based iomem emulation support Tiwei Bie
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=20251027054519.1996090-3-tiwei.bie@linux.dev \
--to=tiwei.bie@linux.dev \
--cc=anton.ivanov@cambridgegreys.com \
--cc=johannes@sipsolutions.net \
--cc=linux-um@lists.infradead.org \
--cc=richard@nod.at \
--cc=tiwei.btw@antgroup.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.