More fixes to Binder perf regression from Eclair

Re-use the file descriptor to change the cgroups.  There's a fast path
in the kernel for the case where the value's already uncahnged.  Also,
this is okay because the kernel ignores the write offset.  This is
essentially a ioctl-ish/datagram interface, despite being a fd we're
writing to.

This reduces Dalvik->Dalvik void/void Binder calls on Sapphire from
~1.2 to ~0.8 ms.  This is a bit slower than the ~0.7 ms we get
avoiding the write altogether.

strace confirms:

[pid  1557] ioctl(21, 0xc0186201 <unfinished ...>
[pid  1556] <... ioctl resumed> , 0x45399cd0) = 0
[pid  1556] write(22, "1556", 4)        = 4
[pid  1556] ioctl(21, 0xc0186201 <unfinished ...>
[pid  1555] <... ioctl resumed> , 0x45299cd0) = 0
[pid  1555] write(22, "1555", 4)        = 4
[pid  1555] ioctl(21, 0xc0186201 <unfinished ...>
[pid  1554] <... ioctl resumed> , 0x45199cd0) = 0
[pid  1554] write(22, "1554", 4)        = 4

BUG=2660235

Change-Id: Ia9f9e1d5b792eaebc9560f89931faf6df0cf9c0d
1 file changed