Module Name: src Committed By: maxv Date: Sat Dec 27 19:32:57 UTC 2014
Modified Files: src/share/man/man9: Makefile malloc.9 src/sys/sys: malloc.h mallocvar.h Log Message: 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 To generate a diff of this commit: cvs rdiff -u -r1.379 -r1.380 src/share/man/man9/Makefile cvs rdiff -u -r1.49 -r1.50 src/share/man/man9/malloc.9 cvs rdiff -u -r1.115 -r1.116 src/sys/sys/malloc.h cvs rdiff -u -r1.12 -r1.13 src/sys/sys/mallocvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.379 src/share/man/man9/Makefile:1.380 --- src/share/man/man9/Makefile:1.379 Mon Dec 22 18:02:52 2014 +++ src/share/man/man9/Makefile Sat Dec 27 19:32:57 2014 @@ -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 @@ MLINKS+=lock.9 simple_lock_init.9 lock.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 \ Index: src/share/man/man9/malloc.9 diff -u src/share/man/man9/malloc.9:1.49 src/share/man/man9/malloc.9:1.50 --- src/share/man/man9/malloc.9:1.49 Tue May 27 17:12:22 2014 +++ src/share/man/man9/malloc.9 Sat Dec 27 19:32:57 2014 @@ -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 @@ The 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 @@ In addition to some built-in generic typ 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 @@ The .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 @@ function detaches the malloc type 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 Index: src/sys/sys/malloc.h diff -u src/sys/sys/malloc.h:1.115 src/sys/sys/malloc.h:1.116 --- src/sys/sys/malloc.h:1.115 Mon May 19 02:51:25 2014 +++ src/sys/sys/malloc.h Sat Dec 27 19:32:57 2014 @@ -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 @@ void kern_free(void *); #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_ */ Index: src/sys/sys/mallocvar.h diff -u src/sys/sys/mallocvar.h:1.12 src/sys/sys/mallocvar.h:1.13 --- src/sys/sys/mallocvar.h:1.12 Sun Apr 29 20:27:32 2012 +++ src/sys/sys/mallocvar.h Sat Dec 27 19:32:57 2014 @@ -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