Page MenuHomeFreeBSD

alc (Alan Cox)
User

Projects

User Details

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

Recent Activity

Yesterday

alc created D17296: Eliminate unnecessary uses of UMA_ZONE_NOFREE from the swap pager.
Sat, Sep 22, 10:35 PM
alc accepted D17227: Use M_NEXTFIT in memguard..

My comments are not about this patch, but other issues with memguard.

Sat, Sep 22, 9:40 PM
alc added inline comments to D17226: Implement M_NEXTFIT..
Sat, Sep 22, 5:00 AM

Fri, Sep 21

alc accepted D17278: Add more lowmem predicates..
Fri, Sep 21, 10:34 PM
alc accepted D17277: Further reorganize pmap_invalidate TLB code..
Fri, Sep 21, 10:14 PM
alc added a comment to D17184: amd64: ifunc-ify pmap_invalidate_XXX() TLB invalidation functions..

kernel pmap. Specifically, I would propose clearing the processor's bit in the kernel pmap when it halts. That said, we would still need to have a separate flag indicating when the processor needs to take action when it wakes. (Depending on the documentation of the deeper sleep states maybe that action is a NOP.)

Fri, Sep 21, 10:08 PM
alc added inline comments to D17277: Further reorganize pmap_invalidate TLB code..
Fri, Sep 21, 9:38 PM
alc added inline comments to D17184: amd64: ifunc-ify pmap_invalidate_XXX() TLB invalidation functions..
Fri, Sep 21, 5:45 PM
alc accepted D17184: amd64: ifunc-ify pmap_invalidate_XXX() TLB invalidation functions..
Fri, Sep 21, 5:42 PM
alc added inline comments to D16836: Allow empty NUMA domains to support AMD 2990WX.
Fri, Sep 21, 5:41 PM
alc added a comment to D17249: Ensure that imports into per-domain arenas are aligned..
In D17249#367826, @alc wrote:

Here is some food for thought. We might be better of if we used the per-domain arenas differently. Suppose that the import function allocated the physical memory and mapped it. Further, suppose that we had a release function, and that function actually unmapped and freed physical memory. The benefits being: (1) we wouldn't have to wait for full population to trigger promotion, and (2) uma_reclaim() wouldn't trigger demotions (and hopefully later repromotions).

That's a cool idea. My main concern would be fragmentation, but kmem_* already use M_BESTFIT and we can at least easily measure the amount of physical memory wasted using vmem_size().

Fri, Sep 21, 5:14 PM
alc accepted D17184: amd64: ifunc-ify pmap_invalidate_XXX() TLB invalidation functions..
Fri, Sep 21, 4:54 PM
alc added inline comments to D17226: Implement M_NEXTFIT..
Fri, Sep 21, 6:38 AM

Thu, Sep 20

alc added a comment to D17249: Ensure that imports into per-domain arenas are aligned..

Here is some food for thought. We might be better of if we used the per-domain arenas differently. Suppose that the import function allocated the physical memory and mapped it. Further, suppose that we had a release function, and that function actually unmapped and freed physical memory. The benefits being: (1) we wouldn't have to wait for full population to trigger promotion, and (2) uma_reclaim() wouldn't trigger demotions (and hopefully later repromotions).

Thu, Sep 20, 5:50 PM
alc accepted D17249: Ensure that imports into per-domain arenas are aligned..
Thu, Sep 20, 5:25 PM
alc accepted D17249: Ensure that imports into per-domain arenas are aligned..
Thu, Sep 20, 4:47 PM
alc accepted D17248: Fix domain selection in kmem_back()..
Thu, Sep 20, 6:36 AM
alc accepted D17249: Ensure that imports into per-domain arenas are aligned..
Thu, Sep 20, 6:27 AM

Wed, Sep 19

alc accepted D17247: Move kernel vmem arena initialization to vm_kern.c..
Wed, Sep 19, 5:54 PM
alc added inline comments to D17226: Implement M_NEXTFIT..
Wed, Sep 19, 5:31 PM
alc accepted D16736: Some more uses for ifuncs on x86..
Wed, Sep 19, 3:44 PM

