1/*-
2 * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org>
3 * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org>
4 * Copyright (c) 2004-2005 Robert N. M. Watson
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
--- 34 unchanged lines hidden (view full) ---
43
44/*
45 * TODO:
46 * - Improve memory usage for large allocations
47 * - Investigate cache size adjustments
48 */
49
50#include <sys/cdefs.h>
51__FBSDID("$FreeBSD: head/sys/vm/uma_core.c 148371 2005-07-25 00:47:32Z rwatson $");
52
53/* I should really use ktr.. */
54/*
55#define UMA_DEBUG 1
56#define UMA_DEBUG_ALLOC 1
57#define UMA_DEBUG_ALLOC_1 1
58*/
59
--- 2915 unchanged lines hidden (view full) ---
2975 error = ENOMEM;
2976 goto out;
2977 }
2978
2979 LIST_FOREACH(kz, &uma_kegs, uk_link) {
2980 LIST_FOREACH(z, &kz->uk_zones, uz_link) {
2981 bzero(&uth, sizeof(uth));
2982 ZONE_LOCK(z);
2983 strlcpy(uth.uth_name, z->uz_name, UTH_MAX_NAME);
2984 uth.uth_align = kz->uk_align;
2985 uth.uth_pages = kz->uk_pages;
2986 uth.uth_keg_free = kz->uk_free;
2987 uth.uth_size = kz->uk_size;
2988 uth.uth_rsize = kz->uk_rsize;
2989 uth.uth_maxpages = kz->uk_maxpages;
2990 if (kz->uk_ppera > 1)
2991 uth.uth_limit = kz->uk_maxpages /
2992 kz->uk_ppera;
2993 else
2994 uth.uth_limit = kz->uk_maxpages *
2995 kz->uk_ipers;
2996
2997 /*
2998 * A zone is secondary is it is not the first entry
2999 * on the keg's zone list.
3000 */
3001 if ((kz->uk_flags & UMA_ZONE_SECONDARY) &&
3002 (LIST_FIRST(&kz->uk_zones) != z))
3003 uth.uth_zone_flags = UTH_ZONE_SECONDARY;
3004
3005 LIST_FOREACH(bucket, &z->uz_full_bucket, ub_link)
3006 uth.uth_zone_free += bucket->ub_cnt;
3007 uth.uth_allocs = z->uz_allocs;
3008 uth.uth_frees = z->uz_frees;
3009 uth.uth_fails = z->uz_fails;
3010 if (sbuf_bcat(&sbuf, &uth, sizeof(uth)) < 0) {
3011 ZONE_UNLOCK(z);
3012 mtx_unlock(&uma_mtx);
--- 42 unchanged lines hidden ---
2 * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org>
3 * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org>
4 * Copyright (c) 2004-2005 Robert N. M. Watson
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
--- 34 unchanged lines hidden (view full) ---
43
44/*
45 * TODO:
46 * - Improve memory usage for large allocations
47 * - Investigate cache size adjustments
48 */
49
50#include <sys/cdefs.h>
51__FBSDID("$FreeBSD: head/sys/vm/uma_core.c 148371 2005-07-25 00:47:32Z rwatson $");
52
53/* I should really use ktr.. */
54/*
55#define UMA_DEBUG 1
56#define UMA_DEBUG_ALLOC 1
57#define UMA_DEBUG_ALLOC_1 1
58*/
59
--- 2915 unchanged lines hidden (view full) ---
2975 error = ENOMEM;
2976 goto out;
2977 }
2978
2979 LIST_FOREACH(kz, &uma_kegs, uk_link) {
2980 LIST_FOREACH(z, &kz->uk_zones, uz_link) {
2981 bzero(&uth, sizeof(uth));
2982 ZONE_LOCK(z);
2983 strlcpy(uth.uth_name, z->uz_name, UTH_MAX_NAME);
2984 uth.uth_align = kz->uk_align;
2985 uth.uth_pages = kz->uk_pages;
2986 uth.uth_keg_free = kz->uk_free;
2987 uth.uth_size = kz->uk_size;
2988 uth.uth_rsize = kz->uk_rsize;
2989 uth.uth_maxpages = kz->uk_maxpages;
2990 if (kz->uk_ppera > 1)
2991 uth.uth_limit = kz->uk_maxpages /
2992 kz->uk_ppera;
2993 else
2994 uth.uth_limit = kz->uk_maxpages *
2995 kz->uk_ipers;
2996
2997 /*
2998 * A zone is secondary is it is not the first entry
2999 * on the keg's zone list.
3000 */
3001 if ((kz->uk_flags & UMA_ZONE_SECONDARY) &&
3002 (LIST_FIRST(&kz->uk_zones) != z))
3003 uth.uth_zone_flags = UTH_ZONE_SECONDARY;
3004
3005 LIST_FOREACH(bucket, &z->uz_full_bucket, ub_link)
3006 uth.uth_zone_free += bucket->ub_cnt;
3007 uth.uth_allocs = z->uz_allocs;
3008 uth.uth_frees = z->uz_frees;
3009 uth.uth_fails = z->uz_fails;
3010 if (sbuf_bcat(&sbuf, &uth, sizeof(uth)) < 0) {
3011 ZONE_UNLOCK(z);
3012 mtx_unlock(&uma_mtx);
--- 42 unchanged lines hidden ---