Commit 1a72f37a authored by Mike Rapoport's avatar Mike Rapoport Committed by Andrei Vagin

criu: dump: get stack pointers of all threads early

The stack pointers will be later use by the memory dump to ensure that
current stack pages are not treated as lazy.
Signed-off-by: 's avatarMike Rapoport <rppt@linux.vnet.ibm.com>
parent af0f5f1f
...@@ -57,6 +57,7 @@ struct dmp_info { ...@@ -57,6 +57,7 @@ struct dmp_info {
struct page_pipe *mem_pp; struct page_pipe *mem_pp;
struct parasite_ctl *parasite_ctl; struct parasite_ctl *parasite_ctl;
struct parasite_thread_ctl **thread_ctls; struct parasite_thread_ctl **thread_ctls;
uint64_t *thread_sp;
}; };
static inline struct dmp_info *dmpi(const struct pstree_item *i) static inline struct dmp_info *dmpi(const struct pstree_item *i)
......
...@@ -468,24 +468,34 @@ static int parasite_prepare_threads(struct parasite_ctl *ctl, ...@@ -468,24 +468,34 @@ static int parasite_prepare_threads(struct parasite_ctl *ctl,
struct pstree_item *item) struct pstree_item *item)
{ {
struct parasite_thread_ctl **thread_ctls; struct parasite_thread_ctl **thread_ctls;
uint64_t *thread_sp;
int i; int i;
thread_ctls = xzalloc(sizeof(*thread_ctls) * item->nr_threads); thread_ctls = xzalloc(sizeof(*thread_ctls) * item->nr_threads);
if (!thread_ctls) if (!thread_ctls)
return -1; return -1;
thread_sp = xzalloc(sizeof(*thread_sp) * item->nr_threads);
if (!thread_sp)
return -1;
for (i = 0; i < item->nr_threads; i++) { for (i = 0; i < item->nr_threads; i++) {
struct pid *tid = &item->threads[i]; struct pid *tid = &item->threads[i];
if (item->pid->real == tid->real) if (item->pid->real == tid->real) {
thread_sp[i] = compel_get_leader_sp(ctl);
continue; continue;
}
thread_ctls[i] = compel_prepare_thread(ctl, tid->real); thread_ctls[i] = compel_prepare_thread(ctl, tid->real);
if (!thread_ctls[i]) if (!thread_ctls[i])
return -1; return -1;
thread_sp[i] = compel_get_thread_sp(thread_ctls[i]);
} }
dmpi(item)->thread_ctls = thread_ctls; dmpi(item)->thread_ctls = thread_ctls;
dmpi(item)->thread_sp = thread_sp;
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment