diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-02-01 05:56:51 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-02-01 05:56:51 +0000 |
commit | b8e797cfe04273fadc8e4c77b305325e0f1549f3 (patch) | |
tree | 02367146686e83fbaea5ff9d00e36f8d0cf2b688 /sys/security/mac_lomac | |
parent | 75249cf38e5ac423561abeb1906852c0579f9e3c (diff) | |
download | FreeBSD-src-b8e797cfe04273fadc8e4c77b305325e0f1549f3.zip FreeBSD-src-b8e797cfe04273fadc8e4c77b305325e0f1549f3.tar.gz |
Coalesce pipe allocations and frees. Previously, the pipe code
would allocate two 'struct pipe's from the pipe zone, and malloc a
mutex.
- Create a new "struct pipepair" object holding the two 'struct
pipe' instances, struct mutex, and struct label reference. Pipe
structures now have a back-pointer to the pipe pair, and a
'pipe_present' flag to indicate whether the half has been
closed.
- Perform mutex init/destroy in zone init/destroy, avoiding
reallocating the mutex for each pipe. Perform most pipe structure
setup in zone constructor.
- VM memory mappings for pageable buffers are still done outside of
the UMA zone.
- Change MAC API to speak 'struct pipepair' instead of 'struct pipe',
update many policies. MAC labels are also handled outside of the
UMA zone for now. Label-only policy modules don't have to be
recompiled, but if a module is recompiled, its pipe entry points
will need to be updated. If a module actually reached into the
pipe structures (unlikely), that would also need to be modified.
These changes substantially simplify failure handling in the pipe
code as there are many fewer possible failure modes.
On half-close, pipes no longer free the 'struct pipe' for the closed
half until a full-close takes place. However, VM mapped buffers
are still released on half-close.
Some code refactoring is now possible to clean up some of the back
references, etc; this patch attempts not to change the structure
of most of the pipe implementation, only allocation/free code
paths, so as to avoid introducing bugs (hopefully).
This cuts about 8%-9% off the cost of sequential pipe allocation
and free in system call tests on UP and SMP in my micro-benchmarks.
May or may not make a difference in macro-benchmarks, but doing
less work is good.
Reviewed by: juli, tjr
Testing help: dwhite, fenestro, scottl, et al
Diffstat (limited to 'sys/security/mac_lomac')
-rw-r--r-- | sys/security/mac_lomac/mac_lomac.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c index 10608d1..f86e106 100644 --- a/sys/security/mac_lomac/mac_lomac.c +++ b/sys/security/mac_lomac/mac_lomac.c @@ -1156,7 +1156,7 @@ mac_lomac_create_socket(struct ucred *cred, struct socket *socket, } static void -mac_lomac_create_pipe(struct ucred *cred, struct pipe *pipe, +mac_lomac_create_pipe(struct ucred *cred, struct pipepair *pp, struct label *pipelabel) { struct mac_lomac *source, *dest; @@ -1193,7 +1193,7 @@ mac_lomac_relabel_socket(struct ucred *cred, struct socket *socket, } static void -mac_lomac_relabel_pipe(struct ucred *cred, struct pipe *pipe, +mac_lomac_relabel_pipe(struct ucred *cred, struct pipepair *pp, struct label *pipelabel, struct label *newlabel) { struct mac_lomac *source, *dest; @@ -1798,7 +1798,7 @@ mac_lomac_check_kld_unload(struct ucred *cred) } static int -mac_lomac_check_pipe_ioctl(struct ucred *cred, struct pipe *pipe, +mac_lomac_check_pipe_ioctl(struct ucred *cred, struct pipepair *pp, struct label *pipelabel, unsigned long cmd, void /* caddr_t */ *data) { @@ -1811,7 +1811,7 @@ mac_lomac_check_pipe_ioctl(struct ucred *cred, struct pipe *pipe, } static int -mac_lomac_check_pipe_read(struct ucred *cred, struct pipe *pipe, +mac_lomac_check_pipe_read(struct ucred *cred, struct pipepair *pp, struct label *pipelabel) { struct mac_lomac *subj, *obj; @@ -1829,7 +1829,7 @@ mac_lomac_check_pipe_read(struct ucred *cred, struct pipe *pipe, } static int -mac_lomac_check_pipe_relabel(struct ucred *cred, struct pipe *pipe, +mac_lomac_check_pipe_relabel(struct ucred *cred, struct pipepair *pp, struct label *pipelabel, struct label *newlabel) { struct mac_lomac *subj, *obj, *new; @@ -1880,7 +1880,7 @@ mac_lomac_check_pipe_relabel(struct ucred *cred, struct pipe *pipe, } static int -mac_lomac_check_pipe_write(struct ucred *cred, struct pipe *pipe, +mac_lomac_check_pipe_write(struct ucred *cred, struct pipepair *pp, struct label *pipelabel) { struct mac_lomac *subj, *obj; |