Tue, Sep 18

alc added inline comments to D17175: Fix memguard when options NUMA is configured..
Tue, Sep 18, 11:18 PM
alc added inline comments to D16736: Some more uses for ifuncs on x86..
Tue, Sep 18, 10:58 PM
alc added inline comments to D17226: Implement M_NEXTFIT..
Tue, Sep 18, 10:41 PM
alc added inline comments to D17175: Fix memguard when options NUMA is configured..
Tue, Sep 18, 4:59 PM
alc added inline comments to D17175: Fix memguard when options NUMA is configured..
Tue, Sep 18, 4:46 PM
alc accepted D17209: Only update the domain cursor once in keg_fetch_slab()..
Tue, Sep 18, 4:22 PM

Sun, Sep 16

alc accepted D17181: Use ifunc to resolve context switching mode on amd4..
Sun, Sep 16, 10:11 PM
alc added a comment to D17181: Use ifunc to resolve context switching mode on amd4..

Do you plan to apply similar changes to the TLB invalidation code?

Sun, Sep 16, 6:27 PM
alc accepted D17181: Use ifunc to resolve context switching mode on amd4..
Sun, Sep 16, 6:24 PM

Sat, Sep 15

alc added a comment to D15055: Map constant zero page on read faults which touch non-existing anon page..
In D15055#364249, @kib wrote:
In D15055#364225, @alc wrote:
In D15055#324440, @kib wrote:
In D15055#324434, @jeff wrote:

So the consensus is this doesn't actually significantly optimize anything we can find? It certainly isn't worth extra faults in that case.

I am not sure about the consensus. You do have the test where this change helps, right ?

From the links that Alan posted, it seems that Linux also had the resistance to get the similar patch accepted, but ultimately they merged it. Might be we should add a knob to enable zero page mapping. Aside from the required changes to non-x86 pmap, it is rather easy to handle.

In regards to the 4KB zero page, the situation was actually the reverse. People were proposing the removal of the zero-page "optimization", arguing that it was not an effective optimization. Essentially, they had done similar measurements to ours. But, Linux has had this "optimization" from the beginning, before it had multiprocessor support (and the need for TLB shootdown). Linus resisted the proposal citing unspecified Fortran programs as the reason for keeping it.

A 2MB zero page was added to Linux based on claims that it reduced physical memory usage in one particular NAS benchmark (written in Fortran). However, Kostik tried this same program on FreeBSD with this patch and found no evidence that there was any physical memory savings.

I'll add that one of my graduate students has been doing tests with the NAS benchmarks, specifically, the variants for shared-memory multiprocessors using OpenMP. To their credit, the NAS benchmarks parallelize the initialization phase as well as the core computation. (Also, the parallelization of the initialization typically aligns well with the parallelization of the core computation, so a first-touch NUMA policy outperforms interleave.) So, any usage of the zero-page "optimization" where the page is written to and replaced by a physical page is going to require a system-wide TLB shootdown because the initialization is being done in parallel across the entire machine.

Clearly, one can write a program that uses less physical memory with the zero-page "optimization", but I don't think that we're going to come across a non-trivial number of real-world programs where that is the case. And, more often we're going to see cases where implementing the zero page is going to add run-time overhead. I would say that any knob enabling it should be per-process, perhaps an madvise option or mmap flag.

I do not think that it makes sense to add a knob that requires application to explicitly tune it. Both because I do not believe that any app would bother with this specifically for FreeBSD optimization, and because it adds a delicate code to handle never-used mode of operation.

Sat, Sep 15, 10:53 PM
alc added inline comments to D17175: Fix memguard when options NUMA is configured..
Sat, Sep 15, 9:09 PM

Thu, Sep 13

alc added a comment to D16385: Make the default image base on AArch64 and i386 superpage-aligned.

Has anyone looked at armv7, where I believe lld is now the default? My impression is that the default image base there is 64 KB. If so, I would argue for updating it before we roll 12.0.

