Joe Perches
2020-May-13 17:38 UTC
[Ocfs2-devel] remove kernel_setsockopt and kernel_getsockopt
On Wed, 2020-05-13 at 08:26 +0200, Christoph Hellwig wrote:> this series removes the kernel_setsockopt and kernel_getsockopt > functions, and instead switches their users to small functions that > implement setting (or in one case getting) a sockopt directly using > a normal kernel function call with type safety and all the other > benefits of not having a function call. > > In some cases these functions seem pretty heavy handed as they do > a lock_sock even for just setting a single variable, but this mirrors > the real setsockopt implementation - counter to that a few kernel > drivers just set the fields directly already. > > Nevertheless the diffstat looks quite promising: > > 42 files changed, 721 insertions(+), 799 deletions(-)trivia: It might be useful to show overall object size change. More EXPORT_SYMBOL uses increase object size a little. And not sure it matters much except it reduces overall object size, but these patches remove (unnecessary) logging on error and that could be mentioned in the cover letter too. e.g.: - ret = kernel_setsockopt(queue->sock, SOL_SOCKET, SO_LINGER, - (char *)&sol, sizeof(sol)); - if (ret) { - dev_err(nctrl->device, - "failed to set SO_LINGER sock opt %d\n", ret); - goto err_sock; - } + sock_set_linger(queue->sock->sk, true, 0);
Christoph Hellwig
2020-May-14 06:27 UTC
[Ocfs2-devel] remove kernel_setsockopt and kernel_getsockopt
On Wed, May 13, 2020 at 10:38:59AM -0700, Joe Perches wrote:> It might be useful to show overall object size change. > > More EXPORT_SYMBOL uses increase object size a little. > > And not sure it matters much except it reduces overall object > size, but these patches remove (unnecessary) logging on error > and that could be mentioned in the cover letter too.The intent here is not to reduce code size. The intent is to kill of set_fs users so that we can eventually remove set_fs entirely.
David Laight
2020-May-14 08:29 UTC
[Ocfs2-devel] remove kernel_setsockopt and kernel_getsockopt
From: Joe Perches> Sent: 13 May 2020 18:39 > On Wed, 2020-05-13 at 08:26 +0200, Christoph Hellwig wrote: > > this series removes the kernel_setsockopt and kernel_getsockopt > > functions, and instead switches their users to small functions that > > implement setting (or in one case getting) a sockopt directly using > > a normal kernel function call with type safety and all the other > > benefits of not having a function call. > > > > In some cases these functions seem pretty heavy handed as they do > > a lock_sock even for just setting a single variable, but this mirrors > > the real setsockopt implementation - counter to that a few kernel > > drivers just set the fields directly already. > > > > Nevertheless the diffstat looks quite promising: > > > > 42 files changed, 721 insertions(+), 799 deletions(-)I missed this patch going through. Massive NACK. You need to export functions that do most of the socket options for all protocols. As well as REUSADDR and NODELAY SCTP has loads because a lot of stuff that should have been extra system calls got piled into setsockopt. An alternate solution would be to move the copy_to/from_user() into a wrapper function so that the kernel_[sg]etsockopt() functions would bypass them completely. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Christoph Hellwig
2020-May-14 10:18 UTC
[Ocfs2-devel] remove kernel_setsockopt and kernel_getsockopt
On Thu, May 14, 2020 at 08:29:30AM +0000, David Laight wrote:> You need to export functions that do most of the socket options > for all protocols.Only for those were we have users, and all those are covered.