[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1425990408.8261.32.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Tue, 10 Mar 2015 05:26:48 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: zenczykowski@...il.com, maze@...gle.com, edumazet@...gle.com,
tytso@....edu, netdev@...r.kernel.org,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH 3/8] net/socket: sock_map_fd - reverse allocation order
On Mon, 2015-03-09 at 23:56 -0400, David Miller wrote:
> From: Maciej Żenczykowski <zenczykowski@...il.com>
> Date: Mon, 9 Mar 2015 14:19:58 -0700
>
> > From: Maciej Żenczykowski <maze@...gle.com>
> >
> > Signed-off-by: Maciej Żenczykowski <maze@...gle.com>
>
> The ordering of these operations was carefully choosen over the years
> such that we prioritize "easy" things to allocate and recover from,
> before harder things.
>
> And allocating and releasing an 'fd' is much cheaper to deal with than
> a socket file object.
>
> And as has been shown in the accept() case, you're even changing user
> visible semantics.
>
> If you really want to reduce the amount of locking, create __*()
> interfaces that assume the files lock is held already, and take
> them around a batch of related operations.
>
> By adding the file argument to the fs interfaces you making the caller
> become a contortionist in order to fit into the interfaces
> requirements. Just let the callers do what they already do, which we
> already know is correct and properly prioritized ordering wise, and
> control the locking at a higher level.
In accept() case, the socket operation can block, so we cannot hold the
lock.
Ideally, as discussed with Al Viro in last Kernel Summit, we would need
to convert the file descriptor management to use RCU, and atomic
bit ops. That would be a very tricky change.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists