uma_core.c (212750) | uma_core.c (213910) |
---|---|
1/*- 2 * Copyright (c) 2002-2005, 2009 Jeffrey Roberson <jeff@FreeBSD.org> 3 * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> 4 * Copyright (c) 2004-2006 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> | 1/*- 2 * Copyright (c) 2002-2005, 2009 Jeffrey Roberson <jeff@FreeBSD.org> 3 * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> 4 * Copyright (c) 2004-2006 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 212750 2010-09-16 16:13:12Z mdf $"); | 51__FBSDID("$FreeBSD: head/sys/vm/uma_core.c 213910 2010-10-16 04:14:45Z lstewart $"); |
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 --- 2740 unchanged lines hidden (view full) --- 2800int 2801uma_zone_get_max(uma_zone_t zone) 2802{ 2803 int nitems; 2804 uma_keg_t keg; 2805 2806 ZONE_LOCK(zone); 2807 keg = zone_first_keg(zone); | 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 --- 2740 unchanged lines hidden (view full) --- 2800int 2801uma_zone_get_max(uma_zone_t zone) 2802{ 2803 int nitems; 2804 uma_keg_t keg; 2805 2806 ZONE_LOCK(zone); 2807 keg = zone_first_keg(zone); |
2808 if (keg->uk_maxpages) 2809 nitems = keg->uk_maxpages * keg->uk_ipers; 2810 else 2811 nitems = 0; | 2808 nitems = keg->uk_maxpages * keg->uk_ipers; |
2812 ZONE_UNLOCK(zone); 2813 2814 return (nitems); 2815} 2816 2817/* See uma.h */ | 2809 ZONE_UNLOCK(zone); 2810 2811 return (nitems); 2812} 2813 2814/* See uma.h */ |
2815int 2816uma_zone_get_cur(uma_zone_t zone) 2817{ 2818 int64_t nitems; 2819 u_int i; 2820 2821 ZONE_LOCK(zone); 2822 nitems = zone->uz_allocs - zone->uz_frees; 2823 CPU_FOREACH(i) { 2824 /* 2825 * See the comment in sysctl_vm_zone_stats() regarding the 2826 * safety of accessing the per-cpu caches. With the zone lock 2827 * held, it is safe, but can potentially result in stale data. 2828 */ 2829 nitems += zone->uz_cpu[i].uc_allocs - 2830 zone->uz_cpu[i].uc_frees; 2831 } 2832 ZONE_UNLOCK(zone); 2833 2834 return (nitems < 0 ? 0 : nitems); 2835} 2836 2837/* See uma.h */ |
|
2818void 2819uma_zone_set_init(uma_zone_t zone, uma_init uminit) 2820{ 2821 uma_keg_t keg; 2822 2823 ZONE_LOCK(zone); 2824 keg = zone_first_keg(zone); 2825 KASSERT(keg->uk_pages == 0, --- 473 unchanged lines hidden --- | 2838void 2839uma_zone_set_init(uma_zone_t zone, uma_init uminit) 2840{ 2841 uma_keg_t keg; 2842 2843 ZONE_LOCK(zone); 2844 keg = zone_first_keg(zone); 2845 KASSERT(keg->uk_pages == 0, --- 473 unchanged lines hidden --- |