src/sys/mm/rmem/main.c
/**
 * @brief Handles remote memory allocation.
 *
 * @returns Upon successful completion, the number of the newly
 * allocated remote memory block is allocated. Upon failure, @p
 * RMEM_NULL is returned instead.
 */
@brief Handles remote memory allocation.
@returns Upon successful completion, the number of the newly
allocated remote memory block is allocated. Upon failure, @p
RMEM_NULL is returned instead.
@brief Handles remote memory allocation . @returns Upon successful completion the number of the newly allocated remote memory block is allocated . Upon failure @p RMEM_NULL is returned instead .
static inline rpage_t do_rmem_alloc(void)
{
	bitmap_t bit;
	if (stats.nblocks == RMEM_NUM_BLOCKS)
	{
	uprintf("[nanvix][rmem] remote memory full");
		return (RMEM_NULL);
	}
	uassert(
		(bit = bitmap_first_free(
			blocks,
			RMEM_NUM_BLOCKS
		)) != BITMAP_FULL
	);
	stats.nblocks++;
	bitmap_set(blocks, bit);
	rmem_debug("rmem_alloc() blknum=%d nblocks=%d/%d",
		bit, stats.nblocks, RMEM_NUM_BLOCKS
	);
	return (RMEM_BLOCK(serverid, bit));
}
static inline rpage_t do_rmem_alloc ( void ) { bitmap_t bit ; if ( stats . nblocks == RMEM_NUM_BLOCKS ) { uprintf ( " " ) ; return ( RMEM_NULL ) ; } uassert ( ( bit = bitmap_first_free ( blocks , RMEM_NUM_BLOCKS ) ) != BITMAP_FULL ) ; stats . nblocks ++ ; bitmap_set ( blocks , bit ) ; rmem_debug ( " " , bit , stats . nblocks , RMEM_NUM_BLOCKS ) ; return ( RMEM_BLOCK ( serverid , bit ) ) ; }
@brief Handles remote memory allocation.
@brief Handles remote memory allocation .
/* Memory server is full. */ /* Find a free block. */ /* Allocate block. */