mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-16 15:11:52 +00:00
Add separate kmalloc classes for BIO buffers and Ktrace info.
This commit is contained in:
parent
ca67a4e456
commit
d1c4c866f0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17429
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_ktrace.c 8.2 (Berkeley) 9/23/93
|
||||
* $Id: kern_ktrace.c,v 1.10 1996/01/03 21:42:04 wollman Exp $
|
||||
* $Id: kern_ktrace.c,v 1.11 1996/03/11 06:03:23 hsu Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
@ -63,7 +63,7 @@ ktrgetheader(type)
|
||||
struct proc *p = curproc; /* XXX */
|
||||
|
||||
MALLOC(kth, struct ktr_header *, sizeof (struct ktr_header),
|
||||
M_TEMP, M_WAITOK);
|
||||
M_KTRACE, M_WAITOK);
|
||||
kth->ktr_type = type;
|
||||
microtime(&kth->ktr_time);
|
||||
kth->ktr_pid = p->p_pid;
|
||||
@ -84,7 +84,7 @@ ktrsyscall(vp, code, narg, args)
|
||||
|
||||
p->p_traceflag |= KTRFAC_ACTIVE;
|
||||
kth = ktrgetheader(KTR_SYSCALL);
|
||||
MALLOC(ktp, struct ktr_syscall *, len, M_TEMP, M_WAITOK);
|
||||
MALLOC(ktp, struct ktr_syscall *, len, M_KTRACE, M_WAITOK);
|
||||
ktp->ktr_code = code;
|
||||
ktp->ktr_narg = narg;
|
||||
argp = (int *)((char *)ktp + sizeof(struct ktr_syscall));
|
||||
@ -93,8 +93,8 @@ ktrsyscall(vp, code, narg, args)
|
||||
kth->ktr_buf = (caddr_t)ktp;
|
||||
kth->ktr_len = len;
|
||||
ktrwrite(vp, kth);
|
||||
FREE(ktp, M_TEMP);
|
||||
FREE(kth, M_TEMP);
|
||||
FREE(ktp, M_KTRACE);
|
||||
FREE(kth, M_KTRACE);
|
||||
p->p_traceflag &= ~KTRFAC_ACTIVE;
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ ktrsysret(vp, code, error, retval)
|
||||
kth->ktr_len = sizeof(struct ktr_sysret);
|
||||
|
||||
ktrwrite(vp, kth);
|
||||
FREE(kth, M_TEMP);
|
||||
FREE(kth, M_KTRACE);
|
||||
p->p_traceflag &= ~KTRFAC_ACTIVE;
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ ktrnamei(vp, path)
|
||||
kth->ktr_buf = path;
|
||||
|
||||
ktrwrite(vp, kth);
|
||||
FREE(kth, M_TEMP);
|
||||
FREE(kth, M_KTRACE);
|
||||
p->p_traceflag &= ~KTRFAC_ACTIVE;
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ ktrgenio(vp, fd, rw, iov, len, error)
|
||||
p->p_traceflag |= KTRFAC_ACTIVE;
|
||||
kth = ktrgetheader(KTR_GENIO);
|
||||
MALLOC(ktp, struct ktr_genio *, sizeof(struct ktr_genio) + len,
|
||||
M_TEMP, M_WAITOK);
|
||||
M_KTRACE, M_WAITOK);
|
||||
ktp->ktr_fd = fd;
|
||||
ktp->ktr_rw = rw;
|
||||
cp = (caddr_t)((char *)ktp + sizeof (struct ktr_genio));
|
||||
@ -176,8 +176,8 @@ ktrgenio(vp, fd, rw, iov, len, error)
|
||||
|
||||
ktrwrite(vp, kth);
|
||||
done:
|
||||
FREE(kth, M_TEMP);
|
||||
FREE(ktp, M_TEMP);
|
||||
FREE(kth, M_KTRACE);
|
||||
FREE(ktp, M_KTRACE);
|
||||
p->p_traceflag &= ~KTRFAC_ACTIVE;
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ ktrpsig(vp, sig, action, mask, code)
|
||||
kth->ktr_len = sizeof (struct ktr_psig);
|
||||
|
||||
ktrwrite(vp, kth);
|
||||
FREE(kth, M_TEMP);
|
||||
FREE(kth, M_KTRACE);
|
||||
p->p_traceflag &= ~KTRFAC_ACTIVE;
|
||||
}
|
||||
|
||||
@ -223,7 +223,7 @@ ktrcsw(vp, out, user)
|
||||
kth->ktr_len = sizeof (struct ktr_csw);
|
||||
|
||||
ktrwrite(vp, kth);
|
||||
FREE(kth, M_TEMP);
|
||||
FREE(kth, M_KTRACE);
|
||||
p->p_traceflag &= ~KTRFAC_ACTIVE;
|
||||
}
|
||||
#endif
|
||||
|
@ -18,7 +18,7 @@
|
||||
* 5. Modifications may be freely made to this file if the above conditions
|
||||
* are met.
|
||||
*
|
||||
* $Id: vfs_bio.c,v 1.93 1996/06/14 11:01:27 asami Exp $
|
||||
* $Id: vfs_bio.c,v 1.94 1996/06/30 05:17:08 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1133,7 +1133,7 @@ allocbuf(struct buf * bp, int size)
|
||||
if (newbsize) {
|
||||
bp->b_bcount = size;
|
||||
} else {
|
||||
free(bp->b_data, M_TEMP);
|
||||
free(bp->b_data, M_BIOBUF);
|
||||
bufspace -= bp->b_bufsize;
|
||||
bufmallocspace -= bp->b_bufsize;
|
||||
bp->b_data = (caddr_t) buffers_kva + (bp - buf) * MAXBSIZE;
|
||||
@ -1156,7 +1156,7 @@ allocbuf(struct buf * bp, int size)
|
||||
(bp->b_bufsize == 0) &&
|
||||
(mbsize <= PAGE_SIZE/2)) {
|
||||
|
||||
bp->b_data = malloc(mbsize, M_TEMP, M_WAITOK);
|
||||
bp->b_data = malloc(mbsize, M_BIOBUF, M_WAITOK);
|
||||
bp->b_bufsize = mbsize;
|
||||
bp->b_bcount = size;
|
||||
bp->b_flags |= B_MALLOC;
|
||||
@ -1186,7 +1186,7 @@ allocbuf(struct buf * bp, int size)
|
||||
(vm_offset_t) bp->b_data + newbsize);
|
||||
if (origbuf) {
|
||||
bcopy(origbuf, bp->b_data, origbufsize);
|
||||
free(origbuf, M_TEMP);
|
||||
free(origbuf, M_BIOBUF);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)malloc.h 8.5 (Berkeley) 5/3/95
|
||||
* $Id: malloc.h,v 1.13 1996/05/02 14:21:02 phk Exp $
|
||||
* $Id: malloc.h,v 1.14 1996/06/14 17:22:18 wollman Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_MALLOC_H_
|
||||
@ -126,7 +126,9 @@
|
||||
#define M_PKTCLASS 79 /* structures used in packet classifier */
|
||||
#define M_SYSCTL 80 /* sysctl internal magic */
|
||||
#define M_SECA 81 /* security associations, key management */
|
||||
#define M_LAST 82 /* Must be last type + 1 */
|
||||
#define M_BIOBUF 82 /* BIO buffer */
|
||||
#define M_KTRACE 83 /* KTRACE */
|
||||
#define M_LAST 84 /* Must be last type + 1 */
|
||||
|
||||
#define INITKMEMNAMES { \
|
||||
"free", /* 0 M_FREE */ \
|
||||
@ -208,6 +210,8 @@
|
||||
"PktClass", /* 79 M_PKTCLASS */ \
|
||||
"sysctl", /* 80 M_SYSCTL */ \
|
||||
"key mgmt", /* 81 M_SECA */ \
|
||||
"BIO buffer", /* 82 M_BIOBUF */ \
|
||||
"KTRACE", /* 83 M_KTRACE */ \
|
||||
}
|
||||
|
||||
struct kmemstats {
|
||||
|
Loading…
Reference in New Issue
Block a user