3

I am in middle of integrating an application software into a custom Embedded Linux distribution from a chip-set vendor. This is an ARM based product that I am working on. I noticed that the kernel is being built in 64 bit, but rest of the user space is 32 bit.

Are there any performance benefits of building kernel as 64 bit even though the user space in 32 bit? The SOC is based on ARM cortex-a53.

Someone suggested having user space in 32 bit will result in smaller RAM foot print for user space. The same should apply to the kernel, but the kernel is 64 bit. I am guessing there is a gain in performance?

some specific about the hardware:

  • ARM cortex a53
  • 1 GB RAM

P.S: I cannot disclose the vendor name due to non-disclosure restrictions.

1
  • @Patrick, I deleted the post from stackoverflow as it was pointed that the question is more relevant here.
    – sob
    Jun 2, 2017 at 2:29

1 Answer 1

1

The virtual address space of Linux process is divided into two areas:

  • kernel space
  • user space.

Split on 32 Bit Architectures

On a 32 bit architecture, e.g., arm or i386, the traditional split is 3:1, as shown below:

    +--------+ 0xffffffff
    | Kernel |
    +--------+ 0xc0000000
    |        |
    | User   |
    |        |
    +--------+ 0x00000000
  • Kernel Space - 1 GiB
  • User Space - 3 GiB

Thus kernel can at most map 1 GiB of physical memory at any one time, but there is further split, because we need virtual address space for temporary maps to access the rest of the physical memory. The split is as follows:

  • lower 896 MiB (0xc0000000 to 0xf7ffffff) is directly mapped to the kernel physical address space
  • the remaining 128 MiB (0xf8000000 to 0xffffffff) is used on demand by the kernel to map to high memory.

The arrangement is as follows:

                                                 physical memory 2 GiB 
                                          +------> +------------+
                                          |        |  1152 MiB  |  
                                          |        |            |  
    +------------------+ 0xffffffff  -----+        |  HIGH MEM  |  
    | On Demand 128MiB |                           |            |  
    +------------------+ 0xf8000000  ------------> +------------+  
    |                  |             ------+  
    |  Direct mapped   |                   +-----> +------------+   
    |    896 MiB       |             --+           |   896 MiB  |        
    +------------------+ 0xc0000000    +---------> +------------+  

Thus, the Linux kernel through the highmem interface provides indirect access to this physical memory in range of 2/4/6/8 GiB. But, there is associated cost of creating temporary mappings which can be quite high. The arch has to manipulate the kernel's page tables, the data TLB and/or the MMU's registers.

On 64-bit Architectures

The 3G/1G split does not apply. Due to the huge address space, a split scheme between user space and kernel space can be chosen that allows to map the whole physical memory into kernel address space. Thus saving all the overheads of temporary mappings that a 32 bit architecture incurs.

The high memory support is optional in case Linux kernel on 64 bit Architectures and is even disabled disabled in cases Linux on 64 bit architectures.

Reference: Linux High Memory Handling.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .