]> git.baikalelectronics.ru Git - kernel.git/commit
parisc: Reduce code size by optimizing get_current() function calls
authorHelge Deller <deller@gmx.de>
Thu, 17 Feb 2022 12:12:39 +0000 (13:12 +0100)
committerHelge Deller <deller@gmx.de>
Fri, 11 Mar 2022 18:49:31 +0000 (19:49 +0100)
commit6055de8b76037cfda6121b6f5d72876db4c7ae35
tree84d0477851cb891e2e5b3f76a14e881192f96f66
parent7f8993b6dc201c828f1928388bf877d9d4b74567
parisc: Reduce code size by optimizing get_current() function calls

The get_current() code uses the mfctl() macro to get the pointer to the
current task struct from %cr30. The problem with the mfctl() macro is,
that it is marked volatile which is basically correct, because mfctl()
is used to get e.g. the current internal timer or interrupt flags as
well.

But specifically the task struct pointer (%cr30) doesn't change over
time when the kernel executes code for a task.

So, by dropping the volatile when retrieving %cr30 the compiler is now
able to get this value only once and optimize the generated code a lot.

A bloat-o-meter comparism shows that this patch saves ~5kB kernel code
on a 32-bit kernel and ~6kB kernel code on a 64-bit kernel.

Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/include/asm/current.h