All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Andrew Morton <akpm@osdl.org>, Con Kolivas <kernel@kolivas.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Instrumenting high latency
Date: Mon, 12 Jul 2004 07:32:34 -0700	[thread overview]
Message-ID: <20040712143234.GD21066@holomorphy.com> (raw)
In-Reply-To: <20040712113114.GA21066@holomorphy.com>

On Mon, Jul 12, 2004 at 04:31:14AM -0700, William Lee Irwin III wrote:
> Some cleanups and fixing a minor oversight in touch_preempt_timing(),
> which was that in principle things can break out of preempt_count() > 1
> after checking need_resched(). Cleaner, smaller, yes. How crippled it
> just got with the various potentially false negatives introduced by
> using need_resched() as a hook for touch_preempt_timing() is unclear.

Something's gone wrong with using need_resched() as a hook for that.
The following, incremental atop the cleaned up patch, backs that out
and restores the apparent accuracy of reporting, though there isn't
any rigorous correlation of this with other scheduling latency stuff
(it should report lower worst-case latencies since it's measuring what
are tighter sections of code and ignores waiting time on runqueues).

vs. 2.6.7 (and the prior patch too). I'll probably repost a full patch
vs. -mm7 (or whatever's current when I do) in a dedicated thread.


-- wli

Index: timing-2.6.7/include/linux/sched.h
===================================================================
--- timing-2.6.7.orig/include/linux/sched.h	2004-07-12 01:45:08.000000000 -0700
+++ timing-2.6.7/include/linux/sched.h	2004-07-12 05:28:50.000000000 -0700
@@ -1000,8 +1000,7 @@
 	return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
 }
   
-#define need_resched()	({ touch_preempt_timing(); __need_resched(); })
-static inline int __need_resched(void)
+static inline int need_resched(void)
 {
 	return unlikely(test_thread_flag(TIF_NEED_RESCHED));
 }
@@ -1009,6 +1008,7 @@
 extern void __cond_resched(void);
 static inline void cond_resched(void)
 {
+	touch_preempt_timing();
 	if (need_resched())
 		__cond_resched();
 }
Index: timing-2.6.7/kernel/printk.c
===================================================================
--- timing-2.6.7.orig/kernel/printk.c	2004-06-15 22:20:26.000000000 -0700
+++ timing-2.6.7/kernel/printk.c	2004-07-12 05:30:14.000000000 -0700
@@ -650,10 +650,8 @@
  */
 void console_conditional_schedule(void)
 {
-	if (console_may_schedule && need_resched()) {
-		set_current_state(TASK_RUNNING);
-		schedule();
-	}
+	if (console_may_schedule)
+		cond_resched();
 }
 EXPORT_SYMBOL(console_conditional_schedule);
 
Index: timing-2.6.7/mm/memory.c
===================================================================
--- timing-2.6.7.orig/mm/memory.c	2004-06-15 22:19:22.000000000 -0700
+++ timing-2.6.7/mm/memory.c	2004-07-12 05:33:17.000000000 -0700
@@ -558,14 +558,17 @@
 			zap_bytes -= block;
 			if ((long)zap_bytes > 0)
 				continue;
-			if (!atomic && need_resched()) {
+			zap_bytes = ZAP_BLOCK_SIZE;
+			if (!atomic)
+				continue;
+			touch_preempt_timing();
+			if (need_resched()) {
 				int fullmm = tlb_is_full_mm(*tlbp);
 				tlb_finish_mmu(*tlbp, tlb_start, start);
 				cond_resched_lock(&mm->page_table_lock);
 				*tlbp = tlb_gather_mmu(mm, fullmm);
 				tlb_start_valid = 0;
 			}
-			zap_bytes = ZAP_BLOCK_SIZE;
 		}
 	}
 	return ret;

  reply	other threads:[~2004-07-12 14:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-12  6:29 [PATCH] Instrumenting high latency Con Kolivas
2004-07-12  6:37 ` Andrew Morton
2004-07-12  6:43   ` Con Kolivas
2004-07-12  6:58     ` Andrew Morton
2004-07-12  7:00   ` [PATCH] " William Lee Irwin III
2004-07-12  7:34 ` Andrew Morton
2004-07-12  8:02   ` William Lee Irwin III
2004-07-12  8:38     ` William Lee Irwin III
2004-07-12 11:31       ` William Lee Irwin III
2004-07-12 14:32         ` William Lee Irwin III [this message]
2004-07-12 17:09         ` Martin Josefsson
2004-07-12  8:29   ` Arjan van de Ven
2004-07-12  8:42     ` William Lee Irwin III
2004-07-12  8:47       ` William Lee Irwin III
2004-07-12 10:41 ` Rajput
2004-07-12 10:44   ` William Lee Irwin III
2004-07-12 14:24 ` Martin J. Bligh
2004-07-12 14:27   ` Con Kolivas
2004-07-12 14:33     ` Martin J. Bligh
2004-07-12 14:42       ` Con Kolivas
2004-07-12 14:47         ` Martin J. Bligh

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=20040712143234.GD21066@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.