Skip to content
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

Use the PAGEMAP_SCAN ioctl when it is available #2292

Merged
merged 3 commits into from Jan 21, 2024

Conversation

avagin
Copy link
Member

@avagin avagin commented Oct 25, 2023

No description provided.

@avagin avagin marked this pull request as draft October 25, 2023 01:48
@avagin avagin force-pushed the pagemap-scan branch 5 times, most recently from 0b25e13 to 012e66f Compare October 25, 2023 06:33
@codecov-commenter
Copy link

codecov-commenter commented Oct 25, 2023

Codecov Report

Attention: 38 lines in your changes are missing coverage. Please review.

Comparison is base (8f4430d) 70.62% compared to head (0300efe) 70.57%.

❗ Current head 0300efe differs from pull request most recent head e11853f. Consider uploading reports for the commit e11853f to get more accurate results

Files Patch % Lines
criu/pagemap-cache.c 44.44% 20 Missing ⚠️
criu/kerndat.c 35.71% 9 Missing ⚠️
criu/mem.c 77.50% 9 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           criu-dev    #2292      +/-   ##
============================================
- Coverage     70.62%   70.57%   -0.05%     
============================================
  Files           133      132       -1     
  Lines         33556    33619      +63     
============================================
+ Hits          23698    23726      +28     
- Misses         9858     9893      +35     

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

criu/pagemap-cache.c Outdated Show resolved Hide resolved
@0x7f454c46
Copy link
Member

Hmm, at some moment all kernels we regularly run CRIU tests on will have this PAGEMAP_SCAN. I'm wondering if it is worth testing pre-ioctl code by artificially setting has_pagemap_scan = false? That will make sure that the fallback for older kernels won't get broken.
Not only related to this PR, but probably to other options in kerndat as well. Maybe a wild idea to add a command-line option like --kerndat-disable-pagemap-scan and to other kerndat features (rather than adding more fault-injects)?
Likely can be addressed in a separate CRIU issue/PR.

@adrianreber
Copy link
Member

I had similar thoughts around how to test this. But as it is still marked as draft I was still waiting if tests will be part of this PR.

I like the idea of explicitly selecting kerndat features. It does not make too much sense to expose all the options to the users as it might be confusing. But it probably could be helpful in some cases.

@Snorch
Copy link
Member

Snorch commented Nov 9, 2023

Maybe a wild idea to add a command-line option like --kerndat-disable-pagemap-scan and to other kerndat features (rather than adding more fault-injects)?

Would not it be cleaner to instead add an ability to read/write/edit kdat cache from crit tool? (Sounds like a simple task for GSOC students or any other newcomers.)

Likely can be addressed in a separate CRIU issue/PR.

+1

@0x7f454c46
Copy link
Member

Would not it be cleaner to instead add an ability to read/write/edit kdat cache from crit tool?

Agree, maybe another tool. Unsure about crit - then we would have to save kerndat in protobuf format and might do the same backward-compatibility as criu does. Hopefully, we can avoid keeping/maintaining compatibility as the intended use is testing-only.

@avagin avagin force-pushed the pagemap-scan branch 2 times, most recently from 93b941f to d2a8244 Compare November 30, 2023 00:08
@avagin
Copy link
Member Author

avagin commented Nov 30, 2023

Would not it be cleaner to instead add an ability to read/write/edit kdat cache from crit tool?

Usually, we use injectable faults in such cases. Look at the third patch.

criu/cr-check.c Outdated Show resolved Hide resolved
criu/include/pagemap_scan.h Outdated Show resolved Hide resolved
criu/include/pagemap_scan.h Outdated Show resolved Hide resolved
criu/include/pagemap_scan.h Outdated Show resolved Hide resolved
criu/mem.c Outdated Show resolved Hide resolved
criu/mem.c Outdated Show resolved Hide resolved
criu/mem.c Outdated Show resolved Hide resolved
criu/shmem.c Show resolved Hide resolved
@Snorch
Copy link
Member

Snorch commented Nov 30, 2023

Looks good.

I found this in kernel doc of PAGEMAP_SCAN ioctl:

he PAGE_IS_WRITTEN flag can be considered as a better-performing alternative
of soft-dirty flag. It doesn't get affected by VMA merging of the kernel and hence
the user can find the true soft-dirty pages in case of normal pages. (There may
still be extra dirty pages reported for THP or Hugetlb pages.)

Should we use PAGE_IS_WRITTEN instead of PAGE_IS_SOFT_DIRTY, as it is called "better-performing"?

Copy link

github-actions bot commented Jan 1, 2024

A friendly reminder that this PR had no activity for 30 days.

@avagin avagin added no-auto-close Don't auto-close as a stale issue and removed stale-pr labels Jan 2, 2024
@avagin
Copy link
Member Author

avagin commented Jan 2, 2024

Should we use PAGE_IS_WRITTEN instead of PAGE_IS_SOFT_DIRTY, as it is called "better-performing"?

It is not so simple. PAGE_IS_WRITTEN requires to register all regions in uffd-s and holds them between pre-dumps. It is a separate task.

PAGEMAP_SCAN is a new ioctl that allows to get page attributes in a more
effeciant way than reading pagemap files.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Andrei Vagin <avagin@gmail.com>
This change adds a new injectable fault (135) to disable PAGEMAP_SCAN and fault
back to read pagemap files.

Signed-off-by: Andrei Vagin <avagin@gmail.com>
@avagin avagin marked this pull request as ready for review January 21, 2024 07:45
@avagin avagin merged commit 50190ae into checkpoint-restore:criu-dev Jan 21, 2024
32 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-auto-close Don't auto-close as a stale issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants