Skip to content

Report swapinfo#140

Open
ben-grande wants to merge 1 commit into
QubesOS:mainfrom
ben-grande:share-swap
Open

Report swapinfo#140
ben-grande wants to merge 1 commit into
QubesOS:mainfrom
ben-grande:share-swap

Conversation

@ben-grande

Copy link
Copy Markdown

Allows distinguishing how much memory the qube is using from what is assigned by using "meminfo - swapinfo".

For: QubesOS/qubes-core-admin#827


Tested briefly.

ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jun 25, 2026
@codecov-commenter

codecov-commenter commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.24%. Comparing base (0dc52ab) to head (d12a416).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #140   +/-   ##
=======================================
  Coverage   71.24%   71.24%           
=======================================
  Files           6        6           
  Lines         991      991           
=======================================
  Hits          706      706           
  Misses        285      285           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jun 25, 2026
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 3, 2026
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 6, 2026
Comment thread qmemman/meminfo-writer.c Outdated
Comment on lines +89 to +90
sprintf(used_mem_buf, "%lld", used_mem);
sprintf(used_swap_buf, "%lld", used_swap);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant calls.

Comment thread qmemman/meminfo-writer.c Outdated
syslog(LOG_DAEMON | LOG_ERR, "error writing meminfo to xenstore ?");
exit(1);
}
if (!xs_write(xs, XBT_NULL, "memory/swapinfo", swap, strlen(swap))) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: this can be merged only after core-admin part, which sets necessary xenstore access.

Comment thread qmemman/meminfo-writer.c Outdated
char *swap;
} UsedMem;

UsedMem parse(const char *meminfo_buf, const char* dom_current_buf)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW the usual method in C for returning more results is to either return a pointer to a structure (usually dynamically allocated via malloc), or add output parameters (pointers to where function should write result). In case of a simple structure like this, compiler will do the latter for you here, so it can stay this way, but keep in mind it wont be efficient code in more complex cases.

Comment thread qmemman/meminfo-writer.c Outdated
return (UsedMem){ .mem = used_mem_buf, .swap = used_swap_buf };
}
return NULL;
return (UsedMem){ .mem = NULL, .swap = NULL };

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Report swap change if above threshold despite memory being below its threshold.

Comment thread qmemman/meminfo-writer.c Outdated
if (meminfo_data)
send_to_qmemman(xs, meminfo_data);
UsedMem meminfo_data = parse(meminfo_buf, dom_current_buf);
if (meminfo_data.mem && meminfo_data.mem[0])

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allows distinguishing how much memory the qube is using from what is
assigned by using "meminfo - swapinfo".

For: QubesOS/qubes-core-admin#827
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 14, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" being used in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 14, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" being used in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 16, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" being used in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 17, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 17, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 21, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 22, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 22, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 22, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 22, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 22, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 23, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 23, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 24, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
ben-grande added a commit to ben-grande/qubes-core-admin that referenced this pull request Jul 24, 2026
Although both values can be lied by the qube, we can distinguish the
"memory types" in client tools.

For: QubesOS/qubes-linux-utils#140
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants