Changeset 567 for trunk/kernel/mm/mapper.c
- Timestamp:
- Oct 5, 2018, 12:01:52 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/mm/mapper.c
r457 r567 36 36 #include <kmem.h> 37 37 #include <kcm.h> 38 #include <ppm.h> 38 39 #include <page.h> 39 40 #include <cluster.h> 40 41 #include <vfs.h> 41 42 #include <mapper.h> 43 42 44 43 45 ////////////////////////////////////////////// … … 83 85 84 86 // initialize mapper lock 85 rwlock_init( &mapper->lock );87 rwlock_init( &mapper->lock , LOCK_MAPPER_STATE ); 86 88 87 89 // initialize waiting threads xlist (empty) … … 153 155 154 156 // take mapper lock in READ_MODE 155 rwlock_rd_ lock( &mapper->lock );157 rwlock_rd_acquire( &mapper->lock ); 156 158 157 159 // search page in radix tree … … 163 165 164 166 // release the lock in READ_MODE and take it in WRITE_MODE 165 rwlock_rd_ unlock( &mapper->lock );166 rwlock_wr_ lock( &mapper->lock );167 rwlock_rd_release( &mapper->lock ); 168 rwlock_wr_acquire( &mapper->lock ); 167 169 168 170 // second test on missing page because the page status can have been modified … … 189 191 printk("\n[ERROR] in %s : thread %x cannot allocate a page in cluster %x\n", 190 192 __FUNCTION__ , this->trdid , local_cxy ); 191 rwlock_wr_ unlock( &mapper->lock );193 rwlock_wr_release( &mapper->lock ); 192 194 return NULL; 193 195 } … … 204 206 205 207 // release mapper lock from WRITE_MODE 206 rwlock_wr_ unlock( &mapper->lock );208 rwlock_wr_release( &mapper->lock ); 207 209 208 210 if( error ) … … 239 241 { 240 242 // release mapper lock from WRITE_MODE 241 rwlock_wr_ unlock( &mapper->lock );243 rwlock_wr_release( &mapper->lock ); 242 244 243 245 // wait load completion 244 while( 1 )246 while( page_is_flag( page , PG_INLOAD ) == false ) 245 247 { 246 // exit waiting loop when loaded 247 if( page_is_flag( page , PG_INLOAD ) == false ) break; 248 249 // deschedule 248 // deschedule without blocking 250 249 sched_yield("waiting page loading"); 251 250 } … … 254 253 else // page available in mapper 255 254 { 256 rwlock_rd_ unlock( &mapper->lock );255 rwlock_rd_release( &mapper->lock ); 257 256 } 258 257 … … 284 283 285 284 // take mapper lock in WRITE_MODE 286 rwlock_wr_ lock( &mapper->lock );285 rwlock_wr_acquire( &mapper->lock ); 287 286 288 287 // remove physical page from radix tree … … 290 289 291 290 // release mapper lock from WRITE_MODE 292 rwlock_wr_ unlock( &mapper->lock );291 rwlock_wr_release( &mapper->lock ); 293 292 294 293 // release page to PPM … … 372 371 else 373 372 { 374 p age_do_dirty( page );373 ppm_page_do_dirty( page ); 375 374 hal_copy_from_uspace( map_ptr , buf_ptr , page_count ); 376 375 } … … 485 484 dst_ptr = base_ptr + page_offset; 486 485 487 p age_do_dirty( page );486 ppm_page_do_dirty( page ); 488 487 } 489 488
Note: See TracChangeset
for help on using the changeset viewer.