mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 00:05:26 +00:00
Restore THP_DISABLE prctl.
The original commit added saving THP_DISABLED flag value, but missed
restoring it. There is restoring code, but used only when --lazy_pages
mode is enabled. Restore the prctl flag always. While at it, rename the
`has_thp_enabled` -> `!thp_disabled` for consistency.
Fixes: bbbd597b41
(2017-06-28 "mem: add dump state of THP_DISABLED prctl")
Signed-off-by: Michał Mirosław <emmir@google.com>
This commit is contained in:
committed by
Andrei Vagin
parent
9943dcde17
commit
21ce76263b
@@ -2971,7 +2971,7 @@ static int prepare_mm(pid_t pid, struct task_restore_args *args)
|
|||||||
|
|
||||||
args->fd_exe_link = exe_fd;
|
args->fd_exe_link = exe_fd;
|
||||||
|
|
||||||
args->has_thp_enabled = rsti(current)->has_thp_enabled;
|
args->thp_disabled = mm->has_thp_disabled && mm->thp_disabled;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
out:
|
out:
|
||||||
|
@@ -144,7 +144,7 @@ struct task_restore_args {
|
|||||||
struct timeval logstart;
|
struct timeval logstart;
|
||||||
|
|
||||||
int uffd;
|
int uffd;
|
||||||
bool has_thp_enabled;
|
bool thp_disabled;
|
||||||
|
|
||||||
/* threads restoration */
|
/* threads restoration */
|
||||||
int nr_threads; /* number of threads */
|
int nr_threads; /* number of threads */
|
||||||
|
@@ -73,8 +73,6 @@ struct rst_info {
|
|||||||
*/
|
*/
|
||||||
bool has_old_seccomp_filter;
|
bool has_old_seccomp_filter;
|
||||||
|
|
||||||
bool has_thp_enabled;
|
|
||||||
|
|
||||||
struct rst_rseq *rseqe;
|
struct rst_rseq *rseqe;
|
||||||
|
|
||||||
void *breakpoint;
|
void *breakpoint;
|
||||||
|
@@ -1217,8 +1217,6 @@ err_addr:
|
|||||||
|
|
||||||
static int maybe_disable_thp(struct pstree_item *t, struct page_read *pr)
|
static int maybe_disable_thp(struct pstree_item *t, struct page_read *pr)
|
||||||
{
|
{
|
||||||
MmEntry *mm = rsti(t)->mm;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* There is no need to disable it if the page read doesn't
|
* There is no need to disable it if the page read doesn't
|
||||||
* have parent. In this case VMA will be empty until
|
* have parent. In this case VMA will be empty until
|
||||||
@@ -1241,8 +1239,6 @@ static int maybe_disable_thp(struct pstree_item *t, struct page_read *pr)
|
|||||||
pr_perror("Cannot disable THP");
|
pr_perror("Cannot disable THP");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!(mm->has_thp_disabled && mm->thp_disabled))
|
|
||||||
rsti(t)->has_thp_enabled = true;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -1635,17 +1635,13 @@ long __export_restore_task(struct task_restore_args *args)
|
|||||||
goto core_restore_end;
|
goto core_restore_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->uffd > -1) {
|
ret = sys_prctl(PR_SET_THP_DISABLE, args->thp_disabled, 0, 0, 0);
|
||||||
/* re-enable THP if we disabled it previously */
|
|
||||||
if (args->has_thp_enabled) {
|
|
||||||
int ret;
|
|
||||||
ret = sys_prctl(PR_SET_THP_DISABLE, 0, 0, 0, 0);
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_err("Cannot re-enable THP: %d\n", ret);
|
pr_err("Cannot restore THP_DISABLE=%d flag: %ld\n", args->thp_disabled, ret);
|
||||||
goto core_restore_end;
|
goto core_restore_end;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
if (args->uffd > -1) {
|
||||||
pr_debug("lazy-pages: closing uffd %d\n", args->uffd);
|
pr_debug("lazy-pages: closing uffd %d\n", args->uffd);
|
||||||
/*
|
/*
|
||||||
* All userfaultfd configuration has finished at this point.
|
* All userfaultfd configuration has finished at this point.
|
||||||
|
Reference in New Issue
Block a user