Changeset 567 for trunk/kernel/mm/page.h


Ignore:
Timestamp:
Oct 5, 2018, 12:01:52 AM (6 years ago)
Author:
alain
Message:

Complete restructuration of kernel locks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/mm/page.h

    r486 r567  
    2828#include <kernel_config.h>
    2929#include <hal_kernel_types.h>
    30 #include <spinlock.h>
     30#include <remote_busylock.h>
    3131#include <list.h>
    32 #include <slist.h>
    33 #include <xlist.h>
    3432
    3533/***   Forward declarations   ***/
     
    3937/*************************************************************************************
    4038 * This  defines the flags that can be attached to a physical page.
     39 * TODO : the PG_BUFFER and PG_IO_ERR flags semantic is not defined
    4140 ************************************************************************************/
    4241
     
    4544#define PG_FREE             0x0004     // page can be allocated by PPM
    4645#define PG_INLOAD           0x0008     // on-going load from disk
    47 #define PG_IO_ERR           0x0010     // mapper signals a read/write access error
    48 #define PG_BUFFER           0x0020     // used in blockio.c
     46#define PG_IO_ERR           0x0010     // mapper signals access error    TODO ??? [AG]
     47#define PG_BUFFER           0x0020     // used in blockio.c              TODO ??? [AG]
    4948#define PG_DIRTY            0x0040     // page has been written
    50 #define PG_LOCKED       0x0080     // page is locked
    51 #define PG_COW          0x0100     // page is copy-on-write
     49#define PG_COW          0x0080     // page is copy-on-write
    5250
    5351#define PG_ALL          0xFFFF     // All flags
     
    5553/*************************************************************************************
    5654 * This structure defines a physical page descriptor.
    57  * Size is 64 bytes for a 32 bits core...
    58  * The spinlock is used to test/modify the forks counter.
    59  * TODO : the list of waiting threads seems to be unused [AG]
    60  * TODO : the refcount use has to be clarified
     55 * The busylock is used to test/modify the forks counter.
     56 * NOTE: Size is 44 bytes for a 32 bits core...
     57 * TODO : the refcount use has to be clarified [AG]
    6158 ************************************************************************************/
    6259
     
    6865    uint32_t          index;          /*! page index in mapper                 (4)  */
    6966        list_entry_t      list;           /*! for both dirty pages and free pages  (8)  */
    70     xlist_entry_t     wait_root;      /*! root of list of waiting threads      (16) */
    71         uint32_t          refcount;       /*! reference counter                    (4)  */
     67        uint32_t          refcount;       /*! reference counter TODO ??? [AG]      (4)  */
    7268        uint32_t          forks;          /*! number of pending forks              (4)  */
    73         spinlock_t        lock;           /*! protect the forks field              (4) */
     69        remote_busylock_t lock;           /*! protect all accesses to page         (12) */
    7470}
    7571page_t;
     
    111107
    112108/*************************************************************************************
    113  * This function synchronizes (i.e. update the disk) all dirty pages in a cluster.
    114  * It scans the PPM dirty list, that should be empty when this operation is completed.
    115  ************************************************************************************/
    116 void sync_all_pages( void );
    117 
    118 /*************************************************************************************
    119  * This function sets the PG_DIRTY flag in the page descriptor,
    120  * and registers the page in the dirty list in PPM.
    121  *************************************************************************************
    122  * @ page     : pointer on page descriptor.
    123  * @ returns true if page was not dirty / returns false if page was dirty
    124  ************************************************************************************/
    125 bool_t page_do_dirty( page_t * page );
    126 
    127 /*************************************************************************************
    128  * This function resets the PG_DIRTY flag in the page descriptor,
    129  * and removes the page from the dirty list in PPM.
    130  *************************************************************************************
    131  * @ page     : pointer on page descriptor.
    132  * @ returns true if page was dirty / returns false if page was not dirty
    133  ************************************************************************************/
    134 bool_t page_undo_dirty( page_t * page );
    135 
    136 /*************************************************************************************
    137109 * This function resets to 0 all bytes in a given page.
    138110 *************************************************************************************
     
    140112 ************************************************************************************/
    141113void page_zero( page_t * page );
    142 
    143 /*************************************************************************************
    144  * This blocking function set the PG_LOCKED flag on the page.
    145  * It deschedule if the page has already been locked by another thread,
    146  * and returns only when the flag has been successfully set.
    147  *************************************************************************************
    148  * @ page     : pointer on page descriptor.
    149  ************************************************************************************/
    150 void page_lock( page_t * page );
    151 
    152 /*************************************************************************************
    153  * This blocking function resets the PG_LOCKED flag on the page, if there is no
    154  * other waiting thread. If there is waiting thread(s), it activates the first
    155  * waiting thread without modifying the PG_LOCKED flag.
    156  *************************************************************************************
    157  * @ page     : pointer on page descriptor.
    158  ************************************************************************************/
    159 void page_unlock( page_t * page );
    160114
    161115/*************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.