On 12.06.2011, 01:08 David Miller wrote: > From: Mathias Krause <minipli@xxxxxxxxxxxxxx> > Date: Fri, 10 Jun 2011 15:10:53 +0200 > >> The address limit is already set in flush_old_exec() so this >> assignment of USER_DS is redundant. >> >> Signed-off-by: Mathias Krause <minipli@xxxxxxxxxxxxxx> > ... >> @@ -368,9 +368,6 @@ void flush_thread(void) >> >> /* Clear FPU register state. */ >> t->fpsaved[0] = 0; >> - >> - if (get_thread_current_ds() != ASI_AIUS) >> - set_fs(USER_DS); >> } > > Yeah but now you're doing it unconditionally, the guard is here > because the %asi register write which set_fs() does is extremely > expensive on sparc64 and %99.99999 of the time we can avoid it. David, can you please use the attached test program to give us some numbers on how expensive the write to the %asi register is, relative to the complexity of the whole exec() path. Please test it w/ and w/o the attached patch. If the difference is significant it might be worth the pain to push the set_fs() down to the arch specific code, e.g. into flush_thread() as on SPARC, and remove it from flush_old_exec(). For the test something like: $ for i in 1 2 3; do echo "run #$i:"; time exec_test 5000 /bin/true; done or better: $ perf stat -r3 exec_test 5000 /bin/true should give some reasonable numbers. I've no SPARC machine, so can't test myself. Thanks, Mathias
Attachment:
exec_test.c
Description: Binary data
Attachment:
no_unconditional_set_fs.diff
Description: Binary data