PATCH: get unix user speed up

Michael Krivoruchko misha at sun.com
Tue Oct 18 05:20:40 PDT 2005


Hi Havoc,

On 18/10/05 04:24, Havoc Pennington wrote:
> On Tue, 2005-10-18 at 00:56 +0100, Michael Krivoruchko wrote:
>> Hi,
>>
>> the attached patch reduces round trip time for GetConnectionUnixUser by
>> avoiding repetitive calls to system specific authentication API behind
>> dbus_connection_get_unix_user.
> 
> Did you do any profiling on how much difference this makes? It does seem
> to increase the amount of code / potential for bugs so if it doesn't
> help much it might not be worth it... I'm assuming this came up while
> profiling though?

I did not profile this, but this patch saves daemon almost 100% of time
on request of a connection uid. Sure, the communication part (processing
the request and sending the reply) is inevitable expense and is time
consuming. This patch makes sure the daemon does not go to the kernel land
on each GetConnectionUnixUser request once the authentication process is
completed (a call to connection.c:allow_user_function which is callback
set by dbus_connection_set_unix_user_function). It also introduces a method
(internal for daemon) to get connection's uid from the connection data.

Actually, I am working on per-uid message bus names. The idea is to let
a user to have private "channel" on the system wide bus. So the same
message bus name would represent different instances of a "service" for
different users. This would allow realtime data shearing between sessions
of the same user.

There are two parts of this work: per-uid message bus names and per-uid
signals delivery. Both require quick access to uid associated with a
connection within the daemon. So the patch effectively is the first step
in three step walk to the user (uid) private "channel" on the system
wide bus.

Misha
--


More information about the dbus mailing list