diff --git a/Documentation/NuttXDemandPaging.html b/Documentation/NuttXDemandPaging.html index cf4bb0ce42a..fb0894d6bef 100755 --- a/Documentation/NuttXDemandPaging.html +++ b/Documentation/NuttXDemandPaging.html @@ -72,7 +72,7 @@   - Fill Initiation + Fill Initiation @@ -160,14 +160,14 @@
g_waitingforfill
An OS list that is used to hold the TCBs of tasks that are waiting for a page fill.
-
g_pendingfill
+
g_pendingfilltcb
A variable that holds a reference to the TCB of the thread that is currently be re-filled.
g_pgworker
The process ID of of the thread that will perform the page fills.
pg_callback()
The callback function that is invoked from a driver when the fill is complete.
pg_miss()
-
The function that is called from chip-specific code to handle a page fault.
+
The function that is called from architecture-specific code to handle a page fault.
TCB
Task Control Block
@@ -215,8 +215,10 @@

Declarations for g_waitingforfill, g_pgworker, and other internal, private definitions will be provided in sched/pg_internal.h. - All public definitions that should be used by the chip-specific code will be available - in include/nuttx/page.h and include/nuttx/arch.h. + All public definitions that should be used by the architecture-specific code will be available + in include/nuttx/page.h. + Most architecture-specific functions are declared in include/nuttx/arch.h, + but for the case of this paging logic, those architecture specific functions are instead declared in include/nuttx/page.h.

Page Faults

@@ -244,6 +246,7 @@ Boost the page fill worker thread priority. Check the priority of the task at the head of the g_waitingforfill list. If the priority of that task is higher than the current priority of the page fill worker thread, then boost the priority of the page fill worker thread to that priority. + Thus, the page fill worker thread will always run at the priority of the highest priority task that is waiting for a fill.
  • Signal the page fill worker thread. @@ -277,51 +280,46 @@ Interrupt handling logic must always be available and "locked" into memory so that page faults never come from interrupt handling.
  • - The chip-specific page fault exception handling has already verified that the exception did not occur from interrupt/exception handling logic. + The architecture-specific page fault exception handling has already verified that the exception did not occur from interrupt/exception handling logic.
  • As mentioned above, the task causing the page fault must not be the page fill worker thread because that is the only way to complete the page fill.
  • -

    - Locking code in Memory. - One way to accomplish this would be a two phase link: -

    -

    Fill Initiation

    - The page fill worker thread will be awakened on one of two conditions: + The page fill worker thread will be awakened on one of three conditions:

    - The page fill worker thread will maintain a static variable called _TCB *g_pendingfill. - If not fill is in progress, g_pendingfill will be NULL. - Otherwise, will point to the TCB of the task which is receiving the fill that is in progess. + The page fill worker thread will maintain a static variable called _TCB *g_pendingfilltcb. + If no fill is in progress, g_pendingfilltcb will be NULL. + Otherwise, it will point to the TCB of the task which is receiving the fill that is in progess.

    +

    - When awakened from pg_miss(), no fill will be in progress and g_pendingfill will be NULL. + When awakened from pg_miss(), no fill will be in progress and g_pendingfilltcb will be NULL. In this case, the page fill worker thread will call pg_startfill(). That function will perform the following operations:

    - While the fill is in progress, other tasks may execute. - If another page fault occurs during this time, the faulting task will be blocked and its TCB will be added (in priority order) to g_waitingforfill. + In any case, while the fill is in progress, other tasks may execute. + If another page fault occurs during this time, the faulting task will be blocked, its TCB will be added (in priority order) to g_waitingforfill, and the priority of the page worker task may be boosted. But no action will be taken until the current page fill completes. NOTE: The IDLE task must also be fully locked in memory. The IDLE task cannot be blocked. It the case where all tasks are blocked waiting for a page fill, the IDLE task must still be available to run.

    - The chip-specific functions, up_allocpage(tcb, &vpage) and up_fillpage(page, pg_callback) + The architecture-specific functions, up_checkmapping(), up_allocpage(tcb, &vpage) and up_fillpage(page, pg_callback) will be prototyped in include/nuttx/arch.h

    Fill Complete

    - When the chip-specific driver completes the page fill, it will call the pg_callback() that was provided to up_fillpage. - pg_callback() will probably be called from driver interrupt-level logic. - The driver ill provide the result of the fill as an argument. + For the blocking up_fillpage(), the result of the fill will be returned directly from the call to up_fillpage. +

    +

    + For the non-blocking up_fillpage(), the architecture-specific driver call the pg_callback() that was provided to up_fillpage() when the fill completes. + In this case, the pg_callback() will probably be called from driver interrupt-level logic. + The driver will provide the result of the fill as an argument to the callback function. NOTE: pg_callback() must also be locked in memory.

    - When pg_callback() is called, it will perform the following operations: + In this non-blocking case, the callback pg_callback() will perform the following operations when it is notified that the fill has completed: