提交 822f9bb1 编写于 作者: A Alexey Dobriyan 提交者: David S. Miller

soreuseport: use "unsigned int" in __reuseport_alloc()

Number of sockets is limited by 16-bit, so 64-bit allocation will never
happen.

16-bit ops are the worst code density-wise on x86_64 because of
additional prefix (66).

Space savings:

	add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3 (-3)
	function                                     old     new   delta
	reuseport_add_sock                           539     536      -3
Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ec2e45a9
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
static DEFINE_SPINLOCK(reuseport_lock); static DEFINE_SPINLOCK(reuseport_lock);
static struct sock_reuseport *__reuseport_alloc(u16 max_socks) static struct sock_reuseport *__reuseport_alloc(unsigned int max_socks)
{ {
size_t size = sizeof(struct sock_reuseport) + unsigned int size = sizeof(struct sock_reuseport) +
sizeof(struct sock *) * max_socks; sizeof(struct sock *) * max_socks;
struct sock_reuseport *reuse = kzalloc(size, GFP_ATOMIC); struct sock_reuseport *reuse = kzalloc(size, GFP_ATOMIC);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册