subr_vmem.c (280957) | subr_vmem.c (281026) |
---|---|
1/*- 2 * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, 3 * Copyright (c) 2013 EMC Corp. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 25 unchanged lines hidden (view full) --- 34/* 35 * reference: 36 * - Magazines and Vmem: Extending the Slab Allocator 37 * to Many CPUs and Arbitrary Resources 38 * http://www.usenix.org/event/usenix01/bonwick.html 39 */ 40 41#include <sys/cdefs.h> | 1/*- 2 * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi, 3 * Copyright (c) 2013 EMC Corp. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 25 unchanged lines hidden (view full) --- 34/* 35 * reference: 36 * - Magazines and Vmem: Extending the Slab Allocator 37 * to Many CPUs and Arbitrary Resources 38 * http://www.usenix.org/event/usenix01/bonwick.html 39 */ 40 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: head/sys/kern/subr_vmem.c 280957 2015-04-01 12:42:26Z rstone $"); | 42__FBSDID("$FreeBSD: head/sys/kern/subr_vmem.c 281026 2015-04-03 14:45:48Z mav $"); |
43 44#include "opt_ddb.h" 45 46#include <sys/param.h> 47#include <sys/systm.h> 48#include <sys/kernel.h> 49#include <sys/queue.h> 50#include <sys/callout.h> --- 1264 unchanged lines hidden (view full) --- 1315} 1316 1317/* 1318 * vmem_size: information about arenas size 1319 */ 1320vmem_size_t 1321vmem_size(vmem_t *vm, int typemask) 1322{ | 43 44#include "opt_ddb.h" 45 46#include <sys/param.h> 47#include <sys/systm.h> 48#include <sys/kernel.h> 49#include <sys/queue.h> 50#include <sys/callout.h> --- 1264 unchanged lines hidden (view full) --- 1315} 1316 1317/* 1318 * vmem_size: information about arenas size 1319 */ 1320vmem_size_t 1321vmem_size(vmem_t *vm, int typemask) 1322{ |
1323 int i; |
|
1323 1324 switch (typemask) { 1325 case VMEM_ALLOC: 1326 return vm->vm_inuse; 1327 case VMEM_FREE: 1328 return vm->vm_size - vm->vm_inuse; 1329 case VMEM_FREE|VMEM_ALLOC: 1330 return vm->vm_size; | 1324 1325 switch (typemask) { 1326 case VMEM_ALLOC: 1327 return vm->vm_inuse; 1328 case VMEM_FREE: 1329 return vm->vm_size - vm->vm_inuse; 1330 case VMEM_FREE|VMEM_ALLOC: 1331 return vm->vm_size; |
1332 case VMEM_MAXFREE: 1333 for (i = VMEM_MAXORDER - 1; i >= 0; i--) { 1334 if (LIST_EMPTY(&vm->vm_freelist[i])) 1335 continue; 1336 return ((vmem_size_t)ORDER2SIZE(i) << 1337 vm->vm_quantum_shift); 1338 } 1339 return (0); |
|
1331 default: 1332 panic("vmem_size"); 1333 } 1334} 1335 1336/* ---- debug */ 1337 1338#if defined(DDB) || defined(DIAGNOSTIC) --- 238 unchanged lines hidden --- | 1340 default: 1341 panic("vmem_size"); 1342 } 1343} 1344 1345/* ---- debug */ 1346 1347#if defined(DDB) || defined(DIAGNOSTIC) --- 238 unchanged lines hidden --- |