Optimize sys_times for a single thread process
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 usethread_group_empty(current)?
Oleg.
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?
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_emptychecks 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.
Quoted 9 lines · Oleg Nesterov
Quoted 2 lines
The thread ist needs to contain only one element which is current.
thread_group_emptychecks 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
@@ -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. *