/* The freeze request is sent by setting the tasks's TIF_FREEZE flag and either sending a fake signal to it or waking it up, depending on whether or not it has PF_FREEZER_NOSIG set. If @sig_only is set and the task has PF_FREEZER_NOSIG set (ie. it is a typical kernel thread), its TIF_FREEZE flag will not be set.  */
bool freeze_task(struct task_struct *p, bool sig_only)
/* The freeze request is sent by setting the tasks's TIF_FREEZE flag and either sending a fake signal to it or waking it up, depending on whether or not it has PF_FREEZER_NOSIG set. If @sig_only is set and the task has PF_FREEZER_NOSIG set (ie. it is a typical kernel thread), its TIF_FREEZE flag will not be set.  */
bool freeze_task(struct task_struct *p, bool sig_only)
{
	if (!freezing(p)) {
		rmb();
		if (frozen(p))
			return false;
		if (!sig_only || should_send_signal(p))
			set_freeze_flag(p);
		else
			return false;
	}
	if (should_send_signal(p)) {
		if (!signal_pending(p))
			fake_signal_wake_up(p);
	} else if (sig_only) {
		return false;
	} else {
		wake_up_state(p, TASK_INTERRUPTIBLE);
	}
	return true;
}