Page MenuHomeFreeBSD

D27199.id79520.diff
No OneTemporary

D27199.id79520.diff

Index: head/sys/kern/kern_malloc.c
===================================================================
--- head/sys/kern/kern_malloc.c
+++ head/sys/kern/kern_malloc.c
@@ -223,12 +223,6 @@
*/
struct mtx malloc_mtx;
-#ifdef MALLOC_PROFILE
-uint64_t krequests[KMEM_ZSIZE + 1];
-
-static int sysctl_kern_mprof(SYSCTL_HANDLER_ARGS);
-#endif
-
static int sysctl_kern_malloc_stats(SYSCTL_HANDLER_ARGS);
#if defined(MALLOC_MAKE_FAILURES) || (MALLOC_DEBUG_MAXZONES > 1)
@@ -635,9 +629,6 @@
size = (size & ~KMEM_ZMASK) + KMEM_ZBASE;
indx = kmemsize[size >> KMEM_ZSHIFT];
zone = kmemzones[indx].kz_zone[mtp_get_subzone(mtp)];
-#ifdef MALLOC_PROFILE
- krequests[size >> KMEM_ZSHIFT]++;
-#endif
va = uma_zalloc(zone, flags);
if (va != NULL)
size = zone->uz_size;
@@ -673,9 +664,6 @@
size = (size & ~KMEM_ZMASK) + KMEM_ZBASE;
indx = kmemsize[size >> KMEM_ZSHIFT];
zone = kmemzones[indx].kz_zone[mtp_get_subzone(mtp)];
-#ifdef MALLOC_PROFILE
- krequests[size >> KMEM_ZSHIFT]++;
-#endif
va = uma_zalloc_domain(zone, NULL, domain, flags);
if (va != NULL)
*sizep = zone->uz_size;
@@ -1495,52 +1483,3 @@
}
#endif /* MALLOC_DEBUG_MAXZONES > 1 */
#endif /* DDB */
-
-#ifdef MALLOC_PROFILE
-
-static int
-sysctl_kern_mprof(SYSCTL_HANDLER_ARGS)
-{
- struct sbuf sbuf;
- uint64_t count;
- uint64_t waste;
- uint64_t mem;
- int error;
- int rsize;
- int size;
- int i;
-
- waste = 0;
- mem = 0;
-
- error = sysctl_wire_old_buffer(req, 0);
- if (error != 0)
- return (error);
- sbuf_new_for_sysctl(&sbuf, NULL, 128, req);
- sbuf_printf(&sbuf,
- "\n Size Requests Real Size\n");
- for (i = 0; i < KMEM_ZSIZE; i++) {
- size = i << KMEM_ZSHIFT;
- rsize = kmemzones[kmemsize[i]].kz_size;
- count = (long long unsigned)krequests[i];
-
- sbuf_printf(&sbuf, "%6d%28llu%11d\n", size,
- (unsigned long long)count, rsize);
-
- if ((rsize * count) > (size * count))
- waste += (rsize * count) - (size * count);
- mem += (rsize * count);
- }
- sbuf_printf(&sbuf,
- "\nTotal memory used:\t%30llu\nTotal Memory wasted:\t%30llu\n",
- (unsigned long long)mem, (unsigned long long)waste);
- error = sbuf_finish(&sbuf);
- sbuf_delete(&sbuf);
- return (error);
-}
-
-SYSCTL_OID(_kern, OID_AUTO, mprof,
- CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_NEEDGIANT, NULL, 0,
- sysctl_kern_mprof, "A",
- "Malloc Profiling");
-#endif /* MALLOC_PROFILE */

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 29, 10:42 PM (4 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26362892
Default Alt Text
D27199.id79520.diff (2 KB)

Event Timeline