Thu, Sep 13, 7:53 PM
alc added a comment to D16385: Make the default image base on AArch64 and i386 superpage-aligned.

In (1), we will have zero code segment superpage mappings. The reduction in run time between (1) and (2) suggests that there are some "naturally-occurring" superpage mappings once we have properly aligned the code. This is consistent with what I see on amd64. The effect is just larger. To close the gap between (2) and (3), we'll have to introduce heuristics that will do the extra page-ins, even though the pages are not a part of a normally accessed chunk of the address space.

Thu, Sep 13, 7:09 PM
alc added a comment to D16836: Allow empty NUMA domains to support AMD 2990WX.

We already have code to renumber NUMA domains to avoid holes in the domain ID space (renumber_domains() in srat.c). Wouldn't it be simpler to apply a similar approach to empty domains, or is there some reason that won't work?

I'm not sure how renumbering helps. At least in my desktop, we have 4 domains. Domains 0 and 2 have both memory and CPU cores. Domains 1 and 3 are empty of memory but have CPU cores. If we renumber, don't we loose information?

Right, but how are we making use of that information now? I'm not sure what the SLIT looks like on the 2990WX (what does "sysctl vm.phys_locality" report?) but in other cases we might want to, based on locality information, treat all CPUs in domain 1 as being in domain 0, and CPUs in domain 3 as being in domain 2.

Anyway, I'm just concerned that this approach is a bit fragile given the number of places where we have to adjust a "domain" parameter. It looks ok to me modulo the comments below.

Thu, Sep 13, 6:03 PM

Sat, Sep 8

alc resigned from D2404: Handle vm_phys returning NULL in vm_page_alloc().

I think that this change should be abandoned.

Sat, Sep 8, 7:52 PM
alc accepted D17028: Split some checks in vm_page_activate() to make it easier to read..
Sat, Sep 8, 7:51 PM
alc added a comment to D12635: Allow allocations across meta boundaries.
In D12635#364226, @pho wrote:

The only difference between this and what was posted in January is that that patch discarded code that has recently been found to be buggy, and this patch discards the fixed code.

I ran a full test with D12635.id47723.diff. No problems seen.

Sat, Sep 8, 7:49 PM
alc added a comment to D13644: Eliminate "pass" from vm_pageout_scan() and vm_pageout_worker().

I believe this revision can be closed.

Sat, Sep 8, 7:35 PM
alc added a comment to D15055: Map constant zero page on read faults which touch non-existing anon page..
In D15055#324440, @kib wrote:
In D15055#324434, @jeff wrote:

So the consensus is this doesn't actually significantly optimize anything we can find? It certainly isn't worth extra faults in that case.

I am not sure about the consensus. You do have the test where this change helps, right ?

From the links that Alan posted, it seems that Linux also had the resistance to get the similar patch accepted, but ultimately they merged it. Might be we should add a knob to enable zero page mapping. Aside from the required changes to non-x86 pmap, it is rather easy to handle.

Sat, Sep 8, 7:18 PM
alc added inline comments to D16901: Eliminate some needless attempts to merge buddies.
Sat, Sep 8, 6:26 PM

Fri, Sep 7

alc accepted D17027: Fix synchronization between vm_pqbatch_process_page() and pagedaemon..
Fri, Sep 7, 5:21 PM

Thu, Sep 6

alc added inline comments to D17027: Fix synchronization between vm_pqbatch_process_page() and pagedaemon..
Thu, Sep 6, 5:38 PM
alc accepted D17020: Fix an edge case in the node count computation in blist_create()..
Thu, Sep 6, 12:24 PM

Mon, Sep 3

alc accepted D16191: Fix vm_waitpfault on numa.

My policy question aside, I see no reason not to commit this change ASAP, once the two comments by Kostik about replacing the word "zone" with "domain" are addressed.

Mon, Sep 3, 5:37 PM

Sun, Sep 2

alc committed rS338431: Recent changes have created, for the first time, physical memory segments.
Recent changes have created, for the first time, physical memory segments
Sun, Sep 2, 6:29 PM
alc closed D16976: Coalesce physical memory segments.
Sun, Sep 2, 6:29 PM

