From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sowmini Varadhan Subject: Re: [PATCH V2 net-next 5/7] rds: zerocopy Tx support. Date: Wed, 14 Feb 2018 14:49:39 -0500 Message-ID: <20180214194939.GO11528@oracle.com> References: <97bec2535a23b8dc976f958dc27256731de9127e.1517843755.git.sowmini.varadhan@oracle.com> <35efc079-0992-3ac7-ba8d-fcf021f7567f@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, willemdebruijn.kernel@gmail.com, davem@davemloft.net, rds-devel@oss.oracle.com To: Santosh Shilimkar Return-path: Received: from aserp2130.oracle.com ([141.146.126.79]:42736 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162994AbeBNTuI (ORCPT ); Wed, 14 Feb 2018 14:50:08 -0500 Content-Disposition: inline In-Reply-To: <35efc079-0992-3ac7-ba8d-fcf021f7567f@oracle.com> Sender: netdev-owner@vger.kernel.org List-ID: On (02/14/18 11:10), Santosh Shilimkar wrote: > s/RDS_CMSG_ZCOPY_COOKIE/RDS_CMSG_ZMSGCOPY_COOKIE > Please see https://www.spinics.net/lists/netdev/msg483627.html > >@@ -356,6 +358,53 @@ int rds_message_copy_from_user(struct rds_message *rm, struct iov_iter *from) > > sg = rm->data.op_sg; > > sg_off = 0; /* Dear gcc, sg->page will be null from kzalloc. */ > >+ if (zcopy) { > >+ int total_copied = 0; > >+ struct sk_buff *skb; > >+ > >+ skb = alloc_skb(SO_EE_ORIGIN_MAX_ZCOOKIES * sizeof(u32), > >+ GFP_KERNEL); > This can sleep so you might want to check if you want to use ATOMIC version > here. I think it should be fine: rds_message_copy_from_user() is called in process context, and if you notice, the calling function rds_sendmsg() also has this 1100 rm = rds_message_alloc(ret, GFP_KERNEL); 1101 if (!rm) { 1102 ret = -ENOMEM; 1103 goto out; 1104 } : 1106 /* Attach data to the rm */ : 1113 ret = rds_message_copy_from_user(rm, &msg->msg_iter); So using GFP_KERNEL is as safe as the call at line 1100. > >+ return -ENOMEM; > >+ } > NOMEM new application visible change but probably the right one for this > particular case. Just need to make sure application can handle this > error. I think the application already handles this correctly (see line 1102 above) Thanks for taking a look. --Sowmini