-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce "ondemand" linker sections #77827
Conversation
This provides __ondemand_func and __ondemand_rodata tags for annotating functions and read-only data that should be loaded on demand so not to exhaust all available RAM. The demand paging mechanism will be leveraged to load so designated code/data as needed and to evict it from memory when unused. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This sets initial unpaged mappings for __ondemand_func code and __ondemand_rodata variables. To achieve this, we have to augment the backing store API. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
Pinned sections can still be used, right?
Well, you have to choose. Either you have explicit pinned sections and
everything else is implicitly evictable, or you have explicit on-demand
(aka evictable) sections and everything else is implicitly pinned. Both
tags may coexist of course.
|
Wonder if they should be make mutually exclusive by adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I do kind of worry that we've now implemented two converse solutions to the same problem... Clearly the API can be different with how the defaults work, but surely the backend should be the same for "pinned" and "on demand", no?
Not a -1, but sort of a smell complaint.
Nothing prevents both strategies from using the same backend. But their
initial state must differs.
In the explicit pinned model, everything is initially in memory and
stuff gets evicted when memory is tight. The backing store is used as a
swap space and is initially unpopu;ated. This assumes the firmware may
all fit in memory at boot time.
In the explicit on-demand model, most everything is initially in the
evicted state. The backing store already contains the evicted stuff,
most likely in read-only mode. This is especially useful when the
firmware is bigger than available RAM and no XIP is possible.
Where both strategies differ the most is in their initial MMU mappings.
|
@andyross @peter-mitsis ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, never actually +1'd. Still kind of worry about the bifurcation, but this is clean enough.
This is needed when the firmware is significantly bigger than the available
RAM.
This can be seen in action with the ARM64 demand paging support in PR #74129.