]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
pipe: allow for lockless pipe_stat
authormjg <mjg@FreeBSD.org>
Thu, 19 Nov 2020 06:30:25 +0000 (06:30 +0000)
committermjg <mjg@FreeBSD.org>
Thu, 19 Nov 2020 06:30:25 +0000 (06:30 +0000)
commit9c3205def665194ac6f594a7fba075c24968c2db
tree28f63053df17fc5af704822a00dace1f8b1051cf
parent24b52e25545b2f09c464be43d96701ea4cffd536
pipe: allow for lockless pipe_stat

pipes get stated all thet time and this avoidably contributed to contention.
The pipe lock is only held to accomodate MAC and to check the type.

Since normally there is no probe for pipe stat depessimize this by having the
flag.

The pipe_state field gets modified with locks held all the time and it's not
feasible to convert them to use atomic store. Move the type flag away to a
separate variable as a simple cleanup and to provide stable field to read.
Use short for both fields to avoid growing the struct.

While here short-circuit MAC for pipe_poll as well.
sys/kern/sys_pipe.c
sys/security/mac/mac_framework.c
sys/security/mac/mac_framework.h
sys/security/mac/mac_pipe.c
sys/sys/pipe.h