Skip to contentSkip to conversation

ring-buffer: Some minor fixes

PATCH New Steven Rostedt 1 participant 4 messages Jun 11, 2015

Subsystems (3)
lore
Share & tools
lore

Steven Rostedt

author maintainer
#0 lore raw

cover ring-buffer: Some minor fixes

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: 1240db6538c008ede745895272ddfe95efab0425

Wang Long (3):
ring-buffer-benchmark: Fix the wrong param in module_param
ring-buffer-benchmark: Fix the wrong type
ring-buffer-benchmark: Fix the wrong sched_priority of producer

----

 kernel/trace/ring_buffer_benchmark.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
author maintainer
#1 lore raw

PATCH 1/3 ring-buffer-benchmark: Fix the wrong param in module_param

From: Wang Long <[email protected]>

The {producer|consumer}_{nice|fifo} parameters are integer type, we should use 'int' as the second param in module_param.

For example(consumer_fifo):
the default value of consumer_fifo is -1.
Without this patch:

        # cat /sys/module/ring_buffer_benchmark/parameters/consumer_fifo
        4294967295
   With this patch:
	# cat /sys/module/ring_buffer_benchmark/parameters/consumer_fifo
	-1
---
 kernel/trace/ring_buffer_benchmark.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/trace/ring_buffer_benchmark.c +4 -4
index 13d945c0d03f..cdff7d3df902 100644
@@ -46,16 +46,16 @@ static int consumer_nice = MAX_NICE;
 static int producer_fifo = -1;
 static int consumer_fifo = -1;
 
-module_param(producer_nice, uint, 0644);
+module_param(producer_nice, int, 0644);
 MODULE_PARM_DESC(producer_nice, "nice prio for producer");
 
-module_param(consumer_nice, uint, 0644);
+module_param(consumer_nice, int, 0644);
 MODULE_PARM_DESC(consumer_nice, "nice prio for consumer");
 
-module_param(producer_fifo, uint, 0644);
+module_param(producer_fifo, int, 0644);
 MODULE_PARM_DESC(producer_fifo, "fifo prio for producer");
 
-module_param(consumer_fifo, uint, 0644);
+module_param(consumer_fifo, int, 0644);
 MODULE_PARM_DESC(consumer_fifo, "fifo prio for consumer");
 
 static int read_events;
Signature · 1 line
2.1.4
author maintainer
#2 lore raw

PATCH 2/3 ring-buffer-benchmark: Fix the wrong type

In reply to Steven Rostedt

From: Wang Long <[email protected]>

The macro 'module_param' shows that the type of the variable disable_reader and write_iteration is unsigned integer. so, we change their type form int to unsigned int.

---
 kernel/trace/ring_buffer_benchmark.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ring_buffer_benchmark.c +2 -2
index cdff7d3df902..2430563cf2bc 100644
@@ -32,11 +32,11 @@ static struct task_struct *producer;
 static struct task_struct *consumer;
 static unsigned long read;
 
-static int disable_reader;
+static unsigned int disable_reader;
 module_param(disable_reader, uint, 0644);
 MODULE_PARM_DESC(disable_reader, "only run producer");
 
-static int write_iteration = 50;
+static unsigned int write_iteration = 50;
 module_param(write_iteration, uint, 0644);
 MODULE_PARM_DESC(write_iteration, "# of writes between timestamp readings");
 
Signature · 1 line
2.1.4
author maintainer
#3 lore raw

PATCH 3/3 ring-buffer-benchmark: Fix the wrong sched_priority of producer

In reply to Steven Rostedt

From: Wang Long <[email protected]>

The producer should be used producer_fifo as its sched_priority, so correct it.

---
 kernel/trace/ring_buffer_benchmark.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/ring_buffer_benchmark.c +1 -1
index 2430563cf2bc..61b933bfd2b8 100644
@@ -450,7 +450,7 @@ static int __init ring_buffer_benchmark_init(void)
 
 	if (producer_fifo >= 0) {
 		struct sched_param param = {
-			.sched_priority = consumer_fifo
+			.sched_priority = producer_fifo
 		};
 		sched_setscheduler(producer, SCHED_FIFO, &param);
 	} else
Signature · 1 line
2.1.4