Changeset 632 for trunk/kernel/kern
- Timestamp:
- May 28, 2019, 2:56:04 PM (6 years ago)
- Location:
- trunk/kernel/kern
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/dqdt.c
r583 r632 373 373 // It traverses the quad tree from clusters to root. 374 374 /////////////////////////////////////////////////////////////////////////// 375 // @ node 375 // @ node_xp : extended pointer on current node 376 376 // @ increment : number of pages variation 377 377 /////////////////////////////////////////////////////////////////////////// 378 static void dqdt_propagate_pages( xptr_t node ,378 static void dqdt_propagate_pages( xptr_t node_xp, 379 379 int32_t increment ) 380 380 { 381 381 // get current node cluster identifier and local pointer 382 cxy_t cxy = GET_CXY( node);383 dqdt_node_t * ptr = GET_PTR( node);382 cxy_t node_cxy = GET_CXY( node_xp ); 383 dqdt_node_t * node_ptr = GET_PTR( node_xp ); 384 384 385 385 // update current node pages number 386 hal_remote_atomic_add( XPTR( cxy , &ptr->pages ) , increment );386 hal_remote_atomic_add( XPTR( node_cxy , &node_ptr->pages ) , increment ); 387 387 388 388 // get extended pointer on parent node 389 xptr_t parent = (xptr_t)hal_remote_l64( XPTR( cxy , &ptr->parent ) );389 xptr_t parent_xp = (xptr_t)hal_remote_l64( XPTR( node_cxy , &node_ptr->parent ) ); 390 390 391 391 // propagate if required 392 if ( parent != XPTR_NULL ) dqdt_propagate_pages( parent, increment ); 393 } 394 395 /////////////////////////////////////////// 396 void dqdt_increment_pages( uint32_t order ) 397 { 398 cluster_t * cluster = LOCAL_CLUSTER; 399 dqdt_node_t * node = &cluster->dqdt_tbl[0]; 400 401 // update DQDT node level 0 402 hal_atomic_add( &node->pages , (1 << order) ); 403 404 // propagate to DQDT upper levels 405 if( node->parent != XPTR_NULL ) dqdt_propagate_pages( node->parent , (1 << order) ); 392 if ( parent_xp != XPTR_NULL ) dqdt_propagate_pages( parent_xp, increment ); 393 } 394 395 //////////////////////////////////////// 396 void dqdt_increment_pages( cxy_t cxy, 397 uint32_t order ) 398 { 399 // get local pointer on node[0] (same in all clusters) 400 dqdt_node_t * node_ptr = &LOCAL_CLUSTER->dqdt_tbl[0]; 401 402 // update DQDT node[0] in remote cluster cxy 403 hal_remote_atomic_add( XPTR( cxy , &node_ptr->pages ) , (1 << order) ); 404 405 // get extended pointer on parent node in remote cluster cxy 406 xptr_t parent_xp = hal_remote_l64( XPTR( cxy , &node_ptr->parent ) ); 407 408 // propagate to DQDT upper levels 409 if( parent_xp != XPTR_NULL ) dqdt_propagate_pages( parent_xp , (1 << order) ); 406 410 407 411 #if DEBUG_DQDT_UPDATE_PAGES … … 409 413 if( cycle > DEBUG_DQDT_UPDATE_PAGES ) 410 414 printk("\n[DBG] %s : thread %x in process %x / %x pages in cluster %x / cycle %d\n", 411 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, node->pages, local_cxy, cycle ); 412 #endif 413 414 } 415 416 /////////////////////////////////////////// 417 void dqdt_decrement_pages( uint32_t order ) 418 { 419 cluster_t * cluster = LOCAL_CLUSTER; 420 dqdt_node_t * node = &cluster->dqdt_tbl[0]; 421 422 // update DQDT node level 0 423 hal_atomic_add( &node->pages , -(1 << order) ); 424 425 // propagate to DQDT upper levels 426 if( node->parent != XPTR_NULL ) dqdt_propagate_pages( node->parent , -(1 << order) ); 415 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, 416 hal_remote_l32( XPTR( cxy , &node_ptr->pages ), cxy, cycle ); 417 #endif 418 419 } 420 421 //////////////////////////////////////// 422 void dqdt_decrement_pages( cxy_t cxy, 423 uint32_t order ) 424 { 425 // get local pointer on node[0] (same in all clusters) 426 dqdt_node_t * node_ptr = &LOCAL_CLUSTER->dqdt_tbl[0]; 427 428 // update DQDT node[0] in remote cluster cxy 429 hal_remote_atomic_add( XPTR( cxy , &node_ptr->pages ) , -(1 << order) ); 430 431 // get extended pointer on parent node in remote cluster cxy 432 xptr_t parent_xp = hal_remote_l64( XPTR( cxy , &node_ptr->parent ) ); 433 434 // propagate to DQDT upper levels 435 if( parent_xp != XPTR_NULL ) dqdt_propagate_pages( parent_xp , -(1 << order) ); 427 436 428 437 #if DEBUG_DQDT_UPDATE_PAGES … … 430 439 if( cycle > DEBUG_DQDT_UPDATE_PAGES ) 431 440 printk("\n[DBG] %s : thread %x in process %x / %x pages in cluster %x / cycle %d\n", 432 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, node->pages, local_cxy, cycle ); 441 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, 442 hal_remote_l32( XPTR( cxy , &node_ptr->pages ), cxy, cycle ); 433 443 #endif 434 444 … … 478 488 if( cycle > DEBUG_DQDT_UPDATE_THREADS ) 479 489 printk("\n[DBG] %s : thread %x in process %x / %d threads in cluster %x / cycle %d\n", 480 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, node->threads, local_cxy, cycle ); 490 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, 491 node->threads, local_cxy, cycle ); 481 492 #endif 482 493 … … 499 510 if( cycle > DEBUG_DQDT_UPDATE_THREADS ) 500 511 printk("\n[DBG] %s : thread %x in process %x / %d threads in cluster %x / cycle %d\n", 501 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, node->threads, local_cxy, cycle ); 512 __FUNCTION__, CURRENT_THREAD->trdid, CURRENT_THREAD->process->pid, 513 node->threads, local_cxy, cycle ); 502 514 #endif 503 515 -
trunk/kernel/kern/dqdt.h
r583 r632 105 105 106 106 /**************************************************************************************** 107 * This local function updates the total number of pages in level 0 DQDT node, 108 * and immediately propagates the variation to the DQDT upper levels. 107 * These two functions can be called by any thread running in any cluster. 108 * They increment/decrement the total number of 4 Kbytes pages allocated in a cluster 109 * identified by the <cxy> argument, as specified by the <order> argument. The level 0 110 * DQDT node is udated, and this change is immediately propagated to upper levels. 109 111 * They are called by PPM on each physical memory page allocation or release. 110 112 **************************************************************************************** 111 * @ order : ln2( number of small pages ) 113 * @ cxy : target cluster identifier. 114 * @ order : ln2( number of 4 Kbytes pages ) 112 115 ***************************************************************************************/ 113 void dqdt_increment_pages( uint32_t order ); 114 void dqdt_decrement_pages( uint32_t order ); 116 void dqdt_increment_pages( cxy_t cxy , 117 uint32_t order ); 118 119 void dqdt_decrement_pages( cxy_t cxy, 120 uint32_t order ); 115 121 116 122 /**************************************************************************************** -
trunk/kernel/kern/kernel_init.c
r630 r632 133 133 134 134 "CLUSTER_KCM", // 1 135 " PPM_FREE",// 2136 " SCHED_STATE",// 3137 "VMM_ STACK",// 4138 "V MM_MMAP",// 5139 " VFS_CTX",// 6140 "K CM_STATE", // 7141 " KHM_STATE",// 8142 "HTAB_STATE", // 9 143 135 "SCHED_STATE", // 2 136 "VMM_STACK", // 3 137 "VMM_MMAP", // 4 138 "VFS_CTX", // 5 139 "KCM_STATE", // 6 140 "KHM_STATE", // 7 141 "HTAB_STATE", // 8 142 143 "PPM_FREE", // 9 144 144 "THREAD_JOIN", // 10 145 145 "XHTAB_STATE", // 11 -
trunk/kernel/kern/rpc.c
r629 r632 51 51 rpc_server_t * rpc_server[RPC_MAX_INDEX] = 52 52 { 53 &rpc_ pmem_get_pages_server,// 054 &rpc_ pmem_release_pages_server,// 155 &rpc_ ppm_display_server,// 253 &rpc_undefined, // 0 54 &rpc_undefined, // 1 55 &rpc_undefined, // 2 56 56 &rpc_process_make_fork_server, // 3 57 57 &rpc_user_dir_create_server, // 4 … … 87 87 char * rpc_str[RPC_MAX_INDEX] = 88 88 { 89 " PMEM_GET_PAGES",// 090 " PMEM_RELEASE_PAGES",// 191 " PPM_DISPLAY", // 289 "undefined_0", // 0 90 "undefined_1", // 1 91 "undefined_2", // 2 92 92 "PROCESS_MAKE_FORK", // 3 93 93 "USER_DIR_CREATE", // 4 … … 423 423 424 424 ///////////////////////////////////////////////////////////////////////////////////////// 425 // [0] Marshaling functions attached to RPC_PMEM_GET_PAGES (blocking) 426 ///////////////////////////////////////////////////////////////////////////////////////// 427 425 // [0] RPC_PMEM_GET_PAGES deprecated [AG] May 2019 426 ///////////////////////////////////////////////////////////////////////////////////////// 427 428 /* 428 429 /////////////////////////////////////////////// 429 430 void rpc_pmem_get_pages_client( cxy_t cxy, … … 495 496 #endif 496 497 } 497 498 ///////////////////////////////////////////////////////////////////////////////////////// 499 // [1] Marshaling functions attached to RPC_PMEM_RELEASE_PAGES 500 ///////////////////////////////////////////////////////////////////////////////////////// 501 498 */ 499 500 ///////////////////////////////////////////////////////////////////////////////////////// 501 // [1] RPC_PMEM_RELEASE_PAGES deprecated [AG] may 2019 502 ///////////////////////////////////////////////////////////////////////////////////////// 503 504 /* 502 505 ////////////////////////////////////////////////// 503 506 void rpc_pmem_release_pages_client( cxy_t cxy, … … 565 568 #endif 566 569 } 567 568 ///////////////////////////////////////////////////////////////////////////////////////// 569 // [2] Marshaling functions attached to RPC_PPM_DISPLAY 570 ///////////////////////////////////////////////////////////////////////////////////////// 571 570 */ 571 572 ///////////////////////////////////////////////////////////////////////////////////////// 573 // [2] RPC_PPM_DISPLAY deprecated [AG] May 2019 574 ///////////////////////////////////////////////////////////////////////////////////////// 575 576 /* 572 577 ///////////////////////////////////////// 573 578 void rpc_ppm_display_client( cxy_t cxy ) … … 621 626 #endif 622 627 } 628 */ 623 629 624 630 ///////////////////////////////////////////////////////////////////////////////////////// -
trunk/kernel/kern/rpc.h
r628 r632 60 60 typedef enum 61 61 { 62 RPC_ PMEM_GET_PAGES = 0,63 RPC_ PMEM_RELEASE_PAGES = 1,64 RPC_ PPM_DISPLAY = 2,62 RPC_UNDEFINED_0 = 0, // RPC_PMEM_GET_PAGES deprecated [AG] 63 RPC_UNDEFINED_1 = 1, // RPC_PMEM_RELEASE_PAGES deprecated [AG] 64 RPC_UNDEFINED_2 = 2, // RPC_PMEM_DISPLAY deprecated [AG] 65 65 RPC_PROCESS_MAKE_FORK = 3, 66 66 RPC_USER_DIR_CREATE = 4, … … 177 177 * [0] The RPC_PMEM_GET_PAGES allocates one or several pages in a remote cluster, 178 178 * and returns the local pointer on the page descriptor. 179 * deprecated [AG] may 2019 179 180 *********************************************************************************** 180 181 * @ cxy : server cluster identifier … … 182 183 * @ page : [out] local pointer on page descriptor / NULL if failure 183 184 **********************************************************************************/ 185 186 /* 184 187 void rpc_pmem_get_pages_client( cxy_t cxy, 185 188 uint32_t order, … … 187 190 188 191 void rpc_pmem_get_pages_server( xptr_t xp ); 192 */ 189 193 190 194 /*********************************************************************************** 191 195 * [1] The RPC_PMEM_RELEASE_PAGES release one or several pages to a remote cluster. 196 * deprecated [AG] may 2019 192 197 *********************************************************************************** 193 198 * @ cxy : server cluster identifier 194 199 * @ page : [in] local pointer on page descriptor to release. 195 200 **********************************************************************************/ 201 202 /* 196 203 void rpc_pmem_release_pages_client( cxy_t cxy, 197 204 struct page_s * page ); 198 205 199 206 void rpc_pmem_release_pages_server( xptr_t xp ); 207 */ 200 208 201 209 /*********************************************************************************** 202 210 * [2] The RPC_PPM_DISPLAY allows any client thread to require any remote cluster 203 211 * identified by the <cxy> argumentto display the physical memory allocator state. 204 **********************************************************************************/ 212 * deprecated [AG] may 2019 213 **********************************************************************************/ 214 215 /* 205 216 void rpc_ppm_display_client( cxy_t cxy ); 206 217 207 218 void rpc_ppm_display_server( xptr_t xp ); 219 */ 208 220 209 221 /***********************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.