Skip to contentSkip to conversation

Optimize sys_times for a single thread process

PATCH Oleg Nesterov 2 participants 4 messages May 18, 2005 – May 19, 2005

lore
Share & tools
lore
#0 lore raw

Review

Quoted 5 lines · Christoph Lameter
(quoted diff) +4 -0
+#ifdef CONFIG_SMP
+		if (current == next_thread(current)) {
+			/*
+			 * Single thread case without the use of any locks.

A nitpick, but wouldn't be it clearer to to use
thread_group_empty(current)?

Oleg.

#1 lore raw
Quoted 9 lines · Oleg Nesterov

Review

Quoted 5 lines · Christoph Lameter
(quoted diff) +4 -0
+#ifdef CONFIG_SMP
+		if (current == next_thread(current)) {
+			/*
+			 * Single thread case without the use of any locks.

A nitpick, but wouldn't be it clearer to to use
thread_group_empty(current)?

The thread ist needs to contain only one element which is current. thread_group_empty checks for no threads.

Do we need a new macro?

#2 lore raw
Quoted 13 lines · Christoph Lameter
Quoted 9 lines · Oleg Nesterov

Review

Quoted 5 lines · Christoph Lameter
(quoted diff) +4 -0
+#ifdef CONFIG_SMP
+		if (current == next_thread(current)) {
+			/*
+			 * Single thread case without the use of any locks.

A nitpick, but wouldn't be it clearer to to use
thread_group_empty(current)?

Quoted 2 lines

The thread ist needs to contain only one element which is current. thread_group_empty checks for no threads.

I think that thread_group_empty() means that there are no *other* threads in the thread group, that means that we have only one thread.

In any case (p == next_thread(p)) == thread_group_empty(p).

But it is a very minor issue indeed, let's forget it.

Oleg.

#3 lore raw
Quoted 9 lines · Oleg Nesterov
Quoted 2 lines

The thread ist needs to contain only one element which is current. thread_group_empty checks for no threads.

I think that thread_group_empty() means that there are no *other* threads in the thread group, that means that we have only one thread.

In any case (p == next_thread(p)) == thread_group_empty(p).

But it is a very minor issue indeed, let's forget it.

No no. If you are right then you are right and I am wrong.

kernel/sys.c +1 -1
Index: linux-2.6.12-rc4/kernel/sys.c
===================================================================
@@ -920,7 +920,7 @@
 		cputime_t utime, stime, cutime, cstime;
 
 #ifdef CONFIG_SMP
-		if (current == next_thread(current)) {
+		if (thread_group_empty(current)) {
 			/*
 			 * Single thread case without the use of any locks.
 			 *