little memory optimization in fetch-function

This commit is contained in:
Generic account for RWTHAachen Students 2011-06-06 08:32:59 -07:00
parent 521c3e1bc9
commit 240abdef8c

View file

@ -33,6 +33,10 @@
#ifdef CONFIG_ROCKCREEK
#include <asm/iRCCE_lib.h>
// forward declaration
static int iRCCE_mailbox_close_one(int rank, int check);
//------------------------------------------------------------------------------
// FUNCTION: iRCCE_mailbox_print_header
//------------------------------------------------------------------------------
@ -90,8 +94,8 @@ static int iRCCE_mail_fetch(
// check if received a last-mail
if( header->tag == iRCCE_LAST_MAIL ) {
iRCCE_last_mail[rank] = 1;
iRCCE_mailbox_close( rank ); // we can close respective mailbox
kfree( header, sizeof(iRCCE_MAIL_HEADER) );
iRCCE_mailbox_close_one( rank, 0 ); // we can close respective mailbox
iRCCE_mail_release( &header );
}
else {
// check mail priority
@ -316,12 +320,12 @@ int iRCCE_mailbox_flush(void) {
//------------------------------------------------------------------------------
// routine to close one mailbox
//------------------------------------------------------------------------------
static int iRCCE_mailbox_close_one(int rank) {
static int iRCCE_mailbox_close_one(int rank, int check) {
RCCE_acquire_lock( RCCE_IAM );
// check if it contains new mail
RC_cache_invalidate();
if( iRCCE_mailbox_recv[rank]->sent ) {
if( check && iRCCE_mailbox_recv[rank]->sent ) {
iRCCE_mail_fetch(rank);
}
@ -351,11 +355,11 @@ int iRCCE_mailbox_close(int rank) {
if( rank == iRCCE_MAILBOX_ALL ) {
int i;
for( i=0; i<RCCE_NP; ++i ) {
iRCCE_mailbox_close_one( i );
iRCCE_mailbox_close_one( i, 1 );
}
}
else {
iRCCE_mailbox_close_one( rank );
iRCCE_mailbox_close_one( rank, 1 );
}
return iRCCE_SUCCESS;