免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: jiufei19
打印 上一主题 下一主题

[网络子系统] 关于sk_buff及其paged data的问题【已解决】 [复制链接]

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
11 [报告]
发表于 2014-03-14 10:52 |只看该作者
See msg_more flag.

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
12 [报告]
发表于 2014-03-19 16:17 |只看该作者
本帖最后由 firkraag 于 2014-03-19 16:20 编辑

'x' can contain the payload of layer 4.For example, when you first send a packet whose
size is less than mtu and the scattered-gather is enabled, kernel allocates a skb like
the picture but without the frags and then buffers the data. When you want send some more data,
kernel just place the latter coming data(plus the x also less than mtu) in a page which is
pointed by page pointer of frags.

论坛徽章:
1
IT运维版块每日发帖之星
日期:2015-11-17 06:20:00
13 [报告]
发表于 2014-03-19 19:01 |只看该作者
firkraag 发表于 2014-03-19 16:17
'x' can contain the payload of layer 4.For example, when you first send a packet whose
size is less ...


请问这段话摘自何处?

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
14 [报告]
发表于 2014-03-19 19:42 |只看该作者
Just my opinion.

论坛徽章:
1
IT运维版块每日发帖之星
日期:2015-11-17 06:20:00
15 [报告]
发表于 2014-03-19 23:37 |只看该作者
那么firkraag认为,kernel总是会在第1次发送数据时,使用main buffer,随后可以使用SG

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
16 [报告]
发表于 2014-03-20 07:13 |只看该作者
Yes, but except with the MSG_MORE flag or the data size exceeds the mtu.

论坛徽章:
1
IT运维版块每日发帖之星
日期:2015-11-17 06:20:00
17 [报告]
发表于 2014-03-24 09:26 |只看该作者
firkraag 发表于 2014-03-20 07:13
Yes, but except with the MSG_MORE flag or the data size exceeds the mtu.



根据ip_append_data的函数过程,可以很明显看出,当首次调用ip_append_data时,sk->sk_write_queue肯定为空,则一定会执行goto alloc_new_skb,于是有如下调用过程序列

   sock_alloc_send_skb
       |
       |---sock_alloc_send_pskb(sk, size, 0, noblock, errcode)
               |
               |---alloc_skb(header_len, gfp_mask)
                       |
                       |---此时,因为sock_alloc_send_pskb中传入的第3个参数为0,表示skb->data_len为0,即No page

显然,只要是首次调用ip_append_data函数,则首个入队列sk_write_queue的skb一定是不包含page数据的skb,而和MSG_MORE或data是否超过mtu其实无关,我这样理解firkraag是否认同?

论坛徽章:
1
双鱼座
日期:2013-08-28 13:47:26
18 [报告]
发表于 2014-03-24 12:31 |只看该作者
回复 17# jiufei19
Yes, sorry for my previous chaos express which misleads you.What I mean is with MSG_MORE flag or data
exceeds the MTU, kernel would not use the SG for the first skb in the further.

论坛徽章:
0
19 [报告]
发表于 2014-03-24 14:10 |只看该作者
不知道楼主在纠结什么。
肯定是先用完第一块内存,再用第二块啊。
其实sk->data就是sg的多块不连续内存中的第一块内存而已。
可以省去分配第二块内存的开销。

论坛徽章:
1
IT运维版块每日发帖之星
日期:2015-11-17 06:20:00
20 [报告]
发表于 2014-03-24 20:29 |只看该作者
感谢各位的帮助,现在不纠结这个问题了,解决了,不过还有另外关于SG的page问题,容我后面再说
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP