* Why should check "current" consistency?
@ 2010-03-08 2:21 real yr
0 siblings, 0 replies; only message in thread
From: real yr @ 2010-03-08 2:21 UTC (permalink / raw)
To: linux-kernel
The source code is listed as follows:
This code is inserted into do_fork() function
============================================
struct asmp_cpu_info *info;
......
restart:
if ((info = current->asmp->cpu)) {
dprintk("forking tsk=%p current=%p #tasks=%d\n", p, current,
info->num_tasks);
spin_lock_irqsave(&info->lock, flags);
/* MY PROBLEM */
if (info != current->asmp->cpu) {
spin_unlock_irqrestore(&info->lock, flags);
goto restart;
}
WARN_ON(info->shielded != 1);
WARN_ON(info->num_tasks == 0);
p->asmp->cpu = info;
list_add_tail(&p->asmp->list, &info->tasks);
++info->num_tasks;
spin_unlock_irqrestore(&info->lock, flags);
}
=========================================
Please see the code with comments "/* MY PROBLEM */", since info is a
local variable,
even if this code was preempted or interrupted, when the attached
process resumes its
state, it will continues from where it was interrupted and the
"current" macro shold be the same.
So, Why should check "if (info != current->asmp->cpu) {" ?
Thanks in advance!
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-03-08 2:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-08 2:21 Why should check "current" consistency? real yr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®