Page MenuHomeFreeBSD

alc (Alan Cox)
User

Projects

User Details

User Since
Dec 14 2014, 5:52 AM (550 w, 6 d)

Recent Activity

Yesterday

alc updated the diff for D51091: amd64 pmap: demotion changes for kib@.

Rebase. Add lockp KASSERT.

Sat, Jul 5, 7:56 PM
alc added a comment to D51060: pctrie: move the root to the latest search node.

I am rather concerned that the pathological case of having to walk up to the root and then back down will be common place. For example, consider a memory mapped file that is read sequentially. The first access, when the file is not yet memory resident, will leave the cursor at the end. Subsequent accesses well then have to walk all the way up, and all the way down to get to the first page.

Sat, Jul 5, 6:25 PM

Fri, Jul 4

alc accepted D50970: amd64 pmap: eliminate two explicit panics on low mem conditions.
Fri, Jul 4, 7:07 PM
alc committed rG1c1acaf6858b: amd64: enable EFER.TCE (authored by alc).
amd64: enable EFER.TCE
Fri, Jul 4, 1:01 AM
alc closed D51093: amd64: enable EFER.TCE.
Fri, Jul 4, 1:01 AM

Thu, Jul 3

alc added inline comments to D51085: amd64 pmap: move DMAP out of kernel pml4 table for LA57..
Thu, Jul 3, 9:23 PM

Tue, Jul 1

alc added a comment to D51093: amd64: enable EFER.TCE.
In D51093#1166331, @kib wrote:

It would be useful to provide a reasoning why the setting is safe.

From my understanding, there are (at least) two situations where TCE would be unsafe:

  1. Recursive pt mapping. But when we modify the kernel page table in a way that modifies the paging structure above the lowest level, we also explicitly invalidate the recursive mapping, in pmap_remove_kernel_pde(), pmap_demote_pde(), pmap_demote_pdpe().
  2. Sharing page table pages, mostly relevant when sharing occurs not at the leafs of the page table radix tree. We do not do that at all.

Anything else I missing?

Tue, Jul 1, 5:33 PM
alc added inline comments to D50970: amd64 pmap: eliminate two explicit panics on low mem conditions.
Tue, Jul 1, 8:13 AM
alc added inline comments to D51091: amd64 pmap: demotion changes for kib@.
Tue, Jul 1, 8:01 AM

Mon, Jun 30

alc added a comment to D51093: amd64: enable EFER.TCE.

dougm@ has been running stress on a Ryzen processor for more than 24 hours, and seen no ill effects.

Mon, Jun 30, 5:13 PM
alc requested review of D51093: amd64: enable EFER.TCE.
Mon, Jun 30, 5:12 PM
alc added a reviewer for D51091: amd64 pmap: demotion changes for kib@: markj.
Mon, Jun 30, 5:04 PM
alc added a comment to D51091: amd64 pmap: demotion changes for kib@.
In D51091#1166112, @kib wrote:

Or, do you want me to integrate this into the series of patches for D50970?

Mon, Jun 30, 5:03 PM
alc added inline comments to D50970: amd64 pmap: eliminate two explicit panics on low mem conditions.
Mon, Jun 30, 4:55 PM
alc added inline comments to D50970: amd64 pmap: eliminate two explicit panics on low mem conditions.
Mon, Jun 30, 8:17 AM
alc requested review of D51091: amd64 pmap: demotion changes for kib@.
Mon, Jun 30, 8:15 AM
alc added inline comments to D50970: amd64 pmap: eliminate two explicit panics on low mem conditions.
Mon, Jun 30, 8:11 AM

Sat, Jun 28

alc accepted D51059: pctrie: correct iter node after node allocation.
Sat, Jun 28, 6:31 AM

Fri, Jun 27

alc accepted D51015: vm_pageout: Make the OOM killer less aggressive.
Fri, Jun 27, 8:03 AM

Thu, Jun 26

alc accepted D51057: pctrie: drop freenode param to pctrie_remove.
Thu, Jun 26, 10:48 PM

