]> git.baikalelectronics.ru Git - kernel.git/commit
sch_cake: don't try to reallocate or unshare skb unconditionally
authorIlya Ponetayev <i.ponetaev@ndmsystems.com>
Thu, 25 Jun 2020 20:12:07 +0000 (22:12 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 25 Jun 2020 23:24:05 +0000 (16:24 -0700)
commit6e0dff69e48a0f47aeb843af0df3a21b812ab0e1
tree34ae27978c1e350b801b99aa7b81bf8238a62d06
parent29c0fa62459c2397ddf36b8e3c9572831ce03842
sch_cake: don't try to reallocate or unshare skb unconditionally

cake_handle_diffserv() tries to linearize mac and network header parts of
skb and to make it writable unconditionally. In some cases it leads to full
skb reallocation, which reduces throughput and increases CPU load. Some
measurements of IPv4 forward + NAPT on MIPS router with 580 MHz single-core
CPU was conducted. It appears that on kernel 4.9 skb_try_make_writable()
reallocates skb, if skb was allocated in ethernet driver via so-called
'build skb' method from page cache (it was discovered by strange increase
of kmalloc-2048 slab at first).

Obtain DSCP value via read-only skb_header_pointer() call, and leave
linearization only for DSCP bleaching or ECN CE setting. And, as an
additional optimisation, skip diffserv parsing entirely if it is not needed
by the current configuration.

Fixes: 555362652f04 ("sch_cake: Make sure we can write the IP header before changing DSCP bits")
Signed-off-by: Ilya Ponetayev <i.ponetaev@ndmsystems.com>
[ fix a few style issues, reflow commit message ]
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_cake.c