> Patch Set 4:
>
> Okay, that helps. I'd still like to have a bit more information in the CL about the implications.
>
> My concern is that this new number is over counting. I haven't tested but my guess would be that the new number is showing the private commit charge for the process. Chrome sometimes commits far more memory than it uses and that leads to over-estimates. Let's discuss more Monday.
There is no, single perfect memory measurement. For any stat that is chosen, I can come up with an artificial scenario with the stat doesn't perform "appropriately".
The concern with committed memory is that it "over-estimates".
For a more thorough discussion, see the original design doc for "consistent memory metrics". For an in-depth analysis focus on Windows, see Albert's analysis.
Two observations:
1) Let us make the assumption that we want to measure resident + swapped/compressed memory, and don't want to committed, but otherwise unused memory on Windows.
First of all, this concept doesn't directly translate to other platforms. Linux has overcommit, which defaults on. macOS behaves similarly, but I'm not aware of any toggle-able flags. On both Linux and macOS, we measure resident + swapped/compressed memory. As I point in my doc, these measurements [for the renderer] are almost identical between macOS and Windows [within 1%]!
This suggests that there is very little memory that is committed, but neither resident nor swapped. And this makes sense. While there are valid use cases for committing large swathes of memory but not using it...we happen to not use them within Chrome. Instead, we usually see Linux-based Chromium developers committing large swathes of memory in error, because they don't realize that "over_commit" doesn't exist on Windows! For example, in this thread that occurred two weeks ago: Chromium developers accidentally wrote code that committed 512MB on Windows, which was not their actual intent!
If private-committed memory does not significantly over-estimate private-working-set plus private-swapped/trimmed then I agree that this could be a good metric. But is that true on Windows? In the referenced document flipboard uses ~50 MB more by the new measure, wikipedia uses 16 MB more, the GPU process uses 57 MB more, etc. These are significant in absolute terms and as a percentage.
It is true that Windows does not support over-commit, so a badly behaved process that commits significantly more memory than it intends to use can potentially cause "out-of-memory" failures. In practice I think this is very rare. Much more common is for machines to run out of address-space or run out of physical memory. Our move to 64-bit means that running out of address space is no longer an issue, but running out of physical memory is.
Displaying our commit charge instead of our private working set will make us look worse
and I don't think it aligns with what we actually want to optimize for. I can see it being advantages to monitor commit charge so that we can detect abuses of it, but commit charge does not equal memory.
Displaying private-working-set plus swapped/trimmed-pages would be ideal but I don't know a way to get that information on Windows.
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to a topic in the Google Groups "Chromium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/a/chromium.org/d/topic/chromium-dev/ELSYMXnvbBc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to chromium-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/e98f3951-b326-4396-a09c-18578ceafd01%40chromium.org.
On 15 September 2017 at 10:17, Albert J. Wong (王重傑) <ajw...@chromium.org> wrote:[ +palmer and haraken for a heads up on PartitionAlloc ]
Regarding PartitionAlloc, it's on my list for next week to try to try exactly what you are suggesting: see if we can reduce the commit charge for untouched memory. I believe this is totally possible by using MEM_RESERVE to grab a continuous address space extent and then doing MEM_COMMIT as necessary with a high-watermark per extent. The current goal is to try to make each PA bucket only eat up a few extra pages (1 is ideal, but will need to look at object size and cost of multiple syscalls to MEM_COMMIT) at the ragged edge.As a caveat though, doing a 2-step MEM_RESERVE/MEM_COMMIT introduces an extra syscall transitions on a normal allocation when we step over the high water mark.There's some stuff to play with here to try and amortize the cost, but we may up in a scenario where we're trading actual overall performance for more understandable/reliable metric and have to reopen this discussion. So regarding "shouldn't we try to reduce this number?"...yes...we should and will, but I want to explicitly state the (possibly obvious) point that metric and memory reduction is not a good thing. The goal should be to understand and reduce waste, not to just universally reduce.
This is a critical point; we really need to take care not to over-focus on reducing metrics like the commit-charge, and stay focused on the user-facing impact of our memory usage patterns.(As an illustrative example, we sometimes focus on line-coverage as a metric for test coverage, but that is typically only worthwhile to improve when it is very poor - reaching 100% line-coverage doesn't necessarily guarantee good test-coverage, so once line-coverage is "good enough", it's usually better to focus efforts elsewhere.)
Regarding the metric rename, agreed we need to make it possible to understand our terms.
Right; which metric to show, and its meaning, is in part a function of what we are able to query from the platform, but also a function of what question it is that we're aiming to answer.If the typical questions we're answering are things like- "what is making my device swap-jank?"- "why do programs keep OOMing?"- "is my site's memory usage 'reasonable' given what it is doing?"then Erik's CMM in combination with other metrics (e.g. hard fault count for the swap-jank question) are likely good-enough, given clarity as to their meaning.I would argue that our existing crop of metrics make these sorts of questions hard to answer without a deep understanding of both Chrome and platform memory-management...
Not gonna wade into the UI quagmire, but at the very least, we need solid documentation publicly in Markdown on what "footprint" means. @Erikchen: should we bubble up priority on fixing key_concepts.md or similar? We need an executive summary of your CMM doc.
Yes please! :)
My take away from this is there are items to fix for readability and some exploration to do on our various heaps, but I think we're agreed on making this change with the blocker being on ensuring people can understand the terms we used? Does that sound right?
SGTM-Albert
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CALcbsXDX3N7q%3DHCKBDFx3FGJ-c0MB%3D5%3DQRWOXV%2BZQ9Uf52a4Kw%40mail.gmail.com.You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
> it is worth spending some cost to make commit-charge better approximate our true memory numbersAgreed. We'll look into this next week and also update the relevant documentation.I cleaned up the Consistent Memory Metrics doc. The previous version had a long-winded theoretical discussion which has been moved to the appendix. Now, private memory footprint is defined on all platforms as: private, anonymous, non-discardable memory that is resident/compressed/swapped. If compressed, we count pre-compression size.Our current estimate on Windows for private memory footprint is to use private committed memory. This appears to be an okay, but not great estimate. My original thought was that we could update the computation of private memory footprint to explicitly subtract out "untouched", committed regions from allocators under our control. However, based on Bruce's stats, it might even make sense to update the behavior of partition alloc to be more lazy about committing memory from super-pages. The added benefit of this is that our "private memory footprint" continues to be exactly private committed, which is also reported by other system utilities.To follow along on improvements for private memory footprint on Windows and/or changes to partition alloc, see: https://bugs.chromium.org/p/chromium/issues/detail?id=765406
On Friday, September 15, 2017 at 12:11:32 PM UTC-7, Bruce Dawson wrote:Luckily the cost of VirtualAlloc to commit more pages is quite low. From previous measurements I have found that VirtualAlloc to reserve and commit several MB of RAM takes about 5 μs. I don't know what the cost of committing previously reserve pages would be, but presumably no more. Faulting in each page is about 0.7 μs, so the unavoidable cost of faulting in a dozen pages is greater than the cost of committing them (as a group) on demand. Doing some quick tests to measure the costs would be worthwhile. Note that I do not think we should decommit aggressively - the cost/benefit tradeoff for that seems very poor.> we may end up in a scenario where we're trading actual overall performance for more understandable/reliable metric and have to reopen this discussionAgreed. But it is worth spending some cost to make commit-charge better approximate our true memory numbers both because reducing commit charge does have some modest value, but mostly because there is tremendous value in having numbers that we can trust.Put another way, by making commit charge our top-line memory summary we are telling developers to optimize for it. So we should optimize for it (within reason).On Fri, Sep 15, 2017 at 10:49 AM, Wez <w...@chromium.org> wrote:(and now from the correct account)On 15 September 2017 at 10:48, Wez <w...@google.com> wrote:On 15 September 2017 at 10:17, Albert J. Wong (王重傑) <ajw...@chromium.org> wrote:[ +palmer and haraken for a heads up on PartitionAlloc ]
Regarding PartitionAlloc, it's on my list for next week to try to try exactly what you are suggesting: see if we can reduce the commit charge for untouched memory. I believe this is totally possible by using MEM_RESERVE to grab a continuous address space extent and then doing MEM_COMMIT as necessary with a high-watermark per extent. The current goal is to try to make each PA bucket only eat up a few extra pages (1 is ideal, but will need to look at object size and cost of multiple syscalls to MEM_COMMIT) at the ragged edge.As a caveat though, doing a 2-step MEM_RESERVE/MEM_COMMIT introduces an extra syscall transitions on a normal allocation when we step over the high water mark.There's some stuff to play with here to try and amortize the cost, but we may up in a scenario where we're trading actual overall performance for more understandable/reliable metric and have to reopen this discussion. So regarding "shouldn't we try to reduce this number?"...yes...we should and will, but I want to explicitly state the (possibly obvious) point that metric and memory reduction is not a good thing. The goal should be to understand and reduce waste, not to just universally reduce.This is a critical point; we really need to take care not to over-focus on reducing metrics like the commit-charge, and stay focused on the user-facing impact of our memory usage patterns.(As an illustrative example, we sometimes focus on line-coverage as a metric for test coverage, but that is typically only worthwhile to improve when it is very poor - reaching 100% line-coverage doesn't necessarily guarantee good test-coverage, so once line-coverage is "good enough", it's usually better to focus efforts elsewhere.)
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CALcbsXDLt%2Bk6N6NpkDTsuqyQ9Ua93WhGHiNAHQsv2KPkasOuLA%40mail.gmail.com.