Page MenuHomeFreeBSD
Feed Advanced Search

Today

alc accepted D46117: vm: Remove kernel stack swapping support, part 6.
Sat, Jul 27, 12:17 AM

Yesterday

alc added inline comments to D46117: vm: Remove kernel stack swapping support, part 6.
Fri, Jul 26, 7:17 AM
alc accepted D46115: vm: Remove kernel stack swapping support, part 4.
Fri, Jul 26, 6:57 AM
alc committed rG5b8c01d13a09: amd64 pmap: Optimize PKU lookups when creating superpage mappings (authored by alc).
amd64 pmap: Optimize PKU lookups when creating superpage mappings
Fri, Jul 26, 6:26 AM
alc closed D46135: amd64 pmap: Optimize PKU lookups when creating superpage mappings.
Fri, Jul 26, 6:26 AM

Thu, Jul 25

alc accepted D46113: vm: Remove kernel stack swapping support, part 2.
Thu, Jul 25, 10:52 PM
alc added inline comments to D46135: amd64 pmap: Optimize PKU lookups when creating superpage mappings.
Thu, Jul 25, 6:54 PM
alc retitled D46135: amd64 pmap: Optimize PKU lookups when creating superpage mappings from amd pmap: Optimize PKU lookups when creating superpage mappings to amd64 pmap: Optimize PKU lookups when creating superpage mappings.
Thu, Jul 25, 5:04 PM
alc requested review of D46135: amd64 pmap: Optimize PKU lookups when creating superpage mappings.
Thu, Jul 25, 5:03 PM
alc added inline comments to D46113: vm: Remove kernel stack swapping support, part 2.
Thu, Jul 25, 4:57 PM
alc accepted D46112: vm: Remove kernel stack swapping support, part 1.
Thu, Jul 25, 4:43 PM
alc added inline comments to D46112: vm: Remove kernel stack swapping support, part 1.
Thu, Jul 25, 4:12 PM
alc committed rG98dd639c94f7: arm64 pmap: Eliminate an unnecessary conditional (authored by alc).
arm64 pmap: Eliminate an unnecessary conditional
Thu, Jul 25, 6:48 AM
alc added inline comments to D46111: kmem: Check for overflows when rounding up allocation sizes.
Thu, Jul 25, 5:12 AM
alc accepted D46119: vm: Remove kernel stack swapping support, part 8.
Thu, Jul 25, 4:39 AM
alc accepted D46116: vm: Remove kernel stack swapping support, part 5.
Thu, Jul 25, 4:34 AM
alc added inline comments to D45863: vm: Introduce reservation-aware NOFREE page allocation routine.
Thu, Jul 25, 4:01 AM

Wed, Jul 24

alc closed D46063: vm: Retire vm_page_alloc_freelist{,_domain}().
Wed, Jul 24, 10:53 PM
alc committed rG096dfa338d73: vm: Retire vm_page_alloc_freelist{,_domain}() (authored by alc).
vm: Retire vm_page_alloc_freelist{,_domain}()
Wed, Jul 24, 7:33 PM
alc committed rGcd836f600418: vm: Retire kmem_arena (authored by alc).
vm: Retire kmem_arena
Wed, Jul 24, 7:33 PM
alc closed D46057: vm: Retire kmem_arena.
Wed, Jul 24, 7:32 PM

Mon, Jul 22

alc updated the diff for D46063: vm: Retire vm_page_alloc_freelist{,_domain}().

Update man page.

Mon, Jul 22, 11:29 PM
alc requested review of D46063: vm: Retire vm_page_alloc_freelist{,_domain}().
Mon, Jul 22, 5:15 PM
alc added a comment to D46057: vm: Retire kmem_arena.
In D46057#1050008, @kib wrote:
In D46057#1050007, @alc wrote:

Out-of-tree code can make the same change, no need for a __FreeBSD_version bump I think. stable/11 is the last branch where kmem_arena is a distinct entity.

I checked drm-515-kmod, drm-61-kmod, and virtualbox-ose-kmod. They don't appear to have any direct references to kmem_arena.

I suspect the nvidia driver could, but I did not checked.

Mon, Jul 22, 7:37 AM
alc added a comment to D46057: vm: Retire kmem_arena.

Out-of-tree code can make the same change, no need for a __FreeBSD_version bump I think. stable/11 is the last branch where kmem_arena is a distinct entity.

Mon, Jul 22, 7:10 AM
alc requested review of D46057: vm: Retire kmem_arena.
Mon, Jul 22, 12:23 AM

