Skip to content
This repository was archived by the owner on Nov 26, 2025. It is now read-only.

Conversation

@Ticonderoga2017
Copy link

@Ticonderoga2017 Ticonderoga2017 commented May 29, 2025

Description

Support for huge page allocation: When performing operations like mmap, consider using huge page allocation instead of only using 4K pages.

Related Issues(If necessary)

Implementation Details

  • Add a page_size parameter to the map_alloc memory allocation method in aspace. This parameter is used for aligning the start address and the size of the allocation, and it should be stored in Backend::Alloc.
  • Add a find_free_area_with_align method in aspace. This method is used when allocating large page memory, ensuring that the found memory address is aligned according to the specified page_size.
  • The allocated and freed physical memory consists of a contiguous sequence of physical addresses, each with a page size of 4KB.
  • Support map linear and dma
  • Use the aarch64 platform and expand the memory to 4GB.

How to Test

Conduct tests in the following areas:

  • Allocation and deallocation of 4K pages, 2M pages, and 1G pages. After allocation, perform memory read/write operations, then deallocate.
  • Allocate 4K, 2M, and 1G pages in batches first, then deallocate them all at once. After allocation, perform memory read/write operations, then deallocate.
  • Interleaved allocation and deallocation of 4K, 2M, and 1G pages. After allocation, perform memory read/write operations, then deallocate.
  • Test immediate allocation and lazy allocation for 4K, 2M, and 1G pages. After allocation, perform memory read/write operations, then deallocate.
  • Test file read/write operations on 4K, 2Mpages.
  • Test linear mapping of 4K, 2M, and 1G pages.

Add this test case to the testcase_list file, and then execute the following commands in sequence from the root directory of starry-next:
Modify the value of the phys-memory-size parameter in the configs/platforms/aarch64-qemu-virt.toml file to 0x1_0000_0000.
./scripts/get_deps.sh
make ARCH=aarch64 PLATFORM=aarch64-qemu-virt defconfig
make ARCH=aarch64 PLATFORM=aarch64-qemu-virt AX_TESTCASE=libc user_apps
make ARCH=aarch64 PLATFORM=aarch64-qemu-virt MEM=4G LOG=debug AX_TESTCASE=libc BLK=y NET=y FEATURES=fp_simd,page-alloc-4g ACCEL=n run

Tips: Please provide the test results of running testcases for starry-next on the commit corresponding to your PR. You can paste it here in the form of a screenshot, or provide a CI link to a branch or fork of starry-next for us to review.

Additional Notes

@Azure-stars Azure-stars mentioned this pull request Jun 10, 2025
@Azure-stars Azure-stars merged commit 097f415 into oscomp:main Jun 12, 2025
24 checks passed
Mivik pushed a commit to Mivik/arceos that referenced this pull request Jun 21, 2025
* support huge page alloc: unmmap

* support huge page alloc: area_* -> unmap_* in unmap
AsakuraMizu pushed a commit that referenced this pull request Jul 7, 2025
* support huge page alloc: unmmap

* support huge page alloc: area_* -> unmap_* in unmap
AsakuraMizu pushed a commit that referenced this pull request Jul 7, 2025
* support huge page alloc: unmmap

* support huge page alloc: area_* -> unmap_* in unmap
lurenjia1213 pushed a commit to lurenjia1213/arceos that referenced this pull request Jul 19, 2025
* support huge page alloc: unmmap

* support huge page alloc: area_* -> unmap_* in unmap
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants