@@ -790,6 +790,7 @@ impl HeapAllocator {
790790 /// objects cannot straddle backing block boundaries, since we cannot easily create a contiguous
791791 /// CPU VA mapping for them. This can create some fragmentation. If CPU mapping is disabled, we
792792 /// skip the guard blocks, since the GPU view of the heap is always contiguous.
793+ #[ inline( never) ]
793794 fn add_block ( & mut self , size : usize ) -> Result {
794795 let size_aligned = ( size + mmu:: UAT_PGSZ - 1 ) & !mmu:: UAT_PGMSK ;
795796
@@ -912,24 +913,8 @@ impl HeapAllocator {
912913 . or ( Err ( ENOENT ) )
913914 } )
914915 }
915- }
916-
917- impl Allocator for HeapAllocator {
918- type Raw = HeapAllocation ;
919916
920- fn device ( & self ) -> & AsahiDevice {
921- & self . dev
922- }
923-
924- fn cpu_maps ( & self ) -> bool {
925- self . cpu_maps
926- }
927-
928- fn min_align ( & self ) -> usize {
929- self . min_align
930- }
931-
932- fn alloc ( & mut self , size : usize , align : usize ) -> Result < HeapAllocation > {
917+ fn alloc_inner ( & mut self , size : usize , align : usize ) -> Result < HeapAllocation > {
933918 if align != 0 && !align. is_power_of_two ( ) {
934919 return Err ( EINVAL ) ;
935920 }
@@ -1040,6 +1025,37 @@ impl Allocator for HeapAllocator {
10401025
10411026 Ok ( HeapAllocation ( Some ( node) ) )
10421027 }
1028+ }
1029+
1030+ impl Allocator for HeapAllocator {
1031+ type Raw = HeapAllocation ;
1032+
1033+ fn device ( & self ) -> & AsahiDevice {
1034+ & self . dev
1035+ }
1036+
1037+ fn cpu_maps ( & self ) -> bool {
1038+ self . cpu_maps
1039+ }
1040+
1041+ fn min_align ( & self ) -> usize {
1042+ self . min_align
1043+ }
1044+
1045+ fn alloc ( & mut self , size : usize , align : usize ) -> Result < HeapAllocation > {
1046+ let ret = self . alloc_inner ( size, align) ;
1047+
1048+ if ret. is_err ( ) {
1049+ dev_warn ! (
1050+ self . dev. as_ref( ) ,
1051+ "HeapAllocator[{}]::alloc: Allocation of {:#x}({:#x}) size object failed\n " ,
1052+ & * self . name,
1053+ size,
1054+ align
1055+ ) ;
1056+ }
1057+ ret
1058+ }
10431059
10441060 fn garbage ( & self ) -> ( usize , usize ) {
10451061 self . mm . with_inner ( |inner| {
0 commit comments