Sat, Sep 1

alc added a comment to D16976: Coalesce physical memory segments.
In D16976#362278, @kib wrote:

Why not coalesce phys_avail[] ranges instead ? I believe that we handle such range if it should be split between proximity domains, looking at the code in vm_phys_create_seg().

Sat, Sep 1, 5:30 PM

Fri, Aug 31

alc created D16976: Coalesce physical memory segments.
Fri, Aug 31, 6:00 PM

Thu, Aug 30

alc added inline comments to D16666: Add some accounting to the per-domain full bucket caches..
Thu, Aug 30, 5:39 PM
alc added a comment to D16881: Remove {max/min}_offset, use vm_map_{max/min}..

This revision can now be closed. (Do you have any idea why revisions, like this one, are no longer closing automatically?)

Thu, Aug 30, 5:32 AM

Wed, Aug 29

alc accepted D16881: Remove {max/min}_offset, use vm_map_{max/min}..
Wed, Aug 29, 6:42 AM

Mon, Aug 27

alc added inline comments to D16881: Remove {max/min}_offset, use vm_map_{max/min}..
Mon, Aug 27, 5:11 PM
alc added inline comments to D16881: Remove {max/min}_offset, use vm_map_{max/min}..
Mon, Aug 27, 4:28 PM
alc committed rS338318: Eliminate the arena parameter to kmem_free(). Implicitly this corrects an.
Eliminate the arena parameter to kmem_free(). Implicitly this corrects an
Mon, Aug 27, 4:28 PM
alc closed D16845: Replace kmem_free()'s arena parameter.

This change was committed.

Mon, Aug 27, 4:23 PM

Sun, Aug 26

alc added a comment to D16666: Add some accounting to the per-domain full bucket caches..

Aside from my question about whether imin and imax should be reset, I think that this is change is correct and complete.

Sun, Aug 26, 4:35 PM

Sat, Aug 25

alc added inline comments to D16666: Add some accounting to the per-domain full bucket caches..
Sat, Aug 25, 5:33 PM
alc added inline comments to D16845: Replace kmem_free()'s arena parameter.
Sat, Aug 25, 4:45 PM
alc accepted D16893: Add pmap_activate_boot() on i386..
Sat, Aug 25, 3:09 AM

Fri, Aug 24

alc added a reviewer for D16881: Remove {max/min}_offset, use vm_map_{max/min}.: markj.
Fri, Aug 24, 4:09 PM
alc updated the diff for D16845: Replace kmem_free()'s arena parameter.

Update to reflect the reinstatement of drm{,2}.

Fri, Aug 24, 3:50 AM

Aug 23 2018

alc added a comment to D15977: Make the partpopq LRU sloppy to reduce contention.

Jeff, can you please close this review. This change was committed 6 weeks ago, but the commit didn't cite this review, so it wasn't automatically closed.

Aug 23 2018, 8:21 PM
alc added a comment to D14666: Increment v_pdpages in the laundry queue scan..

I would love to see this committed before we branch for 12.0.

Aug 23 2018, 8:09 PM
alc added inline comments to D16845: Replace kmem_free()'s arena parameter.
Aug 23 2018, 6:37 PM
alc updated subscribers of D16845: Replace kmem_free()'s arena parameter.

Adding jtl@ because this change replaces the per-slab executable flag that he introduced by a per-page flag.

Aug 23 2018, 6:28 PM
alc updated the diff for D16845: Replace kmem_free()'s arena parameter.

Eliminate the arena parameter to kmem_free().

Aug 23 2018, 6:21 PM
alc committed rS338143: Eliminate kmem_malloc()'s unused arena parameter. (The arena parameter.
Eliminate kmem_malloc()'s unused arena parameter. (The arena parameter
Aug 23 2018, 6:09 PM
alc closed D16825: Eliminate the unused arena parameter from kmem_malloc().

I'm not sure why this revision wasn't closed automatically by the commit. The commit logs show that I cited this review.

