[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YMMi1pG+FwyhZ9b7@hirez.programming.kicks-ass.net>
Date: Fri, 11 Jun 2021 10:46:14 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: rjw@...ysocki.net, Oleg Nesterov <oleg@...hat.com>,
mingo@...nel.org, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, mgorman@...e.de,
Will Deacon <will@...nel.org>
Cc: Tejun Heo <tj@...nel.org>, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH] freezer,sched: Rewrite core freezer logic
On Fri, Jun 11, 2021 at 10:45:00AM +0200, Peter Zijlstra wrote:
> @@ -52,41 +52,67 @@ bool freezing_slow_path(struct task_stru
> }
> EXPORT_SYMBOL(freezing_slow_path);
>
> +/* Recursion relies on tail-call optimization to not blow away the stack */
> +static bool __frozen(struct task_struct *p)
> +{
> + if (p->state == TASK_FROZEN)
> + return true;
> +
> + /*
> + * If stuck in TRACED, and the ptracer is FROZEN, we're frozen too.
> + */
> + if (task_is_traced(p))
> + return frozen(rcu_dereference(p->parent));
> +
> + /*
> + * If stuck in STOPPED and the parent is FROZEN, we're frozen too.
> + */
> + if (task_is_stopped(p))
> + return frozen(rcu_dereference(p->real_parent));
> +
> + return false;
> +}
> +
> +bool frozen(struct task_struct *p)
> +{
> + bool ret;
> +
> + rcu_read_lock();
> + ret = __frozen(p);
> + rcu_read_unlock();
> +
> + return ret;
> +}
Oleg, this bit in particular we'd like some feedback on, if possible.
Thanks!
Powered by blists - more mailing lists