@@ -631,7 +631,7 @@ unsafe impl GlobalAlloc for KernelAllocator {
631631 |pcm| {
632632 #[ cfg( feature = "rackscale" ) ]
633633 {
634- use crate :: transport:: shmem:: { is_shmem_addr, SHMEM_INITIALIZED } ;
634+ use crate :: transport:: shmem:: { is_shmem_addr, is_shmem_addr_with_affinity , SHMEM_INITIALIZED } ;
635635 use core:: sync:: atomic:: Ordering ;
636636
637637 // If shmem is not initialized, do not force it.
@@ -640,10 +640,10 @@ unsafe impl GlobalAlloc for KernelAllocator {
640640 let affinity = { pcm. physical_memory . borrow ( ) . affinity } ;
641641 if is_shmem_addr ( ptr as u64 , false , false ) {
642642 panic ! ( "Should not be trying to dealloc non-kernel mapped shmem in kernel dealloc" ) ;
643- } else if is_shmem_affinity ( affinity) && !is_shmem_addr ( ptr as u64 , false , true ) {
644- log:: error!( "Trying to deallocate non- shmem into shmem allocator - losing this memory. Oh well." ) ;
643+ } else if is_shmem_affinity ( affinity) && !is_shmem_addr_with_affinity ( ptr as u64 , affinity , true ) {
644+ log:: error!( "Trying to deallocate memory not in shmem affinity into shmem allocator - losing this memory. Oh well." ) ;
645645 return ;
646- } else if !is_shmem_affinity ( affinity) && ( is_shmem_addr ( ptr as u64 , false , true ) ) {
646+ } else if !is_shmem_affinity ( affinity) && is_shmem_addr ( ptr as u64 , false , true ) {
647647 log:: error!( "Trying to deallocate shmem into non-shmem allocator - losing this memory. Oh well." ) ;
648648 return ;
649649 }
@@ -743,18 +743,18 @@ unsafe impl GlobalAlloc for KernelAllocator {
743743 } else {
744744 #[ cfg( feature = "rackscale" ) ]
745745 {
746- use crate :: transport:: shmem:: { is_shmem_addr, SHMEM_INITIALIZED } ;
746+ use crate :: transport:: shmem:: { is_shmem_addr, is_shmem_addr_with_affinity , SHMEM_INITIALIZED } ;
747747 use core:: sync:: atomic:: Ordering ;
748748
749749 // If shmem is not initialized, do not force it.
750750 if 0 != SHMEM_INITIALIZED . load ( Ordering :: SeqCst ) {
751751 let affinity = { pcm. physical_memory . borrow ( ) . affinity } ;
752752 if is_shmem_addr ( ptr as u64 , false , false ) {
753753 panic ! ( "Should not be trying to realloc non-kernel mapped shmem in kernel dealloc" ) ;
754- } else if is_shmem_affinity ( affinity) && !is_shmem_addr ( ptr as u64 , false , true ) {
754+ } else if is_shmem_affinity ( affinity) && !is_shmem_addr_with_affinity ( ptr as u64 , affinity , true ) {
755755 // TODO(rackscale): should switch to non-shmem affinity for alloc below.
756756 // TODO(rackscale): check if shmem is a match for id?
757- panic ! ( "Trying to realloc non- shmem using shmem allocator" ) ;
757+ panic ! ( "Trying to realloc shmem to wrong or non- shmem allocator" ) ;
758758 } else if !is_shmem_affinity ( affinity) && is_shmem_addr ( ptr as u64 , false , true ) {
759759 // TODO(rackscale): should switch to use shmem affinity for alloc below.
760760 // TODO(rackscale): check if shmem is a match for id?
0 commit comments