Aug 23 2018, 6:07 PM
alc added inline comments to D16836: Allow empty NUMA domains to support AMD 2990WX.
Aug 23 2018, 5:58 PM
alc accepted D15980: Ensure that all queue state is cleared when vm_page_dequeue() returns..

Functionally, this change looks good to me. Do as you see fit with my earlier comments, and commit the change. l don't feel the need to review it again.

Aug 23 2018, 5:56 PM
alc added inline comments to D15980: Ensure that all queue state is cleared when vm_page_dequeue() returns..
Aug 23 2018, 5:45 PM

Aug 22 2018

alc created D16845: Replace kmem_free()'s arena parameter.
Aug 22 2018, 3:20 PM
alc added inline comments to D16836: Allow empty NUMA domains to support AMD 2990WX.
Aug 22 2018, 4:36 AM

Aug 21 2018

alc created D16825: Eliminate the unused arena parameter from kmem_malloc().
Aug 21 2018, 6:52 AM

Aug 19 2018

alc added a comment to D16799: Eliminate the unused arena parameter from kmem_alloc_contig().
In D16799#357568, @jeff wrote:
In D16799#357567, @alc wrote:
In D16799#357566, @jeff wrote:
In D16799#357563, @alc wrote:
In D16799#357540, @jeff wrote:

I did not do this before because I felt the ROI was low compared to the churn in ports. Have we contacted ports maintainers? The nvidia and virtualbox port are both going to need #ifdefs.

I will followup with the ports maintainers. I had two reasons for this. Primarily, I want to implement stronger segregation for physical memory allocations that are permanent, e.g., physical pages backing UMA_ZONE_NOFREE. Specifically, I don't want to have to modify the kmem callers to specify a different arena if that arena is simply a placeholder. Secondarily, we use the arenas somewhat differently in older branches. So, mechanical MFCs may not do the correct thing anyway.

Do you intend to do kmem_malloc as well?

Yes, and kmem_free().

At this point in the release we should possibly also consult re@

Sure, and I'll make it clear that this is not a functional change.

If you'd like I can write an awk script to convert these and we can fix it up by hand if necessary. There are quite a lot of those locations.

Aug 19 2018, 9:10 PM
alc added a comment to D16799: Eliminate the unused arena parameter from kmem_alloc_contig().
In D16799#357566, @jeff wrote:
In D16799#357563, @alc wrote:
In D16799#357540, @jeff wrote:

I did not do this before because I felt the ROI was low compared to the churn in ports. Have we contacted ports maintainers? The nvidia and virtualbox port are both going to need #ifdefs.

I will followup with the ports maintainers. I had two reasons for this. Primarily, I want to implement stronger segregation for physical memory allocations that are permanent, e.g., physical pages backing UMA_ZONE_NOFREE. Specifically, I don't want to have to modify the kmem callers to specify a different arena if that arena is simply a placeholder. Secondarily, we use the arenas somewhat differently in older branches. So, mechanical MFCs may not do the correct thing anyway.

Do you intend to do kmem_malloc as well?

Aug 19 2018, 7:53 PM
alc added inline comments to D16666: Add some accounting to the per-domain full bucket caches..
Aug 19 2018, 7:44 PM
alc added a comment to D16799: Eliminate the unused arena parameter from kmem_alloc_contig().
In D16799#357563, @alc wrote:
In D16799#357540, @jeff wrote:

I did not do this before because I felt the ROI was low compared to the churn in ports. Have we contacted ports maintainers? The nvidia and virtualbox port are both going to need #ifdefs.

I will followup with the ports maintainers. I had two reasons for this. Primarily, I want to implement stronger segregation for physical memory allocations that are permanent, e.g., physical pages backing UMA_ZONE_NOFREE. Specifically, I don't want to have to modify the kmem callers to specify a different arena if that arena is simply a placeholder.

Aug 19 2018, 7:39 PM
alc added a comment to D16799: Eliminate the unused arena parameter from kmem_alloc_contig().
In D16799#357540, @jeff wrote:

