uma: remove UMA_ZFLAG_CACHEONLY flag

UMA_ZFLAG_CACHEONLY was essentially the same thing as UMA_ZONE_VM, but
with a more confusing name.  Remove the flag, make UMA_ZONE_VM an
inherit flag, and replace all references.

Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D23516
This commit is contained in:
Ryan Libby 2020-02-06 08:32:25 +00:00
parent f99e4a2d11
commit bae55c4aec
3 changed files with 11 additions and 19 deletions

View File

@ -288,8 +288,8 @@ uma_zone_t uma_zcache_create(char *name, int size, uma_ctor ctor, uma_dtor dtor,
*/
#define UMA_ZONE_INHERIT \
(UMA_ZONE_NOTOUCH | UMA_ZONE_MALLOC | UMA_ZONE_NOFREE | \
UMA_ZONE_NOTPAGE | UMA_ZONE_PCPU | UMA_ZONE_FIRSTTOUCH | \
UMA_ZONE_ROUNDROBIN)
UMA_ZONE_VM | UMA_ZONE_NOTPAGE | UMA_ZONE_PCPU | \
UMA_ZONE_FIRSTTOUCH | UMA_ZONE_ROUNDROBIN)
/* Definitions for align */
#define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */

View File

@ -493,7 +493,7 @@ bucket_alloc(uma_zone_t zone, void *udata, int flags)
return (NULL);
udata = (void *)((uintptr_t)udata | UMA_ZFLAG_BUCKET);
}
if ((uintptr_t)udata & UMA_ZFLAG_CACHEONLY)
if (((uintptr_t)udata & UMA_ZONE_VM) != 0)
flags |= M_NOVM;
ubz = bucket_zone_lookup(zone->uz_bucket_size);
if (ubz->ubz_zone == zone && (ubz + 1)->ubz_entries != 0)
@ -1897,8 +1897,7 @@ keg_layout(uma_keg_t keg)
("%s: cannot configure for PCPU: keg=%s, size=%u, flags=0x%b",
__func__, keg->uk_name, keg->uk_size, keg->uk_flags,
PRINT_UMA_ZFLAGS));
KASSERT((keg->uk_flags &
(UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY)) == 0 ||
KASSERT((keg->uk_flags & (UMA_ZFLAG_INTERNAL | UMA_ZONE_VM)) == 0 ||
(keg->uk_flags & (UMA_ZONE_NOTOUCH | UMA_ZONE_PCPU)) == 0,
("%s: incompatible flags 0x%b", __func__, keg->uk_flags,
PRINT_UMA_ZFLAGS));
@ -1947,16 +1946,16 @@ keg_layout(uma_keg_t keg)
/*
* We can't do OFFPAGE if we're internal or if we've been
* asked to not go to the VM for buckets. If we do this we
* may end up going to the VM for slabs which we do not
* want to do if we're UMA_ZFLAG_CACHEONLY as a result
* of UMA_ZONE_VM, which clearly forbids it. In those cases,
* evaluate a pseudo-format called INTERNAL which has an inline
* slab header and one extra page to guarantee that it fits.
* may end up going to the VM for slabs which we do not want
* to do if we're UMA_ZONE_VM, which clearly forbids it.
* In those cases, evaluate a pseudo-format called INTERNAL
* which has an inline slab header and one extra page to
* guarantee that it fits.
*
* Otherwise, see if using an OFFPAGE slab will improve our
* efficiency.
*/
if ((keg->uk_flags & (UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY)) != 0)
if ((keg->uk_flags & (UMA_ZFLAG_INTERNAL | UMA_ZONE_VM)) != 0)
fmts[nfmt++] = UMA_ZFLAG_INTERNAL;
else
fmts[nfmt++] = UMA_ZFLAG_OFFPAGE;
@ -2073,9 +2072,6 @@ keg_ctor(void *mem, int size, void *udata, int flags)
zone = arg->zone;
keg->uk_name = zone->uz_name;
if (arg->flags & UMA_ZONE_VM)
keg->uk_flags |= UMA_ZFLAG_CACHEONLY;
if (arg->flags & UMA_ZONE_ZINIT)
keg->uk_init = zero_init;
@ -2461,8 +2457,6 @@ zone_ctor(void *mem, int size, void *udata, int flags)
if (arg->import) {
KASSERT((arg->flags & UMA_ZFLAG_CACHE) != 0,
("zone_ctor: Import specified for non-cache zone."));
if (arg->flags & UMA_ZONE_VM)
arg->flags |= UMA_ZFLAG_CACHEONLY;
zone->uz_flags = arg->flags;
zone->uz_size = arg->size;
zone->uz_import = arg->import;

View File

@ -166,14 +166,12 @@
#define UMA_ZFLAG_BUCKET 0x10000000 /* Bucket zone. */
#define UMA_ZFLAG_INTERNAL 0x20000000 /* No offpage no PCPU. */
#define UMA_ZFLAG_TRASH 0x40000000 /* Add trash ctor/dtor. */
#define UMA_ZFLAG_CACHEONLY 0x80000000 /* Don't ask VM for buckets. */
#define UMA_ZFLAG_INHERIT \
(UMA_ZFLAG_OFFPAGE | UMA_ZFLAG_HASH | UMA_ZFLAG_VTOSLAB | \
UMA_ZFLAG_BUCKET | UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY)
UMA_ZFLAG_BUCKET | UMA_ZFLAG_INTERNAL)
#define PRINT_UMA_ZFLAGS "\20" \
"\40CACHEONLY" \
"\37TRASH" \
"\36INTERNAL" \
"\35BUCKET" \