mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:12:43 +00:00 
			
		
		
		
	Kernel: Use AddressSpace region tree for range allocation
This patch stops using VirtualRangeAllocator in AddressSpace and instead looks for holes in the region tree when allocating VM space. There are many benefits: - VirtualRangeAllocator is non-intrusive and would call kmalloc/kfree when used. This new solution is allocation-free. This was a source of unpleasant MM/kmalloc deadlocks. - We consolidate authority on what the address space looks like in a single place. Previously, we had both the range allocator *and* the region tree both being used to determine if an address was valid. Now there is only the region tree. - Deallocation of VM when splitting regions is no longer complicated, as we don't need to keep two separate trees in sync.
This commit is contained in:
		
							parent
							
								
									90a7b9e5b4
								
							
						
					
					
						commit
						02a95a196f
					
				
					 10 changed files with 158 additions and 30 deletions
				
			
		|  | @ -193,7 +193,7 @@ ErrorOr<FlatPtr> Process::sys$mmap(Userspace<Syscall::SC_mmap_params const*> use | |||
| 
 | ||||
|     auto range = TRY([&]() -> ErrorOr<Memory::VirtualRange> { | ||||
|         if (map_randomized) | ||||
|             return address_space().page_directory().range_allocator().try_allocate_randomized(rounded_size, alignment); | ||||
|             return address_space().try_allocate_randomized(rounded_size, alignment); | ||||
| 
 | ||||
|         // If MAP_FIXED is specified, existing mappings that intersect the requested range are removed.
 | ||||
|         if (map_fixed) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling