uma_core.c (301176) | uma_core.c (302372) |
---|---|
1/*- 2 * Copyright (c) 2002-2005, 2009, 2013 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, 2013 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 301176 2016-06-01 22:31:35Z markj $"); | 51__FBSDID("$FreeBSD: head/sys/vm/uma_core.c 302372 2016-07-06 14:09:49Z nwhitehorn $"); |
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 --- 1162 unchanged lines hidden (view full) --- 1222keg_small_init(uma_keg_t keg) 1223{ 1224 u_int rsize; 1225 u_int memused; 1226 u_int wastedspace; 1227 u_int shsize; 1228 1229 if (keg->uk_flags & UMA_ZONE_PCPU) { | 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 --- 1162 unchanged lines hidden (view full) --- 1222keg_small_init(uma_keg_t keg) 1223{ 1224 u_int rsize; 1225 u_int memused; 1226 u_int wastedspace; 1227 u_int shsize; 1228 1229 if (keg->uk_flags & UMA_ZONE_PCPU) { |
1230 u_int ncpus = mp_ncpus ? mp_ncpus : MAXCPU; | 1230 u_int ncpus = (mp_maxid + 1) ? (mp_maxid + 1) : MAXCPU; |
1231 1232 keg->uk_slabsize = sizeof(struct pcpu); 1233 keg->uk_ppera = howmany(ncpus * sizeof(struct pcpu), 1234 PAGE_SIZE); 1235 } else { 1236 keg->uk_slabsize = UMA_SLAB_SIZE; 1237 keg->uk_ppera = 1; 1238 } --- 2021 unchanged lines hidden (view full) --- 3260 3261 page_free(slab->us_data, slab->us_size, slab->us_flags); 3262 zone_free_item(slabzone, slab, NULL, SKIP_NONE); 3263} 3264 3265static void 3266uma_zero_item(void *item, uma_zone_t zone) 3267{ | 1231 1232 keg->uk_slabsize = sizeof(struct pcpu); 1233 keg->uk_ppera = howmany(ncpus * sizeof(struct pcpu), 1234 PAGE_SIZE); 1235 } else { 1236 keg->uk_slabsize = UMA_SLAB_SIZE; 1237 keg->uk_ppera = 1; 1238 } --- 2021 unchanged lines hidden (view full) --- 3260 3261 page_free(slab->us_data, slab->us_size, slab->us_flags); 3262 zone_free_item(slabzone, slab, NULL, SKIP_NONE); 3263} 3264 3265static void 3266uma_zero_item(void *item, uma_zone_t zone) 3267{ |
3268 int i; |
|
3268 3269 if (zone->uz_flags & UMA_ZONE_PCPU) { | 3269 3270 if (zone->uz_flags & UMA_ZONE_PCPU) { |
3270 for (int i = 0; i < mp_ncpus; i++) | 3271 CPU_FOREACH(i) |
3271 bzero(zpcpu_get_cpu(item, i), zone->uz_size); 3272 } else 3273 bzero(item, zone->uz_size); 3274} 3275 3276void 3277uma_print_stats(void) 3278{ --- 406 unchanged lines hidden --- | 3272 bzero(zpcpu_get_cpu(item, i), zone->uz_size); 3273 } else 3274 bzero(item, zone->uz_size); 3275} 3276 3277void 3278uma_print_stats(void) 3279{ --- 406 unchanged lines hidden --- |