Let's read the Linux socket source code
Автор: Ants Are Everywhere
Загружено: 2023-03-29
Просмотров: 4766
Описание:
In this live stream, we look at the source code for Linux's implementation of the Berkeley socket API. We also look at "socks" (no "et"), which seem to contain the lower-level implementation details for "sockets".
In a now time-honored tradition, I confuse the right and left shift operators. And @Raxneff Nextnerf and others help me out with some of the thornier details in the code.
Along the way, we take a detour to learn a bit about how to optimize C structs for cache locality.
Useful links:
Socket.h: https://github.com/torvalds/linux/blo...
Socket.c: https://github.com/torvalds/linux/blo...
Sock.h: https://github.com/torvalds/linux/blo...
Sock.c: https://github.com/torvalds/linux/blo...
Related videos:
Linux kernel: • Let's read the Linux kernel source code
TCP: • Let's read the Linux TCP source code
Sorry about the harsh sound on this video, I accidentally plugged my microphone into the wrong channel 🤦♂️.
Thanks for watching :)
@raxneff put together the following timeline:
00:00:15 What this live show is about
00:03:28 socket.c
00:05:06 includes in socket.c
00:07:30 opening files
00:13:44 socket address families in socket.h
00:15:35 protocol families in socket.h
00:16:25 flags for send/recv in socket.h
00:17:13 setsockoptions level in socket.h
00:11:54 basic functions in socket.h
00:18:33 sockaddr in socket.h
00:19:32 sockaddr_storage in socket.h
00:20:02 msghdr in socket.h
00:24:06 Linux socket API
00:26:35 for_each_cmsghdr in socket.h (PLEASE, do not touch)
00:29:04 msg_data_left in socket.h
00:32:04 control message types in socket.h
00:32:49 recvmsg in socket.h
00:35:36 sendmsg lookup man page
00:38:49 What I think sock.h is about
00:39:23 includes in sock.h
00:40:34 SOCK_DEBUG in sock.h
00:41:04 socket_lock_t sock.h
00:42:59 sock_common struct in sock.h
00:49:22 SO_REUSEADDR lookup
00:43:10 for what the unions are used
00:53:03 tcp timewait lookup
00:55:51 sock.h (cont.)
00:56:07 sock structure in sock.h
00:58:45 we are in lower level land
01:02:11 sound issues
01:04:04 How ordering of elements in structs can help performance
01:09:18 back in sock.h
01:10:13 optimisation in sock.h and Google QUIC
01:15:04 CPU caches
01:22:09 further stuff in sock.h
01:23:11 sk_page_frag ... in sock.h
01:23:50 sk_pacing_shift_update and right-shift for ms
01:31:13 socket.c
01:32:30 file_operations ... in socket.c
01:34:22 spinlock in socket.c
01:34:40 support routines and audit_sockaddr in socket.c
01:35:17 sockfs_dname in socket.c
01:36:38 sock_alloc_file in socket.c
01:38:48 sock_sendmsg in socket.c
01:39:17 Linux Security Modules
01:39:53 socket.c (cont.)
01:40:35 __sock_recv_timestamp and more in socket.c
01:43:01 sock.c
01:43:03 includes in sock.c
01:45:20 sk_clear_memalloc in sock.c
01:46:26 timeout, netstamp, ... -stuff in sock.c
01:47:53 sk_setsockopt in sock.c
01:52:21 static_branch_unlikely lookup
01:56:45 outro and what comes next
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: