[HTML payload içeriği buraya]
29.4 C
Jakarta
Wednesday, April 29, 2026

Including 16 KB Web page Dimension to Android



Posted by Steven Moreland – Employees Software program Engineer, Sandeep Patil – Principal Software program Engineer

A web page is the granularity at which an working system manages reminiscence. Most CPUs in the present day help a 4 KB web page dimension and so the Android OS and purposes have traditionally been constructed and optimized to run with a 4 KB web page dimension. ARM CPUs help the bigger 16 KB web page dimension. When Android makes use of this bigger web page dimension, we observe an total efficiency increase of 5-10% whereas utilizing ~9% extra reminiscence.

With a view to enhance the working system efficiency total and to provide system producers an choice to make this trade-off, Android 15 can run with 4 KB or 16 KB web page sizes.

The very first 16 KB enabled Android system might be made accessible on choose gadgets as a developer choice. That is so you should use the developer choice to check and repair (if wanted) your purposes to arrange for Android gadgets with 16 KB web page sizes within the close to future.

Particulars

In most CPUs, devoted {hardware} known as reminiscence administration items (MMUs) translate addresses from what a program is utilizing to a bodily location in reminiscence. This translation is finished on a page-size foundation. Each time a program wants extra reminiscence, the working system must become involved and fill out a “web page desk” entry, assigning that piece of reminiscence to a course of. When the web page dimension is 4 occasions bigger, there’s 4 occasions much less bookkeeping. So, the system can spend extra time ensuring your movies look nice, video games play nicely, and purposes run easily, and fewer time filling out low-level working system paperwork.

Not like 32-bit/64-bit mode, a web page dimension just isn’t an Software Binary Interface (ABI). In different phrases, as soon as an utility is fastened to be web page dimension agnostic, the identical utility binary can run on each 4 KB and 16 KB gadgets.

In Android 15, we’ve refactored Android from the bottom as much as help working at completely different web page sizes, thus making it page-size agnostic.

Main OS Modifications

On new Android 15 based mostly gadgets:

    • All OS binaries are 16 KB aligned (-Wl,-z,max-page-size=16384). third celebration purposes / libraries might not be 16 KB aligned.
    • All OS binaries are constructed with separate loadable segments (-Wl,-z,separate-loadable-segments) to make sure all reminiscence areas mapped right into a course of are readable, which some purposes rely on.

Lots of our different OS elements have been rewritten to keep away from assuming the web page dimension and to optimize for bigger web page dimension when accessible.

Filesystems

For performant operation, file system block dimension should match the web page dimension. EROFS and F2FS file methods have been made 16 KB suitable, as has the UFS storage layer.

On 4 KB methods, ELF executable file dimension will increase on account of extra padding added for 16 KB alignment (-Wl,-z,max-page-size=16384 choice), however a number of optimizations assist us keep away from this value.

  1. Sparse read-only file methods make sure that zero pages created for added padding for 16 KB alignment usually are not written to disk. For instance, EROFS is aware of a sure vary of a file is zero crammed, and it’ll not must do any IO if this a part of the file is accessed.
  2. Learn-writeable file methods deal with zero pages on a case-by-case foundation. For instance, In Android 15, for recordsdata put in as a part of purposes PackageManager reclaims this house.

Reminiscence Administration

  1. The Linux web page cache has been modified to not learn forward for these additional padding areas, thereby saving pointless reminiscence load.
  2. These pages are clean padding, and packages by no means learn this. It’s the house in-between usable elements of this system, purely for alignment causes.

Linux Kernel

The Linux kernel is deeply tied to a selected web page dimension, so we should select which web page dimension to make use of when constructing the kernel, whereas the remainder of the working system stays the identical.

Android Functions

All purposes with native code or dependencies have to be recompiled for compatibility with 16 KB web page dimension gadgets.

Since most native code inside Android purposes and SDKs have been constructed with 4 KB web page dimension in thoughts, they have to be re-aligned to 16 KB so the binaries are suitable with each 4 KB and 16 KB gadgets. For many purposes and SDKs, this can be a 2 step course of:

  1. Rebuild the native code with 16 KB alignment.
  2. Check and repair on a 16 KB system/emulator in case there are hardcode assumptions about web page dimension.

Please see our developer documentation for extra info.

NOTE: In case you are an SDK or instruments developer, you must add 16 KB help as quickly as potential in order that purposes can work on 16 KB utilizing your SDK or instruments.

Growing for 16 KB gadgets

There aren’t any manufacturing Android gadgets accessible in the present day or anticipated for the Android 15 launch that help a 16 KB web page dimension. With a view to repair this drawback, we’re taking steps to work with our companions to make a developer choice accessible on current gadgets. This developer choice is supposed for utility growth and testing. We’re additionally making a 16 KB emulator goal accessible for builders in Android Studio.

16 KB Developer choice on system

In Android 15, we carried out a developer choice that lets customers change between 16 KB and 4 KB web page dimension on the system with a view to take a look at their utility with both of the web page sizes. This feature is out there on Pixel 8 and Pixel 8 Professional beginning within the Android 15 QPR1 Beta, and we’re collaborating carefully with SoC and OEM companions to allow the choice on extra gadgets quickly.

screen grab of 16KB developer option on device

When constructed for 16 KB pages, the identical binary will work with 4 KB and 16 KB gadgets, nonetheless the Linux kernel needs to be separate. With a view to remedy this drawback, we’ve added a technique to embrace an additional kernel you’ll be able to change to as a developer choice. Incrementally compressed, with one copy for every web page dimension and takes ~12-16 MB of house on disk.

Utilizing the 16 KB developer choice would require wiping the system as soon as and an unlocked bootloader. Following flashing, builders will have the ability to change between a 4 KB and 16 KB mode by toggling the developer choice over a reboot.

In case you are a tool producer or SoC developer, see our directions on find out how to allow and use this.

16 KB on x86_64 desktops

Whereas 16 KB pages are an ARM-only characteristic, we acknowledge that many builders are utilizing emulators on x86_64 {hardware}. With a view to bridge this hole for builders, we’ve added help to emulate 16 KB web page dimension for purposes on x86_64 emulators. On this mode, the Kernel runs in 4 KB mode, however all addresses uncovered to purposes are aligned to 16 KB, and arguments to operate calls similar to mmap(…MAP_FIXED…) are verified to be 16 KB aligned.

To get began, you’ll be able to obtain and run the 16 KB pages emulator contained in the Android Studio SDK supervisor. This manner, even if you happen to don’t have entry to ARM {hardware}, you’ll be able to nonetheless guarantee your purposes will work with 16 KB web page dimension.

16 KB pages emulator inside the Android Studio SDK manager

Future

On this publish, we’ve mentioned the technical particulars of how we’re restructuring reminiscence in Android to get quicker, extra performant gadgets. Android 15 and AOSP work with 16 KB pages, and gadgets can now implement 16 KB pages as a growth choice. This required modifications from the underside to the highest of the working system, in our growth tooling, and all through the Android ecosystem.

We’re wanting ahead to utility and SDK builders now to benefit from these choices and put together for extra performant and environment friendly Android gadgets in close to future.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles