From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2120.oracle.com ([141.146.126.78]:57574 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751563AbeBVA1X (ORCPT ); Wed, 21 Feb 2018 19:27:23 -0500 Date: Wed, 21 Feb 2018 19:26:46 -0500 From: Sowmini Varadhan To: Willem de Bruijn Cc: Network Development , David Miller , rds-devel@oss.oracle.com, Santosh Shilimkar Subject: Re: [PATCH net-next] RDS: deliver zerocopy completion notification with data as an optimization Message-ID: <20180222002646.GI15244@oracle.com> References: <1519244381-138747-1-git-send-email-sowmini.varadhan@oracle.com> <20180221221428.GG15244@oracle.com> <20180221230355.GH15244@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On (02/21/18 18:45), Willem de Bruijn wrote: > > I do mean returning 0 instead of -EAGAIN if control data is ready. > Something like > > @@ -611,7 +611,8 @@ int rds_recvmsg(struct socket *sock, struct msghdr > *msg, size_t size, > > if (!rds_next_incoming(rs, &inc)) { > if (nonblock) { > - ret = -EAGAIN; > + ncookies = rds_recvmsg_zcookie(rs, msg); > + ret = ncookies ? 0 : -EAGAIN; > break; > } Yes, but you now have an implicit branch based on ncookies, so I'm not sure it saved all that much? like I said let me revisit this > By the way, the put_cmsg is unconditional even if the caller did > not supply msg_control. So it is basically no longer safe to ever > call read, recv or recvfrom on a socket if zerocopy notifications > are outstanding. Wait, I thought put_cmsg already checks for these things. > It is possible to check msg_controllen before even deciding whether > to try to dequeue notifications (and take the lock). I see that this is > not common. But RDS of all cases seems to do this, in > rds_notify_queue_get: yes the comment above that code suggests that this bit of code was done to avoid calling put_cmsg while holding the rs_lock. One bit of administrivia though- if I now drop sk_error_queue for PF_RDS, I'll have to fix selftests in the same patch too, so the patch will get a bit bulky (and thus a bit more difficult to review).