Hi!

The topic is *on-demand paging and "lazy loading" on NuttX*.

Well, the on-demand paging article
<https://nuttx.apache.org/docs/latest/components/paging.html> (and `
CONFIG_PAGING
<https://github.com/apache/incubator-nuttx/blob/90f24ec29d0731cdda4b1db14ec73a87d88c50bf/arch/Kconfig#L888>`)
seems to have implemented the dynamic loading of instruction sections
(*.text) from a non-volatile media to internal RAM (able to execute
instructions). This was done mainly for LPC31xx and stated that it isn't
complete yet (a kind of experiment) and it does contain a page fault
handling logic.

On the other hand, one could use the Shared Memory Support
<https://nuttx.apache.org/docs/latest/components/mm/shm.html> mechanism of
paging allocation to implement on-demand paging. It even states that:

> NOTE: An improved implementation my perform a “lazy” back up of the
> physical memory, i.e., do not allocate the physical memory until the memory
> is required, for example, when a page fault occurs when a application tries
> to allocate the memory.
>

But lacks the "page fault" mechanism to provide a newly mapped page for the
task that caused the exception.

I may be missing something about this subject, but have you thought about
it? The idea is to allocate bigger virtual memory to the tasks' stack (with
few mapped pages) and treat page fault exceptions when they occur (and
freeing physical memory when it isn't needed anymore, making it possible to
be mapped to other pages if needed). How far are we from providing that?

Any thoughts about it?

Best regards,

-- 
Tiago Medicci Serrano

Embedded Software Engineer
MSc Electronics/Microelectronics
m: +55 (19) 981403886 <+55+(19)+981403886>
e: tiago.medi...@gmail.com
a: Campinas, Brazil
Follow me:
<https://www.linkedin.com/in/tiago-serrano-924458b6>
<https://github.com/tmedicci>

Reply via email to