Skip to content

Commit

Permalink
memfd_secret: save secretmem stat
Browse files Browse the repository at this point in the history
Adds support to save secretmem page stats when C/R a memfd_secret
fd containing process.

Updates images/stats.proto to add statistics about C/R
memfd_secret fd.

Signed-off-by: Dhanuka Warusadura <[email protected]>
  • Loading branch information
warusadura committed Oct 15, 2023
1 parent 48aab47 commit 4da5571
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions criu/include/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ enum {
CNT_SHPAGES_SKIPPED_PARENT,
CNT_SHPAGES_WRITTEN,

CNT_SECMEMPAGES_SCANNED,
CNT_SECMEMPAGES_SKIPPED_PARENT,
CNT_SECMEMPAGES_WRITTEN,

DUMP_CNT_NR_STATS,
};

Expand Down
7 changes: 7 additions & 0 deletions criu/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ void write_stats(int what)
ds_entry.shpages_written = dstats->counts[CNT_SHPAGES_WRITTEN];
ds_entry.has_shpages_written = true;

ds_entry.secmempages_scanned = dstats->counts[CNT_SECMEMPAGES_SCANNED];
ds_entry.has_secmempages_scanned = true;
ds_entry.secmempages_skipped_parent = dstats->counts[CNT_SECMEMPAGES_SKIPPED_PARENT];
ds_entry.has_secmempages_skipped_parent = true;
ds_entry.secmempages_written = dstats->counts[CNT_SECMEMPAGES_WRITTEN];
ds_entry.has_secmempages_written = true;

name = "dump";
} else if (what == RESTORE_STATS) {
stats.restore = &rs_entry;
Expand Down
4 changes: 4 additions & 0 deletions images/stats.proto
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ message dump_stats_entry {
optional uint64 shpages_scanned = 12;
optional uint64 shpages_skipped_parent = 13;
optional uint64 shpages_written = 14;

optional uint64 secmempages_scanned = 15;
optional uint64 secmempages_skipped_parent = 16;
optional uint64 secmempages_written = 17;
}

message restore_stats_entry {
Expand Down

0 comments on commit 4da5571

Please sign in to comment.