Skip to contentSkip to conversation

ring-buffer benchmark: Run producer/consumer threads at nice +19

tip:tracing/core tip-bot for Ingo Molnar 2 participants 7 messages Nov 23, 2009 – Nov 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Commit-ID:  98e4833ba3c314c99dc364012fba6ac894230ad0
Gitweb:     http://git.kernel.org/tip/98e4833ba3c314c99dc364012fba6ac894230ad0
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 23 Nov 2009 08:03:09 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 23 Nov 2009 08:03:09 +0100

ring-buffer benchmark: Run producer/consumer threads at nice +19

The ring-buffer benchmark threads run on nice 0 by default, using up a lot of CPU time and slowing down the system:

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  1024 root      20   0     0    0    0 D 95.3  0.0   4:01.67 rb_producer
  1023 root      20   0     0    0    0 R 93.5  0.0   2:54.33 rb_consumer
 21569 mingo     40   0 14852 1048  772 R  3.6  0.1   0:00.05 top
     1 root      40   0  4080  928  668 S  0.0  0.0   0:23.98 init

Renice them to +19 to make them less intrusive.

Cc: Steven Rostedt <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Mike Galbraith <[email protected]>
LKML-Reference: <new-submission>

---
 kernel/trace/ring_buffer_benchmark.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
kernel/trace/ring_buffer_benchmark.c +6 -0
index 70df73e..3875d49 100644
@@ -399,6 +399,12 @@ static int __init ring_buffer_benchmark_init(void)
 	if (IS_ERR(producer))
 		goto out_kill;
 
+	/*
+	 * Run them as low-prio background tasks by default:
+	 */
+	set_user_nice(consumer, 19);
+	set_user_nice(producer, 19);
+
 	return 0;
 
  out_kill:
maintainer
#1 lore raw
Quoted 12 lines · tip-bot for Ingo Molnar
Commit-ID:  98e4833ba3c314c99dc364012fba6ac894230ad0
Gitweb:     http://git.kernel.org/tip/98e4833ba3c314c99dc364012fba6ac894230ad0
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 23 Nov 2009 08:03:09 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 23 Nov 2009 08:03:09 +0100

ring-buffer benchmark: Run producer/consumer threads at nice +19

The ring-buffer benchmark threads run on nice 0 by default, using up a lot of CPU time and slowing down the system:

Quoted 7 lines
   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  1024 root      20   0     0    0    0 D 95.3  0.0   4:01.67 rb_producer
  1023 root      20   0     0    0    0 R 93.5  0.0   2:54.33 rb_consumer
 21569 mingo     40   0 14852 1048  772 R  3.6  0.1   0:00.05 top
     1 root      40   0  4080  928  668 S  0.0  0.0   0:23.98 init

Renice them to +19 to make them less intrusive.

Ingo, that is the point of a benchmark!

This module is not made to be run all the time. I know you do it for testing. But running it at lowest priority kills the reason this module was made in the first place!

-- Steve

maintainer
#2 lore raw
Quoted 7 lines · Steven Rostedt
Quoted 1 line

Renice them to +19 to make them less intrusive.

Ingo, that is the point of a benchmark!

This module is not made to be run all the time. I know you do it for testing. But running it at lowest priority kills the reason this module was made in the first place!

Note, I first wrote this where the threads ran at SCHED_FIFO (but never published it that way). I was afraid if something went wrong, it would lock up the system. But still, it is a benchmark module. It is for developers and analyzers only. Not for common users.

-- Steve

#3 lore raw
In reply to Steven Rostedt
Quoted 19 lines · Steven Rostedt
Quoted 18 lines · tip-bot for Ingo Molnar
Commit-ID:  98e4833ba3c314c99dc364012fba6ac894230ad0
Gitweb:     http://git.kernel.org/tip/98e4833ba3c314c99dc364012fba6ac894230ad0
Author:     Ingo Molnar <[email protected]>
AuthorDate: Mon, 23 Nov 2009 08:03:09 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 23 Nov 2009 08:03:09 +0100

ring-buffer benchmark: Run producer/consumer threads at nice +19

The ring-buffer benchmark threads run on nice 0 by default, using up a lot of CPU time and slowing down the system:

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  1024 root      20   0     0    0    0 D 95.3  0.0   4:01.67 rb_producer
  1023 root      20   0     0    0    0 R 93.5  0.0   2:54.33 rb_consumer
 21569 mingo     40   0 14852 1048  772 R  3.6  0.1   0:00.05 top
     1 root      40   0  4080  928  668 S  0.0  0.0   0:23.98 init
Quoted 7 lines
Quoted 1 line

Renice them to +19 to make them less intrusive.

Ingo, that is the point of a benchmark!

This module is not made to be run all the time. I know you do it for testing. But running it at lowest priority kills the reason this module was made in the first place!

Well, it also found quite a few bugs in the ring-buffer code, beyond benchmarking so i'd like to use it even without looking at the numbers.

Ingo

maintainer
#4 lore raw
Quoted 6 lines · Ingo Molnar
Quoted 3 lines

This module is not made to be run all the time. I know you do it for testing. But running it at lowest priority kills the reason this module was made in the first place!

Well, it also found quite a few bugs in the ring-buffer code, beyond benchmarking so i'd like to use it even without looking at the numbers.

OK, then lets make a module option (and command line) that will allow the setting of the priority of the threads. Either nice or even fifo (use at your own risk ;-)

I can write something up for that.

-- Steve

#5 lore raw
Quoted 6 lines · Steven Rostedt
Quoted 4 lines · Ingo Molnar
Quoted 3 lines

This module is not made to be run all the time. I know you do it for testing. But running it at lowest priority kills the reason this module was made in the first place!

Quoted 7 lines
Quoted 3 lines

Well, it also found quite a few bugs in the ring-buffer code, beyond benchmarking so i'd like to use it even without looking at the numbers.

OK, then lets make a module option (and command line) that will allow the setting of the priority of the threads. Either nice or even fifo (use at your own risk ;-)

Yeah, that's fine to me - as long as the default is unintrusive. (i.e. like the rcutorture threads, which run at nice +19 too - and kmemcheck which runs at +19 as well.)

We still have the perl overhead in function-tracing kernel builds btw :-/

Ingo

maintainer
#6 lore raw
Quoted 4 lines · Ingo Molnar

* Steven Rostedt <[email protected]> wrote:

We still have the perl overhead in function-tracing kernel builds btw :-/

Yes I know. Someone did send me a patch to start the conversion to C, but it needs to be audited quite thoroughly.

-- Steve