public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kirill Tkhai <tkhai@yandex.ru>
To: Oleg Nesterov <oleg@redhat.com>, Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>,
	Mike Galbraith <umgwanakikbuti@gmail.com>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	Frank Mayhar <fmayhar@google.com>,
	Frederic Weisbecker <fweisbec@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Sanjay Rao <srao@redhat.com>, Larry Woodman <lwoodman@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] sched: tasklist_lock cleanups (Was: don't use while_each_thread())
Date: Mon, 18 Aug 2014 01:14:45 +0400	[thread overview]
Message-ID: <53F11B45.8070105@yandex.ru> (raw)
In-Reply-To: <20140817152549.GA17984@redhat.com>

On 17.08.2014 19:25, Oleg Nesterov wrote:
> On 08/13, Oleg Nesterov wrote:
>>
>> Peter, could you take these simple patches ?
>>
>> Better later than never... per-file, but please feel free to join
>> them in a single patch.
>>
>> read_lock_irq*(tasklist_lock) in kernel/sched/ files looks strange.
>> Why? I'll recheck, but this looks unneeded.
> 
> Yes, please consider these minor cleanups on top of for_each_thread
> conversions.
> 
> read_lock_irq(tasklist) in normalize_rt_tasks() doesn't really hurt,
> but it looks confusing. If we really have a reason to disable irqs
> this (subtle) reason should be documented.
> 
> And I can't understand tg_has_rt_tasks(). Don't we need something
> like the patch below? If not, please do not ask me why I think so,
> I don't understand this black magic ;) But the usage of the global
> "runqueues" array looks suspicious.

This function searches RT task which is related to this tg. It's
opaquely because it looks that there is an error.

task_rq(p)->rt.tg is a task group of a top rt_rq, while the task may
be queued on a child rt_rq instead of this. So, your patch is a BUGFIX,
not a cleanup.

> --- x/kernel/sched/core.c
> +++ x/kernel/sched/core.c
> @@ -7354,7 +7354,7 @@ static inline int tg_has_rt_tasks(struct
>  	struct task_struct *g, *p;
>  
>  	for_each_process_thread(g, p) {
> -		if (rt_task(p) && task_rq(p)->rt.tg == tg)
> +		if (rt_task(p) && task_group(p) == tg)
>  			return 1;
>  	}

  parent reply	other threads:[~2014-08-17 21:14 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 19:19 [PATCH 0/4] sched: don't use while_each_thread() Oleg Nesterov
2014-08-13 19:19 ` [PATCH 1/4] sched: s/do_each_thread/for_each_process_thread/ in core.c Oleg Nesterov
2014-08-20  8:18   ` [tip:sched/core] " tip-bot for Oleg Nesterov
2014-08-13 19:19 ` [PATCH 2/4] sched: s/do_each_thread/for_each_process_thread/ in debug.c Oleg Nesterov
2014-08-20  8:19   ` [tip:sched/core] " tip-bot for Oleg Nesterov
2014-08-13 19:20 ` [PATCH 3/4] sched: change thread_group_cputime() to use for_each_thread() Oleg Nesterov
2014-08-20  8:19   ` [tip:sched/core] sched: Change " tip-bot for Oleg Nesterov
2014-08-13 19:20 ` [PATCH 4/4] sched: change autogroup_move_group() " Oleg Nesterov
2014-08-20  8:19   ` [tip:sched/core] sched: Change " tip-bot for Oleg Nesterov
2014-08-13 19:23 ` [PATCH 0/4] sched: don't use while_each_thread() Peter Zijlstra
2014-08-17 15:25 ` [PATCH 0/2] sched: tasklist_lock cleanups (Was: don't use while_each_thread()) Oleg Nesterov
2014-08-17 15:26   ` [PATCH 1/2] sched: normalize_rt_tasks: don't use _irqsave for tasklist_lock, use task_rq_lock() Oleg Nesterov
2014-08-17 15:26   ` [PATCH 2/2] sched: print_rq: don't use tasklist_lock Oleg Nesterov
2014-08-17 21:14   ` Kirill Tkhai [this message]
2014-08-18 15:09     ` [PATCH 0/2] sched: tasklist_lock cleanups (Was: don't use while_each_thread()) Oleg Nesterov

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=53F11B45.8070105@yandex.ru \
    --to=tkhai@yandex.ru \
    --cc=akpm@linux-foundation.org \
    --cc=fmayhar@google.com \
    --cc=fweisbec@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lwoodman@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=srao@redhat.com \
    --cc=umgwanakikbuti@gmail.com \
    /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