From: Tomas Hruby Date: Sun, 16 Oct 2011 22:05:40 +0000 (+0000) Subject: SMP - do_update fix X-Git-Tag: v3.2.0~134 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.host.html?a=commitdiff_plain;h=0468fca72b8a25d74c7c9780f1590577181ede74;p=minix.git SMP - do_update fix - adjust_proc_slot() must preserve scheduling info, for example on which cpu the process should run - do_update() - consitency check --- diff --git a/kernel/system/do_update.c b/kernel/system/do_update.c index 5cdd3cb5e..4833d4774 100644 --- a/kernel/system/do_update.c +++ b/kernel/system/do_update.c @@ -9,6 +9,7 @@ #include "kernel/system.h" #include "kernel/ipc.h" #include +#include #if USE_UPDATE @@ -64,6 +65,8 @@ PUBLIC int do_update(struct proc * caller, message * m_ptr) return EPERM; } + assert(!proc_is_runnable(src_rp) && !proc_is_runnable(dst_rp)); + /* Check if processes are updatable. */ if(!proc_is_updatable(src_rp) || !proc_is_updatable(dst_rp)) { return EBUSY; @@ -138,6 +141,14 @@ PRIVATE void adjust_proc_slot(struct proc *rp, struct proc *from_rp) rp->p_priv = from_rp->p_priv; priv(rp)->s_proc_nr = from_rp->p_nr; rp->p_caller_q = from_rp->p_caller_q; + + /* preserve scheduling */ + rp->p_scheduler = from_rp->p_scheduler; +#ifdef CONFIG_SMP + rp->p_cpu = from_rp->p_cpu; + memcpy(rp->p_cpu_mask, from_rp->p_cpu_mask, + sizeof(bitchunk_t) * BITMAP_CHUNKS(CONFIG_MAX_CPUS)); +#endif } /*===========================================================================*