Changeset 632 for trunk/kernel/kern/dqdt.c
- Timestamp:
- May 28, 2019, 2:56:04 PM (5 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.