Changeset 567 for trunk/kernel/mm/page.h
- Timestamp:
- Oct 5, 2018, 12:01:52 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/page.h
r486 r567 28 28 #include <kernel_config.h> 29 29 #include <hal_kernel_types.h> 30 #include < spinlock.h>30 #include <remote_busylock.h> 31 31 #include <list.h> 32 #include <slist.h>33 #include <xlist.h>34 32 35 33 /*** Forward declarations ***/ … … 39 37 /************************************************************************************* 40 38 * 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 41 40 ************************************************************************************/ 42 41 … … 45 44 #define PG_FREE 0x0004 // page can be allocated by PPM 46 45 #define PG_INLOAD 0x0008 // on-going load from disk 47 #define PG_IO_ERR 0x0010 // mapper signals a read/write access error48 #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] 49 48 #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 52 50 53 51 #define PG_ALL 0xFFFF // All flags … … 55 53 /************************************************************************************* 56 54 * 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] 61 58 ************************************************************************************/ 62 59 … … 68 65 uint32_t index; /*! page index in mapper (4) */ 69 66 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) */ 72 68 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) */ 74 70 } 75 71 page_t; … … 111 107 112 108 /************************************************************************************* 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 dirty124 ************************************************************************************/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 dirty133 ************************************************************************************/134 bool_t page_undo_dirty( page_t * page );135 136 /*************************************************************************************137 109 * This function resets to 0 all bytes in a given page. 138 110 ************************************************************************************* … … 140 112 ************************************************************************************/ 141 113 void 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 no154 * other waiting thread. If there is waiting thread(s), it activates the first155 * waiting thread without modifying the PG_LOCKED flag.156 *************************************************************************************157 * @ page : pointer on page descriptor.158 ************************************************************************************/159 void page_unlock( page_t * page );160 114 161 115 /*************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.