Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Cleanup:
details: https://anonhg.NetBSD.org/src/rev/9d9c7c99ec72
branches: trunk
changeset: 335151:9d9c7c99ec72
user: maxv <maxv%NetBSD.org@localhost>
date: Sat Dec 27 19:32:57 2014 +0000
description:
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
diffstat:
share/man/man9/Makefile | 8 ++++----
share/man/man9/malloc.9 | 42 +++++-------------------------------------
sys/sys/malloc.h | 16 +---------------
sys/sys/mallocvar.h | 15 +++------------
4 files changed, 13 insertions(+), 68 deletions(-)
diffs (177 lines):
diff -r 86d6703b72c3 -r 9d9c7c99ec72 share/man/man9/Makefile
--- a/share/man/man9/Makefile Sat Dec 27 19:18:35 2014 +0000
+++ b/share/man/man9/Makefile Sat Dec 27 19:32:57 2014 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.379 2014/12/22 18:02:52 wiz Exp $
+# $NetBSD: Makefile,v 1.380 2014/12/27 19:32:57 maxv Exp $
# Makefile for section 9 (kernel function and variable) manual pages.
@@ -455,9 +455,9 @@
lock.9 spinlockinit.9 lock.9 spinlockmgr.9
MLINKS+=ltsleep.9 wakeup.9 ltsleep.9 mtsleep.9 ltsleep.9 tsleep.9
MLINKS+=malloc.9 MALLOC.9 malloc.9 realloc.9 malloc.9 free.9 malloc.9 FREE.9
-MLINKS+=malloc.9 malloc_roundup.9 malloc.9 malloc_type_attach.9
-MLINKS+=malloc.9 malloc_type_detach.9 malloc.9 malloc_type_setlimit.9
-MLINKS+=malloc.9 MALLOC_DEFINE_LIMIT.9 malloc.9 MALLOC_DEFINE.9
+MLINKS+=malloc.9 malloc_type_attach.9
+MLINKS+=malloc.9 malloc_type_detach.9
+MLINKS+=malloc.9 MALLOC_DEFINE.9
MLINKS+=malloc.9 MALLOC_DECLARE.9
MLINKS+=mb.9 mb_memory.9 mb.9 mb_read.9 mb.9 mb_write.9
MLINKS+=mbuf.9 m_get.9 mbuf.9 m_getclr.9 mbuf.9 m_gethdr.9 mbuf.9 m_devget.9 \
diff -r 86d6703b72c3 -r 9d9c7c99ec72 share/man/man9/malloc.9
--- a/share/man/man9/malloc.9 Sat Dec 27 19:18:35 2014 +0000
+++ b/share/man/man9/malloc.9 Sat Dec 27 19:32:57 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: malloc.9,v 1.49 2014/05/27 17:12:22 wiz Exp $
+.\" $NetBSD: malloc.9,v 1.50 2014/12/27 19:32:57 maxv Exp $
.\"
.\" Copyright (c) 1996, 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -36,11 +36,8 @@
.Nm realloc ,
.Nm free ,
.Nm FREE ,
-.Nm malloc_roundup ,
.Nm malloc_type_attach ,
.Nm malloc_type_detach ,
-.Nm malloc_type_setlimit ,
-.Nm MALLOC_DEFINE_LIMIT ,
.Nm MALLOC_DEFINE ,
.Nm MALLOC_DECLARE
.Nd general-purpose kernel memory allocator
@@ -53,17 +50,11 @@
"int flags"
.Ft void
.Fn free "void *addr" "struct malloc_type *type"
-.Ft unsigned long
-.Fn malloc_roundup "unsigned long size"
.Ft void
.Fn malloc_type_attach "struct malloc_type *type"
.Ft void
.Fn malloc_type_detach "struct malloc_type *type"
-.Ft void
-.Fn malloc_type_setlimit "struct malloc_type *type" "unsigned long limit"
.In sys/mallocvar.h
-.Fn MALLOC_DEFINE_LIMIT "type" "shortdesc" "longdesc" "limit"
-.Fn MALLOC_JUSTDEFINE_LIMIT "type" "shortdesc" "longdesc" "limit"
.Fn MALLOC_DEFINE "type" "shortdesc" "longdesc"
.Fn MALLOC_JUSTDEFINE "type" "shortdesc" "longdesc"
.Fn MALLOC_DECLARE "type"
@@ -82,8 +73,6 @@
function allocates uninitialized memory in kernel address space for an
object whose size is specified by
.Fa size .
-.Fn malloc_roundup
-returns the actual size of the allocation unit for the given value.
.Fn free
releases memory at address
.Fa addr
@@ -195,7 +184,7 @@
memory allocator, subsystems may define their own types.
.Pp
The
-.Fn MALLOC_DEFINE_LIMIT
+.Fn MALLOC_DEFINE
macro defines a malloc type named
.Fa type
with the short description
@@ -206,21 +195,9 @@
.Fa longdesc
argument, also a constant string, is intended as way to place a
comment in the actual type definition, and is not currently stored
-in the type structure.
-The
-.Fa limit
-argument specifies the maximum amount of memory, in bytes, that this
-malloc type can consume.
-.Pp
-The
-.Fn MALLOC_DEFINE
-macro is equivalent to the
-.Fn MALLOC_DEFINE_LIMIT
-macro with a
-.Fa limit
-argument of 0.
-If kernel memory statistics are being gathered, the system will
-choose a reasonable default limit for the malloc type.
+in the type structure. If kernel memory statistics are being
+gathered, the system will choose a reasonable default limit for
+the malloc type.
.Pp
The
.Fn MALLOC_DECLARE
@@ -252,15 +229,6 @@
previously attached with
.Fn malloc_type_attach .
.Pp
-The
-.Fn malloc_type_setlimit
-function sets the memory limit of the malloc type
-.Fa type
-to
-.Fa limit
-bytes.
-The type must already be registered with the kernel memory allocator.
-.Pp
The following generic malloc types are currently defined:
.Pp
.Bl -tag -offset indent -width XXXXXXXXXXXXXX -compact
diff -r 86d6703b72c3 -r 9d9c7c99ec72 sys/sys/malloc.h
--- a/sys/sys/malloc.h Sat Dec 27 19:18:35 2014 +0000
+++ b/sys/sys/malloc.h Sat Dec 27 19:32:57 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: malloc.h,v 1.115 2014/05/19 02:51:25 rmind Exp $ */
+/* $NetBSD: malloc.h,v 1.116 2014/12/27 19:32:57 maxv Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -74,18 +74,4 @@
#endif /* _KERNEL */
-/*
- * Set of buckets for each size of memory block that is retained
- */
-struct kmembuckets {
- void *kb_next; /* list of free blocks */
- void *kb_last; /* last free block */
- long kb_calls; /* total calls to allocate this size */
- long kb_total; /* total number of blocks allocated */
- long kb_totalfree; /* # of free elements in this bucket */
- long kb_elmpercl; /* # of elements in this sized allocation */
- long kb_highwat; /* high water mark */
- long kb_couldfree; /* over high water mark and could free */
-};
-
#endif /* !_SYS_MALLOC_H_ */
diff -r 86d6703b72c3 -r 9d9c7c99ec72 sys/sys/mallocvar.h
--- a/sys/sys/mallocvar.h Sat Dec 27 19:18:35 2014 +0000
+++ b/sys/sys/mallocvar.h Sat Dec 27 19:32:57 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mallocvar.h,v 1.12 2012/04/29 20:27:32 dsl Exp $ */
+/* $NetBSD: mallocvar.h,v 1.13 2014/12/27 19:32:57 maxv Exp $ */
/*
* Copyright (c) 1987, 1993
@@ -43,17 +43,8 @@
struct malloc_type;
#ifdef _KERNEL
-#define MALLOC_JUSTDEFINE_LIMIT(type, shortdesc, longdesc, limit)
-
-#define MALLOC_JUSTDEFINE(type, shortdesc, longdesc) \
- MALLOC_JUSTDEFINE_LIMIT(type, shortdesc, longdesc, 0)
-
-#define MALLOC_DEFINE_LIMIT(type, shortdesc, longdesc, limit) \
- MALLOC_JUSTDEFINE_LIMIT(type, shortdesc, longdesc, limit)
-
-#define MALLOC_DEFINE(type, shortdesc, longdesc) \
- MALLOC_DEFINE_LIMIT(type, shortdesc, longdesc, 0)
-
+#define MALLOC_JUSTDEFINE(type, shortdesc, longdesc)
+#define MALLOC_DEFINE(type, shortdesc, longdesc)
#define MALLOC_DECLARE(type) \
static struct malloc_type *const __unused type = 0
Home |
Main Index |
Thread Index |
Old Index