public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@saeurebad.de>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org, Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 3/3] softlockup: fix watchdog task wakeup frequency
Date: Fri, 27 Jun 2008 15:07:21 +0200	[thread overview]
Message-ID: <87d4m3xbzq.fsf@skyscraper.fehenstaub.lan> (raw)
In-Reply-To: <20080627124329.GA14576@elte.hu> (Ingo Molnar's message of "Fri, 27 Jun 2008 14:43:29 +0200")

Hi,

Ingo Molnar <mingo@elte.hu> writes:

> * Johannes Weiner <hannes@saeurebad.de> wrote:
>
>> Hm, it updates the timestamp, so it makes only sense if it runs at a 
>> maximum every second (timestamp granularity) or even less.  The check 
>> for hung tasks uses the cpu timestamp as well for comparison, so that 
>> would be okay too.
>> 
>> Like this?
>> 
>> diff --git a/kernel/softlockup.c b/kernel/softlockup.c
>> index c828c23..b884546 100644
>> --- a/kernel/softlockup.c
>> +++ b/kernel/softlockup.c
>> @@ -106,8 +106,9 @@ void softlockup_tick(void)
>>  
>>  	now = get_timestamp(this_cpu);
>>  
>> -	/* Wake up the high-prio watchdog task every second: */
>> -	if (now > (touch_timestamp + 1))
>> +	/* Wake up the high-prio watchdog task twice per
>> +	 * threshold timespan. */
>> +	if (now > (touch_timestamp + softlockup_thresh / 2))
>>  		wake_up_process(per_cpu(watchdog_task, this_cpu));
>
> yeah - but please use the best possible coding style. Two-line comments 
> should be in the:
>
>   /*
>    * Here we ......................
>    * ........................ come:
>    */
>
> ... format.

Alright, that looks much better.


> And the arithmetics should be:
>
> 	if (now > touch_timestamp + softlockup_thresh/2)
>
> (the unnecessary paranthesis was a small style mistake in the original 
> too)

I tried to fit it into the rest of the code but also prefer the one
without parens.

Thanks for the suggestions, update appended.

	Hannes

---
From: Johannes Weiner <hannes@saeurebad.de>
Subject: [PATCH 3/3] softlockup: wake up watchdog twice per threshold timespan

Updating the timestamp more often is pointless as we print the warnings
only if we exceed the threshold.  And the check for hung tasks relies on
the last timestamp, so it will keep working correctly, too.

Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
---
 kernel/softlockup.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

--- a/kernel/softlockup.c
+++ b/kernel/softlockup.c
@@ -107,8 +107,11 @@ void softlockup_tick(void)
 
 	now = get_timestamp(this_cpu);
 
-	/* Wake up the high-prio watchdog task every second: */
-	if (now > (touch_timestamp + 1))
+	/*
+	 * Wake up the high-prio watchdog task twice per
+	 * threshold timespan.
+	 */
+	if (now > touch_timestamp + softlockup_thresh/2)
 		wake_up_process(per_cpu(watchdog_task, this_cpu));
 
 	/* Warn about unreasonable delays: */

  reply	other threads:[~2008-06-27 13:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-27  0:04 [PATCH 0/3] softlockup fixlets Johannes Weiner
2008-06-27  0:04 ` [PATCH 1/3] softlockup: only reset timestamp from NMI code Johannes Weiner
2008-06-27  0:04 ` [PATCH 2/3] softlockup: sanitize print-out limit checks Johannes Weiner
2008-06-27  0:04 ` [PATCH 3/3] softlockup: fix watchdog task wakeup frequency Johannes Weiner
2008-06-27 12:03   ` Ingo Molnar
2008-06-27 12:33     ` Johannes Weiner
2008-06-27 12:43       ` Ingo Molnar
2008-06-27 13:07         ` Johannes Weiner [this message]
2008-06-28  0:45           ` Johannes Weiner
2008-06-30 13:08             ` Ingo Molnar
2008-07-01  5:40               ` Johannes Weiner
2008-07-01  6:11                 ` Ingo Molnar
2008-07-01  7:12                   ` Johannes Weiner
2008-07-01  7:22                     ` 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=87d4m3xbzq.fsf@skyscraper.fehenstaub.lan \
    --to=hannes@saeurebad.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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