fn swap_manager(
        gmanager: &'static GlobalMemory,
        current_arena: &mut PhysicalMemoryArena,
        arenas: &mut [Option<PhysicalMemoryArena>],
        node: atopology::NodeId,
    ) -> Result<(), KError> {
        if node < arenas.len() && node < atopology::MACHINE_TOPOLOGY.num_nodes() {
            if arenas[node].is_none() {
                arenas[node] = Some(PhysicalMemoryArena::new(node, gmanager));
            }
            debug_assert!(arenas[node].is_some());
            let mut arena = arenas[node].take().unwrap();
            debug_assert_eq!(arena.affinity, node);

            core::mem::swap(&mut arena, current_arena);
            arenas[arena.affinity as usize].replace(arena);

            Ok(())
        } else {
            Err(KError::InvalidAffinityId)
        }
    }
// Swaps out the current arena (from where we allocate memory) with a new
// arena from the one that can get memory from the provided `node`. If no
// arena for the current `node` exists, we create a new arena.
Swaps out the current arena (from where we allocate memory) with a new
arena from the one that can get memory from the provided `node`. If no
arena for the current `node` exists, we create a new arena.
Swaps out the current arena ( from where we allocate memory ) with a new arena from the one that can get memory from the provided ` node ` . If no arena for the current ` node ` exists we create a new arena .
fn swap_manager(
        gmanager: &'static GlobalMemory,
        current_arena: &mut PhysicalMemoryArena,
        arenas: &mut [Option<PhysicalMemoryArena>],
        node: atopology::NodeId,
    ) -> Result<(), KError> {
        if node < arenas.len() && node < atopology::MACHINE_TOPOLOGY.num_nodes() {
            if arenas[node].is_none() {
                arenas[node] = Some(PhysicalMemoryArena::new(node, gmanager));
            }
            debug_assert!(arenas[node].is_some());
            let mut arena = arenas[node].take().unwrap();
            debug_assert_eq!(arena.affinity, node);
            core::mem::swap(&mut arena, current_arena);
            arenas[arena.affinity as usize].replace(arena);
            Ok(())
        } else {
            Err(KError::InvalidAffinityId)
        }
    }
fn swap_manager ( gmanager : & ' static GlobalMemory , current_arena : & mut PhysicalMemoryArena , arenas : & mut [ Option < PhysicalMemoryArena > ] , node : atopology :: NodeId , ) -> Result < ( ) , KError > { if node < arenas . len ( ) && node < atopology :: MACHINE_TOPOLOGY . num_nodes ( ) { if arenas [ node ] . is_none ( ) { arenas [ node ] = Some ( PhysicalMemoryArena :: new ( node , gmanager ) ) ; } debug_assert ! ( arenas [ node ] is_some ( ) ) ; let mut arena = arenas [ node ] . take ( ) . unwrap ( ) ; debug_assert_eq ! ( arena affinity node ) ; core :: mem :: swap ( & mut arena , current_arena ) ; arenas [ arena . affinity as usize ] . replace ( arena ) ; Ok ( ( ) ) } else { Err ( KError :: InvalidAffinityId ) } }
Swaps out the current arena (from where we allocate memory) with a new
arena from the one that can get memory from the provided `node`.
Swaps out the current arena ( from where we allocate memory ) with a new arena from the one that can get memory from the provided ` node ` .
gmanager
&'static GlobalMemory
current_arena
&mut PhysicalMemoryArena
arenas
&mut [Option<PhysicalMemoryArena>]
node
atopology::NodeId
gmanager
&'static GlobalMemory
current_arena
&mut PhysicalMemoryArena
arenas
&mut [Option<PhysicalMemoryArena>]
node
atopology::NodeId