LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Olof Johansson <olof@lixom.net>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] psi: simplify cgroup_move_task
Date: Mon, 5 Nov 2018 16:29:30 -0800
Message-ID: <20181105162930.c381c0c8550f0334817ca419@linux-foundation.org> (raw)
In-Reply-To: <20181103183339.8669-1-olof@lixom.net>

On Sat,  3 Nov 2018 11:33:39 -0700 Olof Johansson <olof@lixom.net> wrote:

> The existing code triggered an invalid warning about 'rq' possibly being
> used uninitialized. Instead of doing the silly warning suppression by
> initializa it to NULL, refactor the code to bail out early instead.
> 
> Warning was:
> 
> kernel/sched/psi.c: In function ‘cgroup_move_task’:
> kernel/sched/psi.c:639:13: warning: ‘rq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 
> --- a/kernel/sched/psi.c
> +++ b/kernel/sched/psi.c
> @@ -633,38 +633,39 @@ void psi_cgroup_free(struct cgroup *cgroup)
>   */
>  void cgroup_move_task(struct task_struct *task, struct css_set *to)
>  {
> -	bool move_psi = !psi_disabled;
>  	unsigned int task_flags = 0;
>  	struct rq_flags rf;
>  	struct rq *rq;
>  
> -	if (move_psi) {
> -		rq = task_rq_lock(task, &rf);
> +	if (psi_disabled) {
> +		/*
> +		 * Lame to do this here, but the scheduler cannot be locked
> +		 * from the outside, so we move cgroups from inside sched/.
> +		 */
> +		rcu_assign_pointer(task->cgroups, to);
> +		return;
> +	}

Fair enough.

Surprisingly this doesn't increase psi.o text size.


  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-03 18:33 Olof Johansson
2018-11-06  0:29 ` Andrew Morton [this message]
2018-11-06 16:55 ` Johannes Weiner

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=20181105162930.c381c0c8550f0334817ca419@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=olof@lixom.net \
    --cc=peterz@infradead.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git