From: Oleg Nesterov <oleg@tv-sign.ru>
To: Ingo Molnar <mingo@elte.hu>
Cc: Frank Mayhar <fmayhar@google.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Roland McGrath <roland@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Alexey Dobriyan <adobriyan@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2.6.27-rc5 re-resubmit] Fix itimer/many thread hang.
Date: Tue, 23 Sep 2008 17:59:17 +0400 [thread overview]
Message-ID: <20080923135917.GA285@tv-sign.ru> (raw)
In-Reply-To: <20080923114033.GB14840@elte.hu>
On 09/23, Ingo Molnar wrote:
>
> below is the delta patch i've applied to tip/timers/posixtimers - might
> be easier to review for those who've seen v1 and who'd like to check the
> changes.
> ...
>
> +unsigned long long task_delta_exec(struct task_struct *p)
> {
> + struct rq *rq;
> + unsigned long flags;
> + u64 ns = 0;
> +
> + rq = task_rq_lock(p, &flags);
> if (task_current(rq, p)) {
> u64 delta_exec;
>
> update_rq_clock(rq);
> delta_exec = rq->clock - p->se.exec_start;
> if ((s64)delta_exec > 0)
> - return delta_exec;
> + ns = delta_exec;
> }
> - return 0;
> -}
> -
> -/*
> - * Return p->sum_exec_runtime plus any more ns on the sched_clock
> - * that have not yet been banked in case the task is currently running.
> - */
> -unsigned long long task_sched_runtime(struct task_struct *p)
> -{
> - unsigned long flags;
> - u64 ns;
> - struct rq *rq;
> -
> - rq = task_rq_lock(p, &flags);
> - ns = p->se.sum_exec_runtime + task_delta_exec(p, rq);
> - task_rq_unlock(rq, &flags);
> -
> - return ns;
> -}
> -
> -/*
> - * Return sum_exec_runtime for the thread group plus any more ns on the
> - * sched_clock that have not yet been banked in case the task is currently
> - * running.
> - */
> -unsigned long long thread_group_sched_runtime(struct task_struct *p)
> -{
> - unsigned long flags;
> - u64 ns;
> - struct rq *rq;
> - struct task_cputime totals;
> -
> - rq = task_rq_lock(p, &flags);
> - thread_group_cputime(p, &totals);
> - ns = totals.sum_exec_runtime + task_delta_exec(p, rq);
> - task_rq_unlock(rq, &flags);
>
> return ns;
Looks like task_delta_exec() forgets to unlock rq.
> +static inline void thread_group_cputime_account_exec_runtime(
> + struct thread_group_cputime *tgtimes,
> + unsigned long long ns)
> +{
> + if (tgtimes->totals) {
> + struct task_cputime *times;
> +
> + times = per_cpu_ptr(tgtimes->totals, get_cpu());
> + times->sum_exec_runtime += ns;
> + put_cpu_no_resched();
> + }
> +}
> +
> +#else /* CONFIG_SMP */
> +
> +static inline void thread_group_cputime_account_user(
> + struct thread_group_cputime *tgtimes,
> + cputime_t cputime)
> +{
> + tgtimes->totals->utime = cputime_add(tgtimes->totals->utime, cputime);
> +}
Confused. Unless I misread the patch, tgtimes->totals can be NULL
on UP too?
Do we really need the special version for !CONFIG_SMP ? per_cpu_ptr()
just returns the pointer. Yes, get_cpu() disables preemption, but
perhaps this is tolerable?
(of course, this can't explain the crash)
Oleg.
next prev parent reply other threads:[~2008-09-23 14:01 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-12 16:54 [PATCH 2.6.27-rc5 resubmit] Fix itimer/many thread hang Frank Mayhar
2008-09-12 20:27 ` Andrew Morton
2008-09-14 15:06 ` Ingo Molnar
2008-09-14 15:07 ` [PATCH] timers: fix itimer/many thread hang, fix Ingo Molnar
2008-09-14 15:09 ` [PATCH 2.6.27-rc5 resubmit] Fix itimer/many thread hang Ingo Molnar
2008-09-15 18:09 ` Frank Mayhar
2008-09-16 8:41 ` Ingo Molnar
2008-09-17 19:03 ` Frank Mayhar
2008-09-17 19:13 ` Roland McGrath
2008-09-17 20:12 ` Frank Mayhar
2008-09-18 10:23 ` Ingo Molnar
2008-09-18 13:50 ` Frank Mayhar
2008-09-22 20:22 ` [PATCH 2.6.27-rc5 re-resubmit] " Frank Mayhar
2008-09-23 11:40 ` Ingo Molnar
2008-09-23 12:52 ` [boot crash] " Ingo Molnar
2008-09-23 13:59 ` Oleg Nesterov [this message]
2008-09-23 16:09 ` Frank Mayhar
2008-09-23 22:56 ` Frank Mayhar
2008-09-24 21:23 ` [PATCH 2.6.27-rc5 incremental " Frank Mayhar
2008-09-27 18:08 ` Ingo Molnar
2008-09-30 6:33 ` Ingo Molnar
2008-09-30 16:36 ` Frank Mayhar
2008-10-01 16:20 ` Frank Mayhar
2008-10-02 9:43 ` Ingo Molnar
2008-09-14 15:12 ` [PATCH 2.6.27-rc5 resubmit] " Ingo Molnar
2008-09-14 15:14 ` Ingo Molnar
2008-09-14 19:31 ` Roland McGrath
2008-09-15 6:41 ` Ingo Molnar
2008-09-15 17:59 ` Frank Mayhar
2008-09-16 8:39 ` Ingo Molnar
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=20080923135917.GA285@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=fmayhar@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=tglx@linutronix.de \
/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