-
-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorporate shared memory in bar text #913
Conversation
0fb42c8
to
5666ecc
Compare
Actually, when shared was separated (3.1.0), I think the bar text was actually displaying I think this is good compromise - tmpfs is back in there, and it's still based it on the displayed bars. |
I'm not really happy with changing the order in which values are displayed as this will likely interfere with platforms other than Linux. Apart from this I don't like introducing so much noise for just changing the values included in the calculation. Why not |
My belief was that it wouldn't affect other systems at all - they don't have a
Good question. As written, it's simply because Research seems to confirm that the Source: https://unix.stackexchange.com/questions/440558/30-of-ram-is-buffers-what-is-it So I don't think it should be included. And it also changes the answer on other platforms. Including only |
There's a related point here with respect to the graph display - that basically shows full all the time on Linux, because it's summing
I would suggest there should be a separate |
|
Thanks for feedback - I like the graph colouring - that addresses the problem in a different way. My proposal wouldn't break it. I was suggesting a separate |
@kjbracey The |
Sounds like I may need to review more carefully the meaning of Memory has 5 entries, of which you want 4 in a stacked graph. But given that the cache naturally fills all unused space, it's not that useful to just add the 4 together to get a total if you can't see how much is cache. Excluding the cache gives a more useful number. And that's what the text on the bar already does.
Names could be clarified. Maybe |
@kjbracey No, the cache doesn't technically fill all unused space of the memory, in Linux at least. |
Indeed, but it tends to fill it up meaning that a simple total including it does not reasonably reflect current memory demands, so is generally less useful than it would be without including it. And that's why the bar text has never included it. And it's why the monochrome graph isn't very useful, and why your coloured changes are a significant benefit compared to the monochrome, by making the cache perceivable. I'm not doing the |
5666ecc
to
7f7383e
Compare
7f7383e
to
bba6c45
Compare
I've rethought my |
@kjbracey2 Please rebase this branch and resolve the issues in the discussion as you go. If there's further input you need, feel free to ask. |
bba6c45
to
12be9e1
Compare
Rebased - not sure what to address, aside from the Note that #1153 had left the help inconsistent with the actual display - this corrects that as it goes, which maybe makes it less clear. Maybe I should add an initial commit fixing that. |
12be9e1
to
7b442b3
Compare
Okay, separated out the help correction. Haven't reworded the commit message, but the effect of the second commit is now actually more to move "buffers" - the thing about "summing a discontiguous region" was now already happening with used+compressed and buffers in between. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Mostly the isnan
vs isgreater
change left.
MemoryMeter.c
Outdated
double used = this->values[MEMORY_METER_USED]; | ||
/* we actually want to show "used + shared + compressed" */ | ||
double claimed = this->values[MEMORY_METER_USED]; | ||
if (!isnan(this->values[MEMORY_METER_SHARED])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use isgreater
as suggested in the other discussion with @Explorer09 …
7b442b3
to
40e2599
Compare
Awaiting clarification on the |
I stand corrected. The code surely isn't on main. When I was working with the color graph code in my personal branch, I have been using Here is my suggestion: start using |
@Explorer09 Can you check which PR the changes for |
Is there something that can be done to get this merged? I believe the |
Shared memory is less available than buffers, so move it left next to used memory. This is in preparation for including shared memory in the basic "in use" for the bar text. It would not make sense to sum a discontiguous region.
Shared memory is not available for reclaim, and plays an equally significant role in memory load as the "used" memory Since "shared" was separated from the "used" value, the basic "used/total" display in the bar text has become less meaningful for Linux, as it only reflects a subset of the claimed memory. The difference often isn't huge, but it can become so if tmpfs, shmget()/shm_open() or MAP_SHARED is heavily used. Improve the situation by adding shared memory to the "used" value in the memory bar text. [Reworded commit message and dropped "claimed" terminology as it is completely non-standard and does not match the output of free(1).]
I like the ordering changes, +1 on that. However, I disagree with the wording changes. "Claimed" is completely new terminology that is never used anywhere else, so I don't think it would be helpful to replace an established (even if ambiguous) term with a completely new and never-before-used word. More importantly, "used" memory is how coreutils' free(1) calls it. Thus I am of opinion that htop should just match that terminology. (I have rebased the PR's branch on top of main, dropping wording changes, here.) |
PR LGTM.
ACK.
I pulled in your changes. Thx.
AFAICS there's some open discussions from @Explorer09 . If those could be marked resolved if no longer applicable we are GTG.
ACK. |
@BenBE What open discussion did I have now? Regarding What else did I miss? |
That was the only one. GTG … |
The corollary then is that the other usage of "used" should be changed, removing the ambiguity within htop, and avoiding using that coreutils term for something different. |
Shared memory is claimed, and as significant a part of the memory load as the "used" memory. Since "shared" was separated from the "used" value, the basic "used/total" display in the bar text has become less meaningful for Linux, as it only reflects a subset of the claimed memory. The difference often isn't huge, but it can become so if tmpfs is heavily used.
Improve the situation by adding used and shared for that text, making it "claimed/total".
In accordance with that logic, move the shared value leftwards next to the used value, so that we're summing the two leftmost values - a contiguous region.
Fixes #906.
(This could be separated into two PRs, but they would conflict - doing it as two patches).