public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Nathan Lynch <nathanl@austin.ibm.com>
Cc: Andrew Morton <akpm@osdl.org>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Zwane Mwaikambo <zwane@linuxpower.ca>,
	Srivatsa Vaddagiri <vatsa@in.ibm.com>,
	Nick Piggin <piggin@cyberone.com.au>, Ingo Molnar <mingo@elte.hu>
Subject: Re: 2.6.8.1-mm1
Date: Tue, 17 Aug 2004 17:19:08 +1000	[thread overview]
Message-ID: <1092727147.27274.109.camel@bach> (raw)
In-Reply-To: <1092722342.3081.68.camel@booger>

On Tue, 2004-08-17 at 15:59, Nathan Lynch wrote:
> I can consistently hit this BUG_ON in migration_call's CPU_DEAD handling
> by doing:
> 
> while true ; do
> echo 0 > /sys/devices/system/cpu/cpu1/online
> echo 1 > /sys/devices/system/cpu/cpu1/online
> done
> 
> and then starting a kernel build.  It seems to take less than 20
> minutes.  I can also recreate it on ppc64, but only with
> CONFIG_PREEMPT=y (I haven't tried without preempt on i386 yet).

Hmm, can you figure out what patch in -mm breaks it?

Looking through 2.6.8.1-mm1, I see this code which doesn't make sense:


	if (likely(cpu == this_cpu)) {
...
	} else {
		runqueue_t *this_rq = cpu_rq(this_cpu);

		/*
		 * Not the local CPU - must adjust timestamp. This should
		 * get optimised away in the !CONFIG_SMP case.
		 */
		p->timestamp = (p->timestamp - this_rq->timestamp_last_tick)
					+ rq->timestamp_last_tick;
		__activate_task(p, rq);
		if (TASK_PREEMPTS_CURR(p, rq))
			resched_task(rq->curr);

		current->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(current) *
			PARENT_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS);
		schedstat_inc(rq, wunt_moved);
	}

	if (unlikely(cpu != this_cpu)) {
		task_rq_unlock(rq, &flags);
		rq = task_rq_lock(current, &flags);
	}
	current->sleep_avg = JIFFIES_TO_NS(CURRENT_BONUS(current) *
		PARENT_PENALTY / 100 * MAX_SLEEP_AVG / MAX_BONUS);
	task_rq_unlock(rq, &flags);
}

So, first off, the statements under "if (unlikely(cpu != this_cpu))" can
be folded into the previous block, since that's under the same test. 
Secondly, why is sleep_avg being set twice to the same thing, and why
are we happy to adjust it the first time without holding the rq lock for
current, but the second time we make sure we are holding the rq lock? 
recalc_task_prio seems happy to adjust a tasks ->sleep_avg without
holding any lock at all...

Rusty.
-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell


  reply	other threads:[~2004-08-17  7:20 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-16 21:37 2.6.8.1-mm1 Andrew Morton
2004-08-16 21:47 ` 2.6.8.1-mm1 Christoph Hellwig
2004-08-17 13:20   ` 2.6.8.1-mm1 Frediano Ziglio
2004-08-18 23:57   ` 2.6.8.1-mm1 Peter Osterlund
2004-08-19  9:45     ` 2.6.8.1-mm1 Christoph Hellwig
2004-08-20  5:44       ` 2.6.8.1-mm1 Peter Osterlund
2004-08-20  6:03         ` 2.6.8.1-mm1 Christoph Hellwig
2004-08-16 22:30 ` 2.6.8.1-mm1 Bartlomiej Zolnierkiewicz
2004-08-16 21:51   ` 2.6.8.1-mm1 Alan Cox
2004-08-16 23:25 ` 2.6.8.1-mm1 Arkadiusz Miskiewicz
2004-08-16 23:39 ` 2.6.8.1-mm1 Martin J. Bligh
2004-08-17  1:32   ` 2.6.8.1-mm1 Nathan Lynch
2004-08-17  6:59     ` 2.6.8.1-mm1 Sam Ravnborg
2004-08-17  6:25       ` 2.6.8.1-mm1 Martin J. Bligh
2004-08-17  6:38         ` 2.6.8.1-mm1 Andrew Morton
2004-08-17  7:00       ` 2.6.8.1-mm1 William Lee Irwin III
2004-08-17  7:05         ` 2.6.8.1-mm1 William Lee Irwin III
2004-08-17  3:07 ` 2.6.8.1-mm1 William Lee Irwin III
2004-08-17  3:09   ` 2.6.8.1-mm1 William Lee Irwin III
2004-08-17  3:19     ` 2.6.8.1-mm1 Andrew Morton
2004-08-17  3:41       ` 2.6.8.1-mm1 William Lee Irwin III
2004-08-17  4:16         ` 2.6.8.1-mm1 Nick Piggin
2004-08-17 14:38       ` 2.6.8.1-mm1 (compile stats) John Cherry
2004-08-17  5:59 ` 2.6.8.1-mm1 Nathan Lynch
2004-08-17  7:19   ` Rusty Russell [this message]
2004-08-17  8:45     ` [patch] new-task-fix.patch, 2.6.8.1-mm1 Ingo Molnar
2004-08-17 11:35       ` Nick Piggin
2004-08-17 11:38   ` 2.6.8.1-mm1 Srivatsa Vaddagiri
2004-08-17 17:53     ` 2.6.8.1-mm1 Andrew Morton
2004-08-18  1:04       ` 2.6.8.1-mm1 Rusty Russell
2004-08-18 17:36         ` 2.6.8.1-mm1 Nathan Lynch
2004-08-17  6:20 ` 2.6.8.1-mm1 William Lee Irwin III
2004-08-17  6:40   ` 2.6.8.1-mm1 sam
2004-08-17  7:05 ` 2.6.8.1-mm1 Nathan Lynch
2004-08-17 13:39   ` 2.6.8.1-mm1 Zwane Mwaikambo
2004-08-17 12:54 ` 2.6.8.1-mm1 William Lee Irwin III
2004-08-17 14:15   ` 2.6.8.1-mm1 William Lee Irwin III
2004-08-17 21:59 ` ldchk -> arch/arm/Makefile? [Was: 2.6.8.1-mm1] Sam Ravnborg

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=1092727147.27274.109.camel@bach \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nathanl@austin.ibm.com \
    --cc=piggin@cyberone.com.au \
    --cc=vatsa@in.ibm.com \
    --cc=zwane@linuxpower.ca \
    /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