I agree. Only "current" can set PF_FROZEN anyway. I also think it is better
to move this function into kernel/power/process.c, no need to export it in
freezer.h. It is special, should be called from refrigerator() with task_lock()
held.
On the second thought, this patch doesn't help if the thread never
calls try_to_freeze() exactly because it marks itself PF_NOFREEZE.
Perhaps it is better to cancel freezing in soon-to-be-introduced
freezer_exempt().
In any case I agree, this one is better than current
fix_pf_nofreeze_and_freezeable_race.patch
Oleg.
-