I did not do this before because I felt the ROI was low compared to the churn in ports. Have we contacted ports maintainers? The nvidia and virtualbox port are both going to need #ifdefs.

Aug 19 2018, 7:22 PM
alc added inline comments to D16799: Eliminate the unused arena parameter from kmem_alloc_contig().
Aug 19 2018, 7:08 PM
alc updated the diff for D16799: Eliminate the unused arena parameter from kmem_alloc_contig().

Increase the number of lines of context.

Aug 19 2018, 6:57 PM
alc added inline comments to D16799: Eliminate the unused arena parameter from kmem_alloc_contig().
Aug 19 2018, 3:50 PM
alc added inline comments to D16799: Eliminate the unused arena parameter from kmem_alloc_contig().
Aug 19 2018, 4:47 AM
alc created D16799: Eliminate the unused arena parameter from kmem_alloc_contig().
Aug 19 2018, 4:45 AM

Aug 18 2018

alc committed rS338032: Oops. r338030 didn't eliminate the unused arena argument from all of.
Oops. r338030 didn't eliminate the unused arena argument from all of
Aug 18 2018, 10:35 PM
alc closed D16793: Eliminate the unused arena parameter from kmem_alloc_attr().
Aug 18 2018, 10:08 PM
alc committed rS338030: Eliminate the unused arena parameter from kmem_alloc_attr()..
Eliminate the unused arena parameter from kmem_alloc_attr().
Aug 18 2018, 10:08 PM
alc added a comment to D16793: Eliminate the unused arena parameter from kmem_alloc_attr().
In D16793#357204, @kib wrote:
In D16793#357203, @alc wrote:

Should I bump __FreeBSD_version?

I would not.

Aug 18 2018, 9:03 PM
alc added a comment to D16793: Eliminate the unused arena parameter from kmem_alloc_attr().
In D16793#357198, @kib wrote:

kmem_malloc() needs sys_machdep.c update. I think it is better to keep them in separate changes.

Aug 18 2018, 8:02 PM
alc added a comment to D16793: Eliminate the unused arena parameter from kmem_alloc_attr().

I'm happy to either add kmem_malloc() and kmem_alloc_contig() to this patch or do them separately.

Aug 18 2018, 7:45 PM
alc added a comment to D16793: Eliminate the unused arena parameter from kmem_alloc_attr().

This should probably include an increment to __FreeBSD_version.

Aug 18 2018, 7:43 PM
alc added reviewers for D16793: Eliminate the unused arena parameter from kmem_alloc_attr(): jeff, kib, markj.
Aug 18 2018, 7:19 PM
alc created D16793: Eliminate the unused arena parameter from kmem_alloc_attr().
Aug 18 2018, 7:18 PM
alc committed rS338018: Eliminate the arena parameter to kmem_malloc_domain(). It is redundant..
Eliminate the arena parameter to kmem_malloc_domain(). It is redundant.
Aug 18 2018, 6:33 PM
alc closed D16713: Eliminate an unnecessary parameter to kmem_malloc_domain().
Aug 18 2018, 6:33 PM

Aug 16 2018

alc added inline comments to D16712: inline swp_pager_isondev() function and use it 2 other places.
Aug 16 2018, 6:29 AM
alc accepted D16712: inline swp_pager_isondev() function and use it 2 other places.
Aug 16 2018, 6:14 AM
alc added inline comments to D16712: inline swp_pager_isondev() function and use it 2 other places.
Aug 16 2018, 6:00 AM
alc added a comment to D16713: Eliminate an unnecessary parameter to kmem_malloc_domain().
In D16713#355892, @alc wrote:

Do you plan to update the kmem_malloc() prototype at some point?

I would happily see the arena argument removed from all of these functions before we branch 12.x. kmem_free() is the only one where the arena isn't entirely redundant. Essentially, kmem_free() uses the arena as a flag to determine whether the addresses should be returned to the domain's kernel arena or rwx arena.

Do we have a consensus?

Are you proposing that we keep the arena parameter to kmem_free()?

Aug 16 2018, 5:32 AM