mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-25 10:01:02 +01:00
Use dedicated lock name for pbufs
Also remove a pointer to array variable, use array address directly. Reviewed by: markj, mckusick Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D34072
This commit is contained in:
parent
9cd59de2e1
commit
531f8cfea0
@ -400,12 +400,6 @@ struct bufqueue __exclusive_cache_line bqempty;
|
|||||||
*/
|
*/
|
||||||
uma_zone_t buf_zone;
|
uma_zone_t buf_zone;
|
||||||
|
|
||||||
/*
|
|
||||||
* Single global constant for BUF_WMESG, to avoid getting multiple references.
|
|
||||||
* buf_wmesg is referred from macros.
|
|
||||||
*/
|
|
||||||
const char *buf_wmesg = BUF_WMESG;
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sysctl_runningspace(SYSCTL_HANDLER_ARGS)
|
sysctl_runningspace(SYSCTL_HANDLER_ARGS)
|
||||||
{
|
{
|
||||||
@ -1184,6 +1178,12 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
|
|||||||
return (v);
|
return (v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Single global constant for BUF_WMESG, to avoid getting multiple
|
||||||
|
* references.
|
||||||
|
*/
|
||||||
|
static const char buf_wmesg[] = "bufwait";
|
||||||
|
|
||||||
/* Initialize the buffer subsystem. Called before use of any buffers. */
|
/* Initialize the buffer subsystem. Called before use of any buffers. */
|
||||||
void
|
void
|
||||||
bufinit(void)
|
bufinit(void)
|
||||||
@ -1214,7 +1214,7 @@ bufinit(void)
|
|||||||
bp->b_xflags = 0;
|
bp->b_xflags = 0;
|
||||||
bp->b_data = bp->b_kvabase = unmapped_buf;
|
bp->b_data = bp->b_kvabase = unmapped_buf;
|
||||||
LIST_INIT(&bp->b_dep);
|
LIST_INIT(&bp->b_dep);
|
||||||
BUF_LOCKINIT(bp);
|
BUF_LOCKINIT(bp, buf_wmesg);
|
||||||
bq_insert(&bqempty, bp, false);
|
bq_insert(&bqempty, bp, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,16 +292,14 @@ struct buf {
|
|||||||
/*
|
/*
|
||||||
* Buffer locking
|
* Buffer locking
|
||||||
*/
|
*/
|
||||||
extern const char *buf_wmesg; /* Default buffer lock message */
|
|
||||||
#define BUF_WMESG "bufwait"
|
|
||||||
#include <sys/proc.h> /* XXX for curthread */
|
#include <sys/proc.h> /* XXX for curthread */
|
||||||
#include <sys/mutex.h>
|
#include <sys/mutex.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize a lock.
|
* Initialize a lock.
|
||||||
*/
|
*/
|
||||||
#define BUF_LOCKINIT(bp) \
|
#define BUF_LOCKINIT(bp, wmesg) \
|
||||||
lockinit(&(bp)->b_lock, PRIBIO + 4, buf_wmesg, 0, LK_NEW)
|
lockinit(&(bp)->b_lock, PRIBIO + 4, wmesg, 0, LK_NEW)
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Get a lock sleeping non-interruptably until it becomes available.
|
* Get a lock sleeping non-interruptably until it becomes available.
|
||||||
|
@ -489,6 +489,8 @@ pbuf_dtor(void *mem, int size, void *arg)
|
|||||||
BUF_UNLOCK(bp);
|
BUF_UNLOCK(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char pbuf_wmesg[] = "pbufwait";
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pbuf_init(void *mem, int size, int flags)
|
pbuf_init(void *mem, int size, int flags)
|
||||||
{
|
{
|
||||||
@ -498,7 +500,7 @@ pbuf_init(void *mem, int size, int flags)
|
|||||||
if (bp->b_kvabase == NULL)
|
if (bp->b_kvabase == NULL)
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
bp->b_kvasize = ptoa(PBUF_PAGES);
|
bp->b_kvasize = ptoa(PBUF_PAGES);
|
||||||
BUF_LOCKINIT(bp);
|
BUF_LOCKINIT(bp, pbuf_wmesg);
|
||||||
LIST_INIT(&bp->b_dep);
|
LIST_INIT(&bp->b_dep);
|
||||||
bp->b_rcred = bp->b_wcred = NOCRED;
|
bp->b_rcred = bp->b_wcred = NOCRED;
|
||||||
bp->b_xflags = 0;
|
bp->b_xflags = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user