uma_core.c (295221) | uma_core.c (295222) |
---|---|
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 295221 2016-02-03 22:02:36Z glebius $"); | 51__FBSDID("$FreeBSD: head/sys/vm/uma_core.c 295222 2016-02-03 23:30:17Z glebius $"); |
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 --- 13 unchanged lines hidden (view full) --- 73#include <sys/sysctl.h> 74#include <sys/mutex.h> 75#include <sys/proc.h> 76#include <sys/random.h> 77#include <sys/rwlock.h> 78#include <sys/sbuf.h> 79#include <sys/sched.h> 80#include <sys/smp.h> | 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 --- 13 unchanged lines hidden (view full) --- 73#include <sys/sysctl.h> 74#include <sys/mutex.h> 75#include <sys/proc.h> 76#include <sys/random.h> 77#include <sys/rwlock.h> 78#include <sys/sbuf.h> 79#include <sys/sched.h> 80#include <sys/smp.h> |
81#include <sys/taskqueue.h> |
|
81#include <sys/vmmeter.h> 82 83#include <vm/vm.h> 84#include <vm/vm_object.h> 85#include <vm/vm_page.h> 86#include <vm/vm_pageout.h> 87#include <vm/vm_param.h> 88#include <vm/vm_map.h> --- 345 unchanged lines hidden (view full) --- 434 435 if (ratecheck(&zone->uz_ratecheck, &warninterval)) 436 printf("[zone: %s] %s\n", zone->uz_name, zone->uz_warning); 437} 438 439static inline void 440zone_maxaction(uma_zone_t zone) 441{ | 82#include <sys/vmmeter.h> 83 84#include <vm/vm.h> 85#include <vm/vm_object.h> 86#include <vm/vm_page.h> 87#include <vm/vm_pageout.h> 88#include <vm/vm_param.h> 89#include <vm/vm_map.h> --- 345 unchanged lines hidden (view full) --- 435 436 if (ratecheck(&zone->uz_ratecheck, &warninterval)) 437 printf("[zone: %s] %s\n", zone->uz_name, zone->uz_warning); 438} 439 440static inline void 441zone_maxaction(uma_zone_t zone) 442{ |
442 if (zone->uz_maxaction) 443 (*zone->uz_maxaction)(zone); | 443 444 if (zone->uz_maxaction.ta_func != NULL) 445 taskqueue_enqueue(taskqueue_thread, &zone->uz_maxaction); |
444} 445 446static void 447zone_foreach_keg(uma_zone_t zone, void (*kegfn)(uma_keg_t)) 448{ 449 uma_klink_t klink; 450 451 LIST_FOREACH(klink, &zone->uz_kegs, kl_link) --- 1133 unchanged lines hidden (view full) --- 1585 zone->uz_frees = 0; 1586 zone->uz_fails = 0; 1587 zone->uz_sleeps = 0; 1588 zone->uz_count = 0; 1589 zone->uz_count_min = 0; 1590 zone->uz_flags = 0; 1591 zone->uz_warning = NULL; 1592 timevalclear(&zone->uz_ratecheck); | 446} 447 448static void 449zone_foreach_keg(uma_zone_t zone, void (*kegfn)(uma_keg_t)) 450{ 451 uma_klink_t klink; 452 453 LIST_FOREACH(klink, &zone->uz_kegs, kl_link) --- 1133 unchanged lines hidden (view full) --- 1587 zone->uz_frees = 0; 1588 zone->uz_fails = 0; 1589 zone->uz_sleeps = 0; 1590 zone->uz_count = 0; 1591 zone->uz_count_min = 0; 1592 zone->uz_flags = 0; 1593 zone->uz_warning = NULL; 1594 timevalclear(&zone->uz_ratecheck); |
1593 zone->uz_maxaction = NULL; | |
1594 keg = arg->keg; 1595 1596 ZONE_LOCK_INIT(zone, (arg->flags & UMA_ZONE_MTXCLASS)); 1597 1598 /* 1599 * This is a pure cache zone, no kegs. 1600 */ 1601 if (arg->import) { --- 1420 unchanged lines hidden (view full) --- 3022} 3023 3024/* See uma.h */ 3025void 3026uma_zone_set_maxaction(uma_zone_t zone, uma_maxaction_t maxaction) 3027{ 3028 3029 ZONE_LOCK(zone); | 1595 keg = arg->keg; 1596 1597 ZONE_LOCK_INIT(zone, (arg->flags & UMA_ZONE_MTXCLASS)); 1598 1599 /* 1600 * This is a pure cache zone, no kegs. 1601 */ 1602 if (arg->import) { --- 1420 unchanged lines hidden (view full) --- 3023} 3024 3025/* See uma.h */ 3026void 3027uma_zone_set_maxaction(uma_zone_t zone, uma_maxaction_t maxaction) 3028{ 3029 3030 ZONE_LOCK(zone); |
3030 zone->uz_maxaction = maxaction; | 3031 TASK_INIT(&zone->uz_maxaction, 0, (task_fn_t *)maxaction, zone); |
3031 ZONE_UNLOCK(zone); 3032} 3033 3034/* See uma.h */ 3035int 3036uma_zone_get_cur(uma_zone_t zone) 3037{ 3038 int64_t nitems; --- 730 unchanged lines hidden --- | 3032 ZONE_UNLOCK(zone); 3033} 3034 3035/* See uma.h */ 3036int 3037uma_zone_get_cur(uma_zone_t zone) 3038{ 3039 int64_t nitems; --- 730 unchanged lines hidden --- |