Skip to content

CA-423816 avoid double counting VM overhead memory#7005

Open
lindig wants to merge 2 commits intoxapi-project:masterfrom
lindig:private/christianlin/CA-423816
Open

CA-423816 avoid double counting VM overhead memory#7005
lindig wants to merge 2 commits intoxapi-project:masterfrom
lindig:private/christianlin/CA-423816

Conversation

@lindig
Copy link
Copy Markdown
Contributor

@lindig lindig commented Apr 10, 2026

When we are using a known memory configuration it includes the overhead. So we only have to add it when we create a new configuration.

Localhost migration in a loop before and after the patch, memory reported by list_domains -memory -bytes:

Before:

  id |         uuid |  state |  tot bytes |  max bytes | shadow bytes
  17 | 8fc1ada1-... |    B H | 4296003584 | 4336898048 |     36700160
  18 | 8fc1ada1-... |    B H | 4296003584 | 4376743936 |     36700160
  19 | 8fc1ada1-... |    B H | 4296003584 | 4416589824 |     36700160
  20 | 8fc1ada1-... |    B H | 4296003584 | 4456435712 |     36700160
  21 | 8fc1ada1-... |    B H | 4296003584 | 4496281600 |     36700160
  22 | 8fc1ada1-... |    B H | 4296003584 | 4536127488 |     36700160
  23 | 8fc1ada1-... |    B H | 4296003584 | 4575973376 |     36700160
  24 | 8fc1ada1-... |    B H | 4296003584 | 4615819264 |     36700160
  25 | 8fc1ada1-... |    B H | 4296003584 | 4655665152 |     36700160
  26 | 8fc1ada1-... |    B H | 4296003584 | 4695511040 |     36700160

After:

  id |         uuid |  state |  tot bytes |  max bytes | shadow bytes
  27 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  28 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  29 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  30 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  31 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  32 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  33 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  34 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  35 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  36 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160

Based on work by Edwin Torok.

When we are using a known memory configuration it includes the overhead.
So we only have to add it when we create a new configuration.

Localhost migration in a loop before and after the patch, memory
reported by list_domains -memory -bytes:

  Before:

  id |         uuid |  state |  tot bytes |  max bytes | shadow bytes
  17 | 8fc1ada1-... |    B H | 4296003584 | 4336898048 |     36700160
  18 | 8fc1ada1-... |    B H | 4296003584 | 4376743936 |     36700160
  19 | 8fc1ada1-... |    B H | 4296003584 | 4416589824 |     36700160
  20 | 8fc1ada1-... |    B H | 4296003584 | 4456435712 |     36700160
  21 | 8fc1ada1-... |    B H | 4296003584 | 4496281600 |     36700160
  22 | 8fc1ada1-... |    B H | 4296003584 | 4536127488 |     36700160
  23 | 8fc1ada1-... |    B H | 4296003584 | 4575973376 |     36700160
  24 | 8fc1ada1-... |    B H | 4296003584 | 4615819264 |     36700160
  25 | 8fc1ada1-... |    B H | 4296003584 | 4655665152 |     36700160
  26 | 8fc1ada1-... |    B H | 4296003584 | 4695511040 |     36700160

  After:

  id |         uuid |  state |  tot bytes |  max bytes | shadow bytes
  27 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  28 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  29 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  30 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  31 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  32 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  33 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  34 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  35 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160
  36 | 8fc1ada1-... |    B H | 4256157696 | 4297052160 |     36700160

Based on work by Edwin Torok.

Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
@lindig lindig requested review from edwintorok and robhoes April 10, 2026 13:31
Copy link
Copy Markdown
Member

@edwintorok edwintorok left a comment

Choose a reason for hiding this comment

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

The output looks correct and stable.

You may want to drop the workaround from the quicktests now: https://github.com/xapi-project/xen-api/blob/0673787ff98121c85ea9fb66ae3d8894a5e8ea92/ocaml/quicktest/quicktest_vm_memory.ml#L15C27-L15C47 (there is a workaround_migration flag there that can be dropped completely)

@lindig
Copy link
Copy Markdown
Contributor Author

lindig commented Apr 10, 2026

How about using ~workaround_migration:false and see what happens before removing code?

This fix in the previous patch should obsolete the workaround in the
quickcheck.

Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
Copy link
Copy Markdown
Contributor

@last-genius last-genius left a comment

Choose a reason for hiding this comment

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

Would you mind backporting this to 26.1-lcm?

@lindig
Copy link
Copy Markdown
Contributor Author

lindig commented Apr 10, 2026

I will pack port this after a merge. Just ran the updated quickest and it passed.

@last-genius
Copy link
Copy Markdown
Contributor

I will pack port this after a merge. Just ran the updated quickest and it passed.

I don't think the quicktests themselves are backported

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