Skip to content

Commit b5e64b3

Browse files
author
Martin Schwidefsky
committed
s390/vdso: ectg gettime support for CLOCK_THREAD_CPUTIME_ID
The code to use the ECTG instruction to calculate the cputime for the current thread is currently used only for the per-thread CPU-clock with the clockid -2 (PID=0, VIRT=1). Use the same code for the clockid CLOCK_THREAD_CPUTIME_ID to speed up the more common clockid as well. Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent 06aae68 commit b5e64b3

3 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎arch/s390/kernel/asm-offsets.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ int main(void)
7272
/* constants used by the vdso */
7373
DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME);
7474
DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC);
75+
DEFINE(__CLOCK_THREAD_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID);
7576
DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
7677
BLANK();
7778
/* idle data offsets */

‎arch/s390/kernel/vdso64/clock_getres.S‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ __kernel_clock_getres:
2323
je 0f
2424
cghi %r2,__CLOCK_MONOTONIC
2525
je 0f
26-
cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */
26+
cghi %r2,__CLOCK_THREAD_CPUTIME_ID
27+
je 0f
28+
cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */
2729
jne 2f
2830
larl %r5,_vdso_data
2931
icm %r0,15,__LC_ECTG_OK(%r5)

‎arch/s390/kernel/vdso64/clock_gettime.S‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ __kernel_clock_gettime:
2222
larl %r5,_vdso_data
2323
cghi %r2,__CLOCK_REALTIME
2424
je 4f
25-
cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */
25+
cghi %r2,__CLOCK_THREAD_CPUTIME_ID
26+
je 9f
27+
cghi %r2,-2 /* Per-thread CPUCLOCK with PID=0, VIRT=1 */
2628
je 9f
2729
cghi %r2,__CLOCK_MONOTONIC
2830
jne 12f

0 commit comments

Comments
 (0)