]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Improve reference counting of EXT_SFBUF pages attached to mbufs.
authorglebius <glebius@FreeBSD.org>
Fri, 11 Jul 2014 19:40:50 +0000 (19:40 +0000)
committerglebius <glebius@FreeBSD.org>
Fri, 11 Jul 2014 19:40:50 +0000 (19:40 +0000)
commit1b591cdaa850f86c2091fced7ba790ac0bbef35a
treed39235ea546a9d1310ed21dec1dc4edd42980c35
parentd1d1e8d008a8740852b8d9f8e4db7db45c6e368c
Improve reference counting of EXT_SFBUF pages attached to mbufs.

o Do not use UMA refcount zone. The problem with this zone is that
  several refcounting words (16 on amd64) share the same cache line,
  and issueing atomic(9) updates on them creates cache line contention.
  Also, allocating and freeing them is extra CPU cycles.
  Instead, refcount the page directly via vm_page_wire() and the sfbuf
  via sf_buf_alloc(sf_buf_page(sf)) [1].

o Call refcounting/freeing function for EXT_SFBUF via direct function
  call, instead of function pointer. This removes barrier for CPU
  branch predictor.

o Do not cleanup the mbuf to be freed in mb_free_ext(), merely to
  satisfy assertion in mb_dtor_mbuf(). Remove the assertion from
  mb_dtor_mbuf(). Use bcopy() instead of manual assignments to
  copy m_ext in mb_dupcl().

[1] This has some problems for now. Using sf_buf_alloc() merely to
    increase refcount is expensive, and is broken on sparc64. To be
    fixed.

Sponsored by: Netflix
Sponsored by: Nginx, Inc.
sys/kern/kern_mbuf.c
sys/kern/uipc_mbuf.c
sys/kern/uipc_syscalls.c
sys/sys/mbuf.h
sys/sys/sf_buf.h