Sun, Jul 21

alc added inline comments to D45863: vm: Introduce reservation-aware NOFREE page allocation routine.
Sun, Jul 21, 8:46 PM
alc accepted D45970: vm: Introduce {VM_ALLOC, PG}_NOFREE flags.
Sun, Jul 21, 8:20 PM
alc accepted D45997: vm: Add a KVA arena for M_NEVERFREED allocations.
Sun, Jul 21, 8:06 PM

Thu, Jul 18

alc accepted D45998: pmap_growkernel: Use VM_ALLOC_NOFREE when allocating pagetable pages.
Thu, Jul 18, 6:50 PM

Mon, Jul 15

alc closed D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Mon, Jul 15, 6:18 PM

Sun, Jul 14

alc added a comment to D45863: vm: Introduce reservation-aware NOFREE page allocation routine.
In D45863#1047954, @mjg wrote:

Sorry, I forgot to link the benchmark results from a previous iteration of this patch.
The metrics I've gathered show that this approach does reduce NOFREE fragmentation.

Few years back I ran buildkernel in a loop, several runs later fragmentation increased significantly to the point where the kernel was not able to use huge pages.

While technically not a blocker for this patch, something is definitely going wrong here -- the same workload in a loop should have stabilized its NOFREE usage as is after maybe 2-3 runs, not keep increasing it until some unknown bound. Someone(tm) should look into it, but admittedly this patch may happen to dodge the impact.

Sun, Jul 14, 9:29 PM
alc added inline comments to D45863: vm: Introduce reservation-aware NOFREE page allocation routine.
Sun, Jul 14, 9:04 PM
alc added a comment to D45863: vm: Introduce reservation-aware NOFREE page allocation routine.

Here is the amd64 pmap change:

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 9f85e903cd74..841957db3b3b 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -5154,8 +5154,8 @@ pmap_growkernel(vm_offset_t addr)
                pdpe = pmap_pdpe(kernel_pmap, end);
                if ((*pdpe & X86_PG_V) == 0) {
                        nkpg = pmap_alloc_pt_page(kernel_pmap,
-                           pmap_pdpe_pindex(end), VM_ALLOC_WIRED |
-                           VM_ALLOC_INTERRUPT | VM_ALLOC_ZERO);
+                           pmap_pdpe_pindex(end), VM_ALLOC_INTERRUPT |
+                               VM_ALLOC_NOFREE | VM_ALLOC_WIRED | VM_ALLOC_ZERO);
                        if (nkpg == NULL)
                                panic("pmap_growkernel: no memory to grow kernel");
                        paddr = VM_PAGE_TO_PHYS(nkpg);
@@ -5174,7 +5174,8 @@ pmap_growkernel(vm_offset_t addr)
                }
Sun, Jul 14, 8:32 PM

Sat, Jul 13

alc committed rG772ae9eddf87: vm ASLR: Handle VM_NRESERV_LEVEL == 0 (authored by alc).
vm ASLR: Handle VM_NRESERV_LEVEL == 0
Sat, Jul 13, 7:50 PM
alc committed rG3e00c11a4f43: arm64: Support the L3 ATTR_CONTIGUOUS page size in pagesizes[] (authored by alc).
arm64: Support the L3 ATTR_CONTIGUOUS page size in pagesizes[]
Sat, Jul 13, 5:47 PM
alc accepted D45966: amd64 pmap_allocpte_nosleep(): stop testing tautological condition.
Sat, Jul 13, 5:39 PM
alc updated the diff for D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].

Add requested KASSERT()s.

Sat, Jul 13, 8:08 AM

Fri, Jul 12

alc added inline comments to D45863: vm: Introduce reservation-aware NOFREE page allocation routine.
Fri, Jul 12, 7:57 PM
alc added a comment to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].

Are there any other comments or questions about this patch?

Fri, Jul 12, 7:37 PM
alc added a comment to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].

@kib Since I removed the rtld change, your last comment on that portion of the change no longer appears inline with the patch, so let me address it here.

Fri, Jul 12, 7:32 PM
alc updated the diff for D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].

Remove what was a transitional (and confusing) rtld change. The proper change will be included in the next big patch that introduces real two-level reservation support. The removed change only sought to avoid the pointless 2MB alignment of libraries, like libc.so, that are too small too benefit from 2MB alignment.

Fri, Jul 12, 5:35 PM

Sun, Jul 7