Wed, Jun 25

alc closed D49391: vm_page: update legend documenting allocation.
Wed, Jun 25, 7:10 PM
alc committed rG07297aee35f2: vm_page: update comments and KASSERT()s concerning page allocation (authored by alc).
vm_page: update comments and KASSERT()s concerning page allocation
Wed, Jun 25, 7:10 PM

Tue, Jun 24

alc added inline comments to D50970: amd64 pmap: eliminate two explicit panics on low mem conditions.
Tue, Jun 24, 6:51 PM
alc added inline comments to D50970: amd64 pmap: eliminate two explicit panics on low mem conditions.
Tue, Jun 24, 5:44 PM

Mon, Jun 23

alc added a comment to D49442: pmap: Avoid clearing the accessed bit for wired mappings.
In D49442#1163665, @kib wrote:
In D49442#1163641, @alc wrote:

A more direct approach would be to change pmap_demote_pde_locked() to handle wired mappings when the PDE was never accessed:

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 6d1c2d70d8c0..97ff9c67e8d5 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -6104,9 +6104,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
         * Invalidate the 2MB page mapping and return "failure" if the
         * mapping was never accessed.
         */
-       if ((oldpde & PG_A) == 0) {
-               KASSERT((oldpde & PG_W) == 0,
-                   ("pmap_demote_pde: a wired mapping is missing PG_A"));
+       if ((oldpde & (PG_W | PG_A)) == 0) {

Just for my understanding, do you mean

if ((oldpde & (PG_W | PG_A)) == PG_W) {

?

Mon, Jun 23, 10:45 PM
alc added a comment to D49442: pmap: Avoid clearing the accessed bit for wired mappings.

A more direct approach would be to change pmap_demote_pde_locked() to handle wired mappings when the PDE was never accessed:

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 6d1c2d70d8c0..97ff9c67e8d5 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -6104,9 +6104,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
         * Invalidate the 2MB page mapping and return "failure" if the
         * mapping was never accessed.
         */
-       if ((oldpde & PG_A) == 0) {
-               KASSERT((oldpde & PG_W) == 0,
-                   ("pmap_demote_pde: a wired mapping is missing PG_A"));
+       if ((oldpde & (PG_W | PG_A)) == 0) {
                pmap_demote_pde_abort(pmap, va, pde, oldpde, lockp);
                return (false);
        }
@@ -6164,7 +6162,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
         * have PG_A set in every PTE, then fill it.  The new PTEs will all
         * have PG_A set.
         */
-       if (!vm_page_all_valid(mpte))
+       if (vm_page_all_valid(mpte) ^ (oldpde & PG_A) != 0)
                pmap_fill_ptp(firstpte, newpte);
Mon, Jun 23, 4:52 PM

Fri, Jun 20

alc updated the diff for D49391: vm_page: update legend documenting allocation.

Introduce VM_ALLOC_COMMON.

Fri, Jun 20, 11:27 PM
alc updated the summary of D49391: vm_page: update legend documenting allocation.
Fri, Jun 20, 5:43 PM
alc updated the diff for D49391: vm_page: update legend documenting allocation.
Fri, Jun 20, 5:18 PM
alc retitled D49391: vm_page: update legend documenting allocation from vm_grab: assert no VM_ALLOC_WAITFAIL to vm_page: update legend documenting allocation.
Fri, Jun 20, 5:16 PM
alc updated the diff for D49391: vm_page: update legend documenting allocation.
Fri, Jun 20, 5:14 PM

Thu, Jun 19

alc committed rGc7fe7912a623: vm_page: eliminate a stale KASSERT (authored by alc).
vm_page: eliminate a stale KASSERT
Thu, Jun 19, 4:09 PM

Wed, Jun 18

alc committed rGdeddede58e83: arm64 pmap: use the counter(9) KPI for L2 superpages (authored by alc).
arm64 pmap: use the counter(9) KPI for L2 superpages
Wed, Jun 18, 11:07 PM
alc accepted D50877: vm_page: Fix nofree page accounting.
Wed, Jun 18, 8:03 PM

Tue, Jun 17

alc added a comment to D49442: pmap: Avoid clearing the accessed bit for wired mappings.

@alc did you have any thoughts on this patch?

Tue, Jun 17, 5:40 PM

Mon, Jun 16

alc accepted D45064: arm64: Create an L3 table to limit permissions.
Mon, Jun 16, 4:46 PM

Sun, Jun 15

alc accepted D50861: vm_map: drop simplify_entry.9.
Sun, Jun 15, 9:18 PM
alc added a comment to D50861: vm_map: drop simplify_entry.9.

You should add an entry to ObsoleteFiles.inc.

Sun, Jun 15, 8:48 PM

Sat, Jun 14

alc accepted D50750: pctrie: simplify lookup_node .
Sat, Jun 14, 7:10 PM

Fri, Jun 13

alc committed rGc82662dc7123: arm pmap: fix CTASSERT (authored by alc).
arm pmap: fix CTASSERT
Fri, Jun 13, 9:55 PM
alc committed rG330b17e1cf5c: vm: remove pa_index from the machine-independent layer (authored by alc).
vm: remove pa_index from the machine-independent layer
Fri, Jun 13, 6:25 PM
alc closed D50823: vm: remove pa_index from the machine-independent layer.
Fri, Jun 13, 6:25 PM
alc committed rGb7536f9593a3: arm64 pmap: Simplify pmap_demote_l{2,3}c() (authored by alc).
arm64 pmap: Simplify pmap_demote_l{2,3}c()
Fri, Jun 13, 5:33 PM

Thu, Jun 12

alc requested review of D50823: vm: remove pa_index from the machine-independent layer.
Thu, Jun 12, 8:41 PM
alc added inline comments to D45064: arm64: Create an L3 table to limit permissions.
Thu, Jun 12, 8:24 PM

Wed, Jun 11

alc committed rG797020a76406: vm: retire vm_page_lock() (authored by alc).
vm: retire vm_page_lock()
Wed, Jun 11, 8:22 PM
alc closed D50767: vm: retire pa_lock.
Wed, Jun 11, 8:22 PM
alc accepted D45063: arm64: Reduce the kernel executable pages.
Wed, Jun 11, 7:31 PM
alc accepted D45062: arm64: Use tables to find early page tables.
Wed, Jun 11, 7:22 PM

Tue, Jun 10

alc added a reviewer for D50767: vm: retire pa_lock: kib.
Tue, Jun 10, 7:17 PM
alc updated the diff for D50767: vm: retire pa_lock.

Retire PA_LOCK_COUNT.

Tue, Jun 10, 5:44 PM
alc updated the diff for D50767: vm: retire pa_lock.

Use busy style synchronization in linux emulation.

Tue, Jun 10, 7:16 AM

Mon, Jun 9

alc added inline comments to D50767: vm: retire pa_lock.
Mon, Jun 9, 9:22 PM
alc added inline comments to D50767: vm: retire pa_lock.
Mon, Jun 9, 9:19 PM
alc requested review of D50767: vm: retire pa_lock.
Mon, Jun 9, 9:16 PM

Sun, Jun 8

alc committed rG1fee99800a79: vm_page: Retire its listq field (authored by alc).
vm_page: Retire its listq field
Sun, Jun 8, 6:37 PM
alc closed D50515: vm_page: retire its listq field.
Sun, Jun 8, 6:36 PM

Sat, Jun 7

alc added a comment to D50515: vm_page: retire its listq field.
In D50515#1157527, @kib wrote:

BTW, did you considered only marking the page for free if it is on the page queue, and doing the real free when processing the batch?

Sat, Jun 7, 7:37 PM

Fri, Jun 6

alc accepted D50729: pctrie_lookup_node: assume parent_out != NULL.
Fri, Jun 6, 6:44 PM

Jun 5 2025

alc added a comment to D50515: vm_page: retire its listq field.

@kib Do you have any comments?

Jun 5 2025, 7:21 PM
alc added a comment to D50515: vm_page: retire its listq field.

Should I bump __FreeBSD_version after this change?

Jun 5 2025, 7:21 PM

Jun 4 2025

alc committed rG51c8cd7e1a33: arm64 pmap: Eliminate an unnecessary NULL check (authored by alc).
arm64 pmap: Eliminate an unnecessary NULL check
Jun 4 2025, 7:11 PM

May 31 2025

alc added inline comments to D50483: Extended errors from kernel.
May 31 2025, 8:52 PM
alc accepted D50622: vm_pageout: fix pageout_flush.
May 31 2025, 5:57 PM
alc accepted D50601: vm_page: use lookup_ge in grab_valid_iter().
May 31 2025, 5:51 PM

May 30 2025

alc added inline comments to D50568: vm_pageout: reduce number of flush() params.
May 30 2025, 10:51 PM
alc added inline comments to D50568: vm_pageout: reduce number of flush() params.
May 30 2025, 6:15 PM

May 28 2025

alc accepted D50425: vm_object: use lookup_range in vm_object_page_clean_flush .
May 28 2025, 5:31 AM
alc updated the diff for D50515: vm_page: retire its listq field.

Update comments.

May 28 2025, 5:27 AM

May 26 2025

alc added inline comments to D50515: vm_page: retire its listq field.
May 26 2025, 7:37 PM
alc added inline comments to D50515: vm_page: retire its listq field.
May 26 2025, 7:14 AM
alc added inline comments to D50515: vm_page: retire its listq field.
May 26 2025, 12:01 AM

May 25 2025

alc added a comment to D50515: vm_page: retire its listq field.
In D50515#1153272, @alc wrote:

If I dramatically reduce the physical memory on the machine, so that reservations are rarely available, then even fewer calls to vm_freelist_add() have to perform a dequeue from a paging queue. the ratio is now one out of sixty:

debug.counters.pending: 15401029
debug.counters.calls: 918326383
debug.counters.not_queued: 914618225
debug.counters.dequeues: 15401153

I suspect that by the time UMA performs vm_page_zone_release(), any pending dequeues on the pages have completed.

Do you know what the bucket size is for the cache zones in that configuration? sysctl vm.uma.vm_pgcache.bucket_size will give the current value.

May 25 2025, 11:21 PM
alc added a comment to D50515: vm_page: retire its listq field.

If I dramatically reduce the physical memory on the machine, so that reservations are rarely available, then even fewer calls to vm_freelist_add() have to perform a dequeue from a paging queue. the ratio is now one out of sixty:

debug.counters.pending: 15401029
debug.counters.calls: 918326383
debug.counters.not_queued: 914618225
debug.counters.dequeues: 15401153

I suspect that by the time UMA performs vm_page_zone_release(), any pending dequeues on the pages have completed.

May 25 2025, 8:28 PM
alc added a comment to D50515: vm_page: retire its listq field.

To better understand the locking behavior, i.e., when a page queue lock is acquired while a free queues lock is held, I applied the following changes:

diff --git a/sys/vm/vm_phys.c b/sys/vm/vm_phys.c
index 9261e52705fe..2c8eb510dbf5 100644
--- a/sys/vm/vm_phys.c
+++ b/sys/vm/vm_phys.c
@@ -389,12 +389,26 @@ sysctl_vm_phys_locality(SYSCTL_HANDLER_ARGS)
 }
 #endif
May 25 2025, 5:26 PM
alc accepted D50424: vm_page: drop mpred from grab_valid_iter().
May 25 2025, 6:31 AM

May 24 2025

alc added a comment to D50515: vm_page: retire its listq field.

I speculate that the main source of additional queue_nops is partially populated reservations that only had a small number of populated pages and so the popcount reached zero and the reservation was returned to the buddy queues before the current batch of deferred dequeues, that includes the very first page in the reservation, hits the threshold for batched processing, so the vm_freelist_add() on that first page has to do a vm_page_dequeue().

May 24 2025, 7:48 PM
alc added inline comments to D50515: vm_page: retire its listq field.
May 24 2025, 7:31 PM
alc updated the test plan for D50515: vm_page: retire its listq field.
May 24 2025, 7:24 PM
alc added a comment to D50515: vm_page: retire its listq field.

Observe that I am not actually calling vm_page_dequeue() before calling vm_phys_free_pages() in various places. Instead, I am relying entirely on a call to vm_page_dequeue() from vm_freelist_add(). The argument for not unconditionally calling vm_page_dequeue() before calling vm_phys_free_pages() is that some fraction of the time, the dequeue can still be deferred because the page, or chunk of pages, that we are freeing will be the "right-hand" buddy to a page that is already in the buddy queues.

May 24 2025, 7:17 PM
alc requested review of D50515: vm_page: retire its listq field.
May 24 2025, 7:11 PM
alc added inline comments to D50333: vm_phys: Ensure that pages are removed from pagequeues before freeing.
May 24 2025, 7:04 PM

May 23 2025

alc added a comment to D50333: vm_phys: Ensure that pages are removed from pagequeues before freeing.

I think that there is another edge case that isn't being handled. Similar to my comment about the vm_page_dequeue after vm_reserv_alloc_page, suppose that a page is allocated from a reservation via vm_page_alloc(), validated, mapped, added to a paging queue, and then later freed back to the reservation. Now, suppose that the reservation is broken and the recently-freed page is passed to the buddy allocator. The lazy dequeue may not have completed yet. I think that reservation breaking will need to perform the vm_page_dequeue on each of the pages being passed to the buddy allocator.

May 23 2025, 6:49 AM

May 18 2025

alc accepted D50392: vm_page: reset iterator after domainset drops lock.
May 18 2025, 5:09 PM

May 17 2025

alc accepted D50389: pctrie: use popmap in locked lookup_range.
May 17 2025, 10:00 PM

May 16 2025

alc accepted D50263: vm_page: cleanup.
May 16 2025, 7:32 AM

May 13 2025

alc added inline comments to D50310: vfs: vntblinit(): Rework comments on the computation of 'kern.maxvnodes'.
May 13 2025, 5:11 PM
alc added inline comments to D50310: vfs: vntblinit(): Rework comments on the computation of 'kern.maxvnodes'.
May 13 2025, 4:45 PM

May 12 2025

alc accepted D50249: vm_page: reorder declarations in header file.
May 12 2025, 6:47 PM

May 8 2025

alc added inline comments to D50253: vm_page_grab_pages: fetch page ranges.
May 8 2025, 10:35 PM
alc added inline comments to D50253: vm_page_grab_pages: fetch page ranges.
May 8 2025, 9:49 PM
alc added inline comments to D50253: vm_page_grab_pages: fetch page ranges.
May 8 2025, 9:30 PM
alc added inline comments to D50253: vm_page_grab_pages: fetch page ranges.
May 8 2025, 9:28 PM

May 7 2025

alc accepted D50199: vm_page: drop mpred param from insert_lookup.
May 7 2025, 9:37 PM
alc added inline comments to D50199: vm_page: drop mpred param from insert_lookup.
May 7 2025, 3:47 PM

May 5 2025

alc accepted D48007: vm_object: drop memq field.
May 5 2025, 10:50 PM
alc added inline comments to D48007: vm_object: drop memq field.
May 5 2025, 10:50 PM

May 1 2025

alc accepted D50094: uma_core: replace listq with plinks.q in temp lists.

The key here is that all page allocation functions call vm_page_dequeue(), completing any lingering page queue operations that involve the plinks.q field.

May 1 2025, 6:37 AM

Apr 30 2025

alc added a comment to D50088: pctrie: add a locked pctrie_lookup_range.

Are you going to update the patch to include vm_page_grab_pages()?

Apr 30 2025, 5:14 PM

Apr 29 2025

alc accepted D42732: arm64: Use the DMAP region in pmap_mapbios.
Apr 29 2025, 6:29 AM