User Details
- User Since
- Dec 14 2014, 5:52 AM (495 w, 5 d)
Yesterday
Thu, Jun 13
Wed, Jun 12
Here is a very simple example. Before the change:
97156 0x2eb08e600000 0x2eb08e64b000 rw- 37 37 1 0 ----- sw 97156 0x2eb08e800000 0x2eb08f021000 rw- 1031 29378 3 0 ----- sw 97156 0x2eb08f021000 0x2eb08f022000 rw- 1 29378 3 0 ----- sw 97156 0x2eb08f022000 0x2eb095f22000 rw- 28346 29378 3 0 --S-- sw 97156 0x2eb096000000 0x2eb09d000000 rw- 20411 20411 1 0 --S-- sw
After the change:
17423 0x258f55e00000 0x258f55e6c000 rw- 38 39 2 0 ----- sw 17423 0x258f55e6c000 0x258f55e6d000 rw- 1 39 2 0 ----- sw 17423 0x258f56000000 0x258f5d700000 rw- 29483 29483 1 0 --S-- sw 17423 0x258f5d800000 0x258f67000000 rw- 27646 27646 1 0 --S-- sw
With this patch in place, I see a small reduction in reservations allocated (e.g., 1.6% during buildworld), fewer partially populated reservations. a small increase in 64KB page promotions on arm64, and fewer map entries in the heap.
Tue, Jun 11
I'm going to suggest the following as the final resolution for this issue. It addresses the fragmentation that I described in my last message, and it and handles the scenario that you brought up wherein we run out of free space at the current anon_loc, perform an ASLR restart, and want to avoid repeating the ASLR restart on the next mapping.
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 3c7afcb6642f..fa71bb8a01d6 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -2247,8 +2247,15 @@ vm_map_find(vm_map_t map, vm_object_t object, vm_ooffset_t offset, rv = vm_map_insert(map, object, offset, *addr, *addr + length, prot, max, cow); } - if (rv == KERN_SUCCESS && update_anon) - map->anon_loc = *addr + length; + + /* + * Update the starting address for clustered anonymous memory mappings + * if a starting address was not previously defined or an ASLR restart + * placed an anonymous memory mapping at a lower address. + */ + if (update_anon && rv == KERN_SUCCESS && (map->anon_loc == 0 || + *addr < map->anon_loc)) + map->anon_loc = *addr; done: vm_map_unlock(map); return (rv); @@ -4041,9 +4048,6 @@ vm_map_delete(vm_map_t map, vm_offset_t start, vm_offset_t end) entry->object.vm_object != NULL) pmap_map_delete(map->pmap, entry->start, entry->end);
I'm not convinced that we should be creating an ilog2.h header file. I would leave the definitions in the existing libkern.h header file.
Sat, Jun 8
Fri, Jun 7
By the way, you mentioned pmap_enter_l3c() only being called from one place. The next big chunk of @ehs3_rice.edu 's work will include a call to pmap_enter_l3c() from pmap_enter() with pagesizes[] updated to include the L3C page size as psind == 1.
Remove two early calls to pmap_pte_bti() that are now redundant.
Thu, Jun 6
@kib Do you have any PKU test programs that could be run to check this?
Correct a couple errors in the previous version.
Wed, Jun 5
In principle, this is fine, but in practice. we mostly call vm_page_insert_after(). So, the impact will be limited. That said, I'm still excited by where I think this is headed.
For some reason, this revision did not automatically close upon commit.
Tue, Jun 4
Please coordinate this with @markj given his lazy init change.
Mon, Jun 3
@jhibbits I would encourage you to apply https://reviews.freebsd.org/D40478 and a few other superpage related follow on commits from amd64 to mmu_radix,c. This change would then apply to mmu_radix.c.
Sun, Jun 2
Set VM_PROT_NO_PROMOTE in vm_fault_prefault().
Sat, Jun 1
Revise comment.
Fri, May 31
Fri, May 24
Thu, May 23
Wed, May 22
@markj Do you have any other comments on this change?
Mon, May 20
Sun, May 19
Fri, May 17
Thu, May 16
May 12 2024
May 11 2024
Add requirements comment.
May 9 2024
May 8 2024
May 3 2024
Apr 29 2024
Apr 28 2024
Eliminate unnecessary parentheses.
Apr 27 2024
Apr 24 2024
Apr 17 2024
Apr 16 2024
Why not deal with this issue in pmap_mapdev{,_attr}()? Specifically, if the given physical address falls within the DMAP region, don't call kva_alloc{,_aligned}(); instead, map the physical address at its corresponding DMAP virtual address. This is not all that different from amd64, where the DMAP (with appropriate attr settings) is used to access a good bit of device memory.
Apr 9 2024
Apr 8 2024
Just so we're all on the same page, I want to point out the following: While this patch achieves contiguity, it doesn't guarantee 2 MB alignment. Let 'F' represent a fully populated 2 MB reservation, 'E', represent a partially populated reservation, where the population begins in the middle and goes to the end, and 'B' is the complement of 'E', where the population begins at the start and ends in the middle. Typically, the physical memory allocation for one chunk of stacks on amd64 looks like 'EFFFB'. While it would be nice to achieve 'FFFF', this patch is already a great improvement over the current state of affairs.
Apr 7 2024
Update to reflect committed change.
Apr 6 2024
Eliminate an unnecessary variable.