diff options
author | Johannes Berg <johannes.berg@intel.com> | 2023-04-14 15:46:39 +0200 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2023-04-20 23:08:43 +0200 |
commit | 6032aca0deb9c138df122192f8ef02de1fdccf25 (patch) | |
tree | f9acfe2a2c09cfa1b3a86351b8bdf2ccd8fa48ef /arch/um/kernel/um_arch.c | |
parent | fc54a4f15988e228cf88f888483e985c5f35031e (diff) | |
download | linux-6032aca0deb9c138df122192f8ef02de1fdccf25.tar.gz |
um: make stub data pages size tweakable
There's a lot of code here that hard-codes that the
data is a single page, and right now that seems to
be sufficient, but to make it easier to change this
in the future, add a new STUB_DATA_PAGES constant
and use it throughout the code.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um/kernel/um_arch.c')
-rw-r--r-- | arch/um/kernel/um_arch.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 8dcda617b8bf6d..0a23a98d4ca0a7 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -326,9 +326,13 @@ int __init linux_main(int argc, char **argv) add_arg(DEFAULT_COMMAND_LINE_CONSOLE); host_task_size = os_get_top_address(); - /* reserve two pages for the stubs */ - host_task_size -= 2 * PAGE_SIZE; - stub_start = host_task_size; + /* reserve a few pages for the stubs (taking care of data alignment) */ + /* align the data portion */ + BUILD_BUG_ON(!is_power_of_2(STUB_DATA_PAGES)); + stub_start = (host_task_size - 1) & ~(STUB_DATA_PAGES * PAGE_SIZE - 1); + /* another page for the code portion */ + stub_start -= PAGE_SIZE; + host_task_size = stub_start; /* * TASK_SIZE needs to be PGDIR_SIZE aligned or else exit_mmap craps |