Deleted Added
full compact
uma_core.c (327404) uma_core.c (327785)
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: stable/11/sys/vm/uma_core.c 327404 2017-12-31 03:06:29Z mjg $");
51__FBSDID("$FreeBSD: stable/11/sys/vm/uma_core.c 327785 2018-01-10 20:39:26Z markj $");
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

--- 1062 unchanged lines hidden (view full) ---

1122 uma_keg_t keg;
1123
1124 TAILQ_INIT(&alloctail);
1125 keg = zone_first_keg(zone);
1126
1127 npages = howmany(bytes, PAGE_SIZE);
1128 while (npages > 0) {
1129 p = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT |
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

--- 1062 unchanged lines hidden (view full) ---

1122 uma_keg_t keg;
1123
1124 TAILQ_INIT(&alloctail);
1125 keg = zone_first_keg(zone);
1126
1127 npages = howmany(bytes, PAGE_SIZE);
1128 while (npages > 0) {
1129 p = vm_page_alloc(NULL, 0, VM_ALLOC_INTERRUPT |
1130 VM_ALLOC_WIRED | VM_ALLOC_NOOBJ);
1130 VM_ALLOC_WIRED | VM_ALLOC_NOOBJ |
1131 ((wait & M_WAITOK) != 0 ? VM_ALLOC_WAITOK :
1132 VM_ALLOC_NOWAIT));
1131 if (p != NULL) {
1132 /*
1133 * Since the page does not belong to an object, its
1134 * listq is unused.
1135 */
1136 TAILQ_INSERT_TAIL(&alloctail, p, listq);
1137 npages--;
1138 continue;
1139 }
1133 if (p != NULL) {
1134 /*
1135 * Since the page does not belong to an object, its
1136 * listq is unused.
1137 */
1138 TAILQ_INSERT_TAIL(&alloctail, p, listq);
1139 npages--;
1140 continue;
1141 }
1140 if (wait & M_WAITOK) {
1141 VM_WAIT;
1142 continue;
1143 }
1144
1145 /*
1146 * Page allocation failed, free intermediate pages and
1147 * exit.
1148 */
1149 TAILQ_FOREACH_SAFE(p, &alloctail, listq, p_next) {
1150 vm_page_unwire(p, PQ_NONE);
1151 vm_page_free(p);
1152 }

--- 924 unchanged lines hidden (view full) ---

2077uma_zdestroy(uma_zone_t zone)
2078{
2079
2080 sx_slock(&uma_drain_lock);
2081 zone_free_item(zones, zone, NULL, SKIP_NONE);
2082 sx_sunlock(&uma_drain_lock);
2083}
2084
1142 /*
1143 * Page allocation failed, free intermediate pages and
1144 * exit.
1145 */
1146 TAILQ_FOREACH_SAFE(p, &alloctail, listq, p_next) {
1147 vm_page_unwire(p, PQ_NONE);
1148 vm_page_free(p);
1149 }

--- 924 unchanged lines hidden (view full) ---

2074uma_zdestroy(uma_zone_t zone)
2075{
2076
2077 sx_slock(&uma_drain_lock);
2078 zone_free_item(zones, zone, NULL, SKIP_NONE);
2079 sx_sunlock(&uma_drain_lock);
2080}
2081
2082void
2083uma_zwait(uma_zone_t zone)
2084{
2085 void *item;
2086
2087 item = uma_zalloc_arg(zone, NULL, M_WAITOK);
2088 uma_zfree(zone, item);
2089}
2090
2085/* See uma.h */
2086void *
2087uma_zalloc_arg(uma_zone_t zone, void *udata, int flags)
2088{
2089 void *item;
2090 uma_cache_t cache;
2091 uma_bucket_t bucket;
2092 int lockfail;

--- 1597 unchanged lines hidden ---
2091/* See uma.h */
2092void *
2093uma_zalloc_arg(uma_zone_t zone, void *udata, int flags)
2094{
2095 void *item;
2096 uma_cache_t cache;
2097 uma_bucket_t bucket;
2098 int lockfail;

--- 1597 unchanged lines hidden ---