]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
powerpc/time: Only set CONFIG_ARCH_HAS_SCALED_CPUTIME on PPC64
authorChristophe Leroy <christophe.leroy@c-s.fr>
Thu, 2 Aug 2018 07:53:59 +0000 (07:53 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 20 Oct 2018 02:26:47 +0000 (13:26 +1100)
commitabcff86df2d2ec0a0ca9470fa5d2a184af18928a
tree75fa912a58d6371828a653a393d7b766d0d4649b
parentb38a181c11d0b5e84b40732dbb06cc9d68140d60
powerpc/time: Only set CONFIG_ARCH_HAS_SCALED_CPUTIME on PPC64

scaled cputime is only meaningfull when the processor has
SPURR and/or PURR, which means only on PPC64.

Removing it on PPC32 significantly reduces the size of
vtime_account_system() and vtime_account_idle() on an 8xx:

Before:
00000000 l     F .text 000000a8 vtime_delta
00000280 g     F .text 0000010c vtime_account_system
0000038c g     F .text 00000048 vtime_account_idle

After:
(vtime_delta gets inlined inside the two functions)
000001d8 g     F .text 000000a0 vtime_account_system
00000278 g     F .text 00000038 vtime_account_idle

In terms of performance, we also get approximatly 7% improvement on
task switch. The following small benchmark app is run with perf stat:

void *thread(void *arg)
{
int i;

for (i = 0; i < atoi((char*)arg); i++)
pthread_yield();
}

int main(int argc, char **argv)
{
pthread_t th1, th2;

pthread_create(&th1, NULL, thread, argv[1]);
pthread_create(&th2, NULL, thread, argv[1]);
pthread_join(th1, NULL);
pthread_join(th2, NULL);

return 0;
}

Before the patch:

 Performance counter stats for 'chrt -f 98 ./sched 100000' (50 runs):

       8228.476465      task-clock (msec)         #    0.954 CPUs utilized            ( +-  0.23% )
            200004      context-switches          #    0.024 M/sec                    ( +-  0.00% )

After the patch:

 Performance counter stats for 'chrt -f 98 ./sched 100000' (50 runs):

       7649.070444      task-clock (msec)         #    0.955 CPUs utilized            ( +-  0.27% )
            200004      context-switches          #    0.026 M/sec                    ( +-  0.00% )

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/Kconfig
arch/powerpc/include/asm/accounting.h
arch/powerpc/include/asm/cputime.h
arch/powerpc/kernel/time.c
arch/powerpc/xmon/xmon.c