]> git.baikalelectronics.ru Git - kernel.git/commit
[SOCK] Avoid divides in sk_stream_pages() and __sk_stream_mem_reclaim()
authorEric Dumazet <dada1@cosmosbay.com>
Tue, 25 Dec 2007 04:57:56 +0000 (20:57 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:00:05 +0000 (15:00 -0800)
commit4393d7f303851bda07df1b1a637d7d9d7e0b48fd
tree91b5debf1d861a40c942a33f1286b70031a94305
parent6ccc722e3bca9649b79acec6afba5245b6a03ae5
[SOCK] Avoid divides in sk_stream_pages() and __sk_stream_mem_reclaim()

sk_forward_alloc being signed, we should take care of divides by
SK_STREAM_MEM_QUANTUM we do in sk_stream_pages() and
__sk_stream_mem_reclaim()

This patchs introduces SK_STREAM_MEM_QUANTUM_SHIFT, defined
as ilog2(SK_STREAM_MEM_QUANTUM), to be able to use right
shifts instead of plain divides.

This should help compiler to choose right shifts instead of
expensive divides (as seen with CONFIG_CC_OPTIMIZE_FOR_SIZE=y on x86)

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sock.h
net/core/stream.c