@@ -742,6 +742,7 @@ impl HeapAllocator {
742742 /// objects cannot straddle backing block boundaries, since we cannot easily create a contiguous
743743 /// CPU VA mapping for them. This can create some fragmentation. If CPU mapping is disabled, we
744744 /// skip the guard blocks, since the GPU view of the heap is always contiguous.
745+ #[ inline( never) ]
745746 fn add_block ( & mut self , size : usize ) -> Result {
746747 let size_aligned = ( size + mmu:: UAT_PGSZ - 1 ) & !mmu:: UAT_PGMSK ;
747748
@@ -863,24 +864,8 @@ impl HeapAllocator {
863864 . or ( Err ( ENOENT ) )
864865 } )
865866 }
866- }
867-
868- impl Allocator for HeapAllocator {
869- type Raw = HeapAllocation ;
870-
871- fn device ( & self ) -> & AsahiDevice {
872- & self . dev
873- }
874867
875- fn cpu_maps ( & self ) -> bool {
876- self . cpu_maps
877- }
878-
879- fn min_align ( & self ) -> usize {
880- self . min_align
881- }
882-
883- fn alloc ( & mut self , size : usize , align : usize ) -> Result < HeapAllocation > {
868+ fn alloc_inner ( & mut self , size : usize , align : usize ) -> Result < HeapAllocation > {
884869 if align != 0 && !align. is_power_of_two ( ) {
885870 return Err ( EINVAL ) ;
886871 }
@@ -992,6 +977,33 @@ impl Allocator for HeapAllocator {
992977
993978 Ok ( HeapAllocation ( Some ( node) ) )
994979 }
980+ }
981+
982+ impl Allocator for HeapAllocator {
983+ type Raw = HeapAllocation ;
984+
985+ fn cpu_maps ( & self ) -> bool {
986+ self . cpu_maps
987+ }
988+
989+ fn min_align ( & self ) -> usize {
990+ self . min_align
991+ }
992+
993+ fn alloc ( & mut self , size : usize , align : usize ) -> Result < HeapAllocation > {
994+ let ret = self . alloc_inner ( size, align) ;
995+
996+ if ret. is_err ( ) {
997+ dev_warn ! (
998+ self . dev. as_ref( ) ,
999+ "HeapAllocator[{}]::alloc: Allocation of {:#x}({:#x}) size object failed\n " ,
1000+ & * self . name,
1001+ size,
1002+ align
1003+ ) ;
1004+ }
1005+ ret
1006+ }
9951007
9961008 fn garbage ( & self ) -> ( usize , usize ) {
9971009 self . mm . with_inner ( |inner| {
0 commit comments