alc accepted D45781: swap_pager: speedup meta_transfer.
Sun, Jul 7, 11:13 PM
alc added inline comments to D45781: swap_pager: speedup meta_transfer.
Sun, Jul 7, 7:33 AM

Sat, Jul 6

alc committed rGfb32ba6aa44d: amd64/arm64: Eliminate unnecessary demotions in pmap_protect() (authored by alc).
amd64/arm64: Eliminate unnecessary demotions in pmap_protect()
Sat, Jul 6, 8:50 PM
alc closed D45886: amd64/arm64: Eliminate unnecessary demotions in pmap_protect().
Sat, Jul 6, 8:49 PM

Fri, Jul 5

alc requested review of D45886: amd64/arm64: Eliminate unnecessary demotions in pmap_protect().
Fri, Jul 5, 6:55 PM
alc committed rG383fd3ea0012: arm64: Handle an unaligned start in pmap_mask_set_locked() (authored by alc).
arm64: Handle an unaligned start in pmap_mask_set_locked()
Fri, Jul 5, 5:45 AM
alc closed D45851: arm64: handle an unaligned start in pmap_mask_set_locked().
Fri, Jul 5, 5:45 AM

Wed, Jul 3

alc updated the diff for D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].

Make vm_map_find() a bit smarter about how much extra space to search for when performing ASLR and either VMFS_SUPER_SPACE or VMFS_OPTIMAL_SPACE is specified.

Wed, Jul 3, 11:21 PM
alc added inline comments to D45863: vm: Introduce reservation-aware NOFREE page allocation routine.
Wed, Jul 3, 10:36 PM
alc added inline comments to D45863: vm: Introduce reservation-aware NOFREE page allocation routine.
Wed, Jul 3, 10:34 PM
alc accepted D45045: malloc(9): introduce M_NEVERFREED.
Wed, Jul 3, 7:51 PM
alc added inline comments to D45863: vm: Introduce reservation-aware NOFREE page allocation routine.
Wed, Jul 3, 7:50 PM
alc added a comment to D45046: vm_reserv: add reservation-aware UMA small_alloc .

However, I think that the biggest difference here is that these changes will prioritize filling up partially populated reservations, which should pack things more tightly than VM_FREEPOOL_DIRECT. Allocating pages using VM_FREEPOOL_DIRECT will dequeue pages from the 0-order freelist, and there's no guarantee that the queued 0-order pages come from the same reservation.

If a page is in a 0-order freelist, then its buddy is already allocated. (And that page has been in the freelist longer than all of the other free 0-order pages, so is not likely to see its buddy returned to the free lists in the near future.) vm_phys tries to import the largest possible chunk of contiguous memory into a pool when needed, so unless RAM is already very fragmented, the buddy will by allocated to another consumer of the same free pool, which in this case is likely to be UMA. It's not really obvious to me why this is objectively worse than the reservation-based scheme.

Wed, Jul 3, 7:42 PM
alc requested review of D45851: arm64: handle an unaligned start in pmap_mask_set_locked().
Wed, Jul 3, 5:11 AM

Mon, Jul 1

alc added inline comments to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Mon, Jul 1, 7:42 PM
alc updated the diff for D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].

Simplify pmap_enter_largepage()'s handling of L3C pages.

Mon, Jul 1, 5:19 PM

Sun, Jun 30

alc added a comment to D45761: riscv: use counter(9) for pmap counters.

Does anyone know if any real riscv hardware implements their extension that supports additional page sizes, particularly, 64KB?

Sun, Jun 30, 7:57 PM
alc accepted D45761: riscv: use counter(9) for pmap counters.

I was about to comment that other pmaps still use atomics for these counters, but it seems that amd64's also been using counter(9) for a while. I'm a bit skeptical that that's really necessary (except perhaps for p_failures), but it doesn't have much downside either. It would be nice to make at least arm64 consistent.

Sun, Jun 30, 7:52 PM
alc added inline comments to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Sun, Jun 30, 7:22 PM

Sat, Jun 29

alc added inline comments to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Sat, Jun 29, 8:07 PM
alc added inline comments to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Sat, Jun 29, 6:11 PM

Fri, Jun 28

alc added inline comments to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Fri, Jun 28, 9:41 PM
alc added inline comments to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Fri, Jun 28, 7:15 PM
alc added inline comments to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Fri, Jun 28, 6:26 PM
alc added inline comments to D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Fri, Jun 28, 5:15 PM
alc updated the diff for D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].

Fix PMAP_ENTER_LARGEPAGE

Fri, Jun 28, 8:04 AM
alc updated the summary of D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Fri, Jun 28, 4:12 AM
alc requested review of D45766: arm64: support the ATTR_CONTIGUOUS L3C page size in pagesizes[].
Fri, Jun 28, 4:04 AM

Jun 25 2024

alc accepted D45716: cxgbe: replace a loop with rounddown_pow_of_two.
Jun 25 2024, 10:35 PM

Jun 24 2024

alc accepted D45536: log2: move log2 related functions from kpi to libkern.
Jun 24 2024, 6:52 AM

Jun 23 2024

alc added inline comments to D45536: log2: move log2 related functions from kpi to libkern.
Jun 23 2024, 5:57 PM
alc added inline comments to D45536: log2: move log2 related functions from kpi to libkern.
Jun 23 2024, 6:45 AM

Jun 22 2024

alc added inline comments to D45667: spelling: specifiy -> specify.
Jun 22 2024, 5:47 AM

Jun 14 2024

alc added inline comments to D45577: amd64 pmap: Release PTP reference on leaf ptpage allocation failure.
Jun 14 2024, 11:04 PM

Jun 13 2024

alc accepted D45582: powerpc_mmu_radix: Release PTP reference on leaf ptpage allocation failure.
Jun 13 2024, 11:46 PM
alc accepted D45581: powerpc_mmu_radix: Introduce 'pmap_abort_ptp'.
Jun 13 2024, 11:45 PM
alc accepted D45580: riscv pmap: Release PTP reference on leaf ptpage allocation failure.
Jun 13 2024, 11:43 PM
alc accepted D45579: riscv pmap: Introduce 'pmap_abort_ptp'.
Jun 13 2024, 11:36 PM
alc closed D39845: VM anonymous clustering: be more persistent.
Jun 13 2024, 8:16 PM
alc committed rG268f19aacc6a: vm: Reduce address space fragmentation (authored by alc).
vm: Reduce address space fragmentation
Jun 13 2024, 8:16 PM
alc accepted D45578: arm64 pmap: Release PTP reference on leaf ptpage allocation failure.
Jun 13 2024, 8:04 PM
alc accepted D45577: amd64 pmap: Release PTP reference on leaf ptpage allocation failure.
Jun 13 2024, 7:35 PM

Jun 12 2024

alc added a comment to D39845: VM anonymous clustering: be more persistent.

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
Jun 12 2024, 5:55 AM
alc added a comment to D39845: VM anonymous clustering: be more persistent.

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.

Jun 12 2024, 5:05 AM

Jun 11 2024

alc added a comment to D39845: VM anonymous clustering: be more persistent.

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);
Jun 11 2024, 8:30 PM
alc added a comment to D45536: log2: move log2 related functions from kpi to libkern.

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.

Jun 11 2024, 7:41 PM

Jun 8 2024

alc committed rG5ee5c40402c9: arm64 pmap: Defer bti lookup (authored by alc).
arm64 pmap: Defer bti lookup
Jun 8 2024, 7:52 AM
alc closed D45502: arm64 pmap: Defer bti lookup.
Jun 8 2024, 7:51 AM
alc added inline comments to D45062: arm64: Use tables to find early page tables.
Jun 8 2024, 5:29 AM

Jun 7 2024

alc added inline comments to D45502: arm64 pmap: Defer bti lookup.
Jun 7 2024, 6:34 PM
alc updated subscribers of D45502: arm64 pmap: Defer bti lookup.

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.

Jun 7 2024, 6:25 PM
alc updated the diff for D45502: arm64 pmap: Defer bti lookup.

Add KASSERT.

Jun 7 2024, 6:14 PM
alc accepted D45494: powerof2: replace loops with fls or ilog2.
Jun 7 2024, 6:03 PM
alc added inline comments to D45064: arm64: Create an L3 table to limit permissions.
Jun 7 2024, 5:27 PM
alc updated the diff for D45502: arm64 pmap: Defer bti lookup.

Remove two early calls to pmap_pte_bti() that are now redundant.

Jun 7 2024, 7:17 AM
alc added inline comments to D45502: arm64 pmap: Defer bti lookup.
Jun 7 2024, 6:48 AM

Jun 6 2024

alc added a comment to D45511: rangeset: add next() for iteration.

@kib Do you have any PKU test programs that could be run to check this?

Jun 6 2024, 7:01 PM
alc updated the diff for D45502: arm64 pmap: Defer bti lookup.

Correct a couple errors in the previous version.

Jun 6 2024, 6:50 PM