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 1/3] um: Use PAGE_ALIGN() for address alignment
Date: Mon, 27 Oct 2025 07:59:10 +0800 [thread overview]
Message-ID: <20251026235912.1654016-2-tiwei.bie@linux.dev> (raw)
In-Reply-To: <20251026235912.1654016-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 cfbbbf8500c3..4bba77a28454 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -298,10 +298,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)
@@ -369,8 +366,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-26 23:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 23:59 [PATCH 0/3] um: Memory related cleanups Tiwei Bie
2025-10-26 23:59 ` Tiwei Bie [this message]
2025-10-26 23:59 ` [PATCH 2/3] um: Replace UML_ROUND_UP() with PAGE_ALIGN() Tiwei Bie
2025-10-26 23:59 ` [PATCH 3/3] 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=20251026235912.1654016-2-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 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).