mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: rjw@rjwysocki.net, Oleg Nesterov <oleg@redhat.com>,
	mingo@kernel.org, vincent.guittot@linaro.org,
	dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de,
	Will Deacon <will@kernel.org>
Cc: Tejun Heo <tj@kernel.org>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH] freezer,sched: Rewrite core freezer logic
Date: Fri, 11 Jun 2021 10:46:14 +0200	[thread overview]
Message-ID: <YMMi1pG+FwyhZ9b7@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YMMijNqaLDbS3sIv@hirez.programming.kicks-ass.net>

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!

  reply	other threads:[~2021-06-11  8:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-11  8:45 Peter Zijlstra
2021-06-11  8:46 ` Peter Zijlstra [this message]
2021-06-11 13:58 ` Rafael J. Wysocki
2021-06-14 15:42 ` Oleg Nesterov
2021-06-14 16:12   ` Peter Zijlstra
2021-06-14 16:54     ` Oleg Nesterov
2021-06-14 18:38       ` Peter Zijlstra
2021-06-15 15:45         ` Oleg Nesterov
2021-06-15 21:35           ` Peter Zijlstra
2021-06-15 21:50           ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YMMi1pG+FwyhZ9b7@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=rostedt@goodmis.org \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®