On Thu, 19 Apr 2007 17:34:19 +0530
Gautham R Shenoy <ego@in.ibm.com> wrote:
hm.
flush_workqueue() just needs to die. I think there are (almost) no
legitimate users of it once cancel_work_sync() is merged.
Via wholly undescribed means :(
Rather than doing <whatever you did>, perhaps we could make the freezing
process a dual-pass thing. On pass 1, mark all the threads as "we'll be
freezing you soon" and on the second pass, do the actual freezing. Then,
in problematic places such as kthread_stop() we can look to see if we'll
soon be asked to freeze and if so, run try_to_freeze().
Of course, running try_to_freeze() in kthread_stop() would be very wrong,
so we'd actually need to do it in callers, preferably via a new
kthread_stop_freezeable() wrapper.
And the two-pass-freeze thing is of course racy. It's also unnecessary:
setting a flag on every task in the machine is equivalent to setting a
global variable. So perhaps just use a global variable?
int kthread_stop_freezeable(struct task_struct *k)
{
if (freeze_state == ABOUT_TO_START) {
wait_for(freeze_state == STARTED);
try_to_freeze();
}
kthread_stop(k);
}
which is theoretically racy if another freeze_processes() starts
immediately. Anyway - please have a think about it ;)
SPIN_LOCK_UNLOCKED is deprecated (it subverts lockdep)
I guess we should use set_current_state() here.
whitespace went wrong
hm, all this duplication is unpleasing. We could do something similar to
include/linux/buffer_head.h:BH_PrivateStart here: get all architectures to
define a TIF_COMMON_STUFF_STARTS_HERE then include asm-generic/whatever.h
which defines all the flags which every architecture must define, as
TIF_COMMON_STUFF_STARTS_HERE+0, TIF_COMMON_STUFF_STARTS_HERE+1, etc.
-