←back to thread

Bought myself an Ampere Altra system

(marcin.juszkiewicz.com.pl)
204 points pabs3 | 1 comments | | HN request time: 1.566s | source
Show context
amelius ◴[] No.44421186[source]
> And the latest one, an Apple MacBook Pro, is nice and fast but has some limits — does not support 64k page size. Which I need for my work.

I wonder where this requirement comes from ...

replies(3): >>44421250 #>>44421494 #>>44421603 #
ot ◴[] No.44421250[source]
I would guess to develop and test software that will ultimately run on a system with 64k page size.
replies(1): >>44421261 #
amelius ◴[] No.44421261[source]
Is there a fundamental advantage over other page sizes, other than the convenience of 64k == 2^16?
replies(4): >>44421331 #>>44421363 #>>44421743 #>>44435389 #
dan-robertson ◴[] No.44421743[source]
The reason to want small pages is that the page is often the smallest unit that the operating system can work with, so bigger pages can be less efficient – you need more ram for the same number of memory mapped files, tricks like guard pages or mapping the same memory twice for a ring buffer have a bigger minimum size, etc.

The reason to want pages of exactly 4k is that software is often tuned for this and may even require this from not being programmed in a sufficiently hardware agnostic way (similar to why running lots of software on big median systems can be hard).

The reasons to want bigger pages are:

- there is more OS overhead tracking tiny pages

- as well as caches for memory, CPUs have caches for the mapping between virtual memory and physical memory, and this mapping is page-size granularity. These caches are very small (as they have to be extremely fast) so bigger pages means memory accesses are more likely to go to pages in the cache, which means faster memory accesses.

- CPU caches are addressed based on the index into the minimum page size so the max size of a cache is page-size * associativity. I think it can be harder to increase the latter than the former so bigger pages could allow for bigger caches, which can make some software perform better.

These things you see in practice are:

- x86 supports 2MB and 2GB pages, as well as 4KB pages. Linux can either directly give you pages in this larger size (a fixed number are allocated at startup by the OS) or there is a feature called ‘transparent hugepages’ where sufficiently aligned contiguous smaller pages can be merged. This mostly helps with the first two problems

- I think the Apple M-series chips have an 8k minimum page size, which might help with the third problem but I don’t really know about them

replies(1): >>44425440 #
1. p_ing ◴[] No.44425440[source]
I believe this is true for x86 as a whole, but on NT any large page must be mapped with a single protection applied to the entire page, so if the page contains read-only code and read-write data, the entire page must be marked read-write.