Re: [PATCH 4/5] x86: entry_64.S: always allocate complete "struct pt_regs"

From: Denys Vlasenko
Date: Thu Aug 07 2014 - 05:54:29 EST


On Tue, Aug 5, 2014 at 4:53 PM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> On Aug 5, 2014 7:36 PM, "Denys Vlasenko" <vda.linux@xxxxxxxxxxxxxx> wrote:
>> Then old_rsp can be nuked everywhere else,
>> RESTORE_TOP_OF_STACK can be nuked, and
>> FIXUP_TOP_OF_STACK can be reduced to merely:
>>
>> movq $__USER_DS,SS(%rsp)
>> movq $__USER_CS,CS(%rsp)
>
> Mmm, right. That's probably better than doing this on the fast path.

I measured it. These particular insns have a nasty huge encoding in x86 -
12 bytes each, no less!

48 c7 84 24 88 00 00 00 33 00 00 00 movq $0x33,0x88(%rsp)
48 c7 84 24 a0 00 00 00 2b 00 00 00 movq $0x2b,0xa0(%rsp)

With them in hot path, I measure 55.6 ns per syscall,
with them moved out of hot path it's 54.8 ns.
This is 2.70GHz CPU, so it must be 2 CPU cycles.

--
vda
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/