ZONE(9): Disable UMA_ZONE_NUMA

There is no NUMA support in RTEMS currently.
This commit is contained in:
Sebastian Huber 2018-10-23 12:11:54 +02:00
parent 1aeb727bd2
commit dbb24072db
3 changed files with 31 additions and 2 deletions

View File

@ -281,10 +281,12 @@ uma_zone_t uma_zcache_create(char *name, int size, uma_ctor ctor, uma_dtor dtor,
#define UMA_ZONE_PCPU 0x8000 /*
* Allocates mp_maxid + 1 slabs of PAGE_SIZE
*/
#ifndef __rtems__
#define UMA_ZONE_NUMA 0x10000 /*
* NUMA aware Zone. Implements a best
* effort first-touch policy.
*/
#endif /* __rtems__ */
#define UMA_ZONE_NOBUCKETCACHE 0x20000 /*
* Don't cache full buckets. Limit
* UMA to per-cpu state.

View File

@ -404,7 +404,11 @@ bucket_init(void)
size += sizeof(void *) * ubz->ubz_entries;
ubz->ubz_zone = uma_zcreate(ubz->ubz_name, size,
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
#ifndef __rtems__
UMA_ZONE_MTXCLASS | UMA_ZFLAG_BUCKET | UMA_ZONE_NUMA);
#else /* __rtems__ */
UMA_ZONE_MTXCLASS | UMA_ZFLAG_BUCKET);
#endif /* __rtems__ */
}
}
@ -819,9 +823,11 @@ cache_drain_safe_cpu(uma_zone_t zone)
b1 = b2 = NULL;
ZONE_LOCK(zone);
critical_enter();
#ifndef __rtems__
if (zone->uz_flags & UMA_ZONE_NUMA)
domain = PCPU_GET(domain);
else
#endif /* __rtems__ */
domain = 0;
cache = &zone->uz_cpu[curcpu];
if (cache->uc_allocbucket) {
@ -1787,8 +1793,10 @@ zone_ctor(void *mem, int size, void *udata, int flags)
zone->uz_count_min = 0;
zone->uz_flags = 0;
zone->uz_warning = NULL;
#ifndef __rtems__
/* The domain structures follow the cpu structures. */
zone->uz_domain = (struct uma_zone_domain *)&zone->uz_cpu[mp_ncpus];
#endif /* __rtems__ */
timevalclear(&zone->uz_ratecheck);
keg = arg->keg;
@ -2072,8 +2080,7 @@ uma_startup(void *mem, int npages)
ksize = sizeof(struct uma_keg) +
(sizeof(struct uma_domain) * vm_ndomains);
zsize = sizeof(struct uma_zone) +
(sizeof(struct uma_cache) * (mp_maxid + 1)) +
(sizeof(struct uma_zone_domain) * vm_ndomains);
(sizeof(struct uma_cache) * (mp_maxid + 1));
size = 2 * roundup(zsize, CACHE_LINE_SIZE) +
roundup(ksize, CACHE_LINE_SIZE);
#endif /* __rtems__ */
@ -2603,9 +2610,11 @@ zalloc_start:
if (bucket != NULL)
bucket_free(zone, bucket, udata);
#ifndef __rtems__
if (zone->uz_flags & UMA_ZONE_NUMA)
domain = PCPU_GET(domain);
else
#endif /* __rtems__ */
domain = UMA_ANYDOMAIN;
/* Short-circuit for zones without buckets and low memory. */
@ -2682,9 +2691,13 @@ zalloc_start:
* initialized bucket to make this less likely or claim
* the memory directly.
*/
#ifndef __rtems__
if (cache->uc_allocbucket != NULL ||
(zone->uz_flags & UMA_ZONE_NUMA &&
domain != PCPU_GET(domain)))
#else /* __rtems__ */
if (cache->uc_allocbucket != NULL)
#endif /* __rtems__ */
LIST_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link);
else
cache->uc_allocbucket = bucket;
@ -3162,7 +3175,11 @@ uma_zfree_arg(uma_zone_t zone, void *item, void *udata)
uma_cache_t cache;
uma_bucket_t bucket;
uma_zone_domain_t zdom;
#ifndef __rtems__
int cpu, domain, lockfail;
#else /* __rtems__ */
int cpu, lockfail;
#endif /* __rtems__ */
#ifdef INVARIANTS
bool skipdbg;
#endif
@ -3279,10 +3296,12 @@ zfree_start:
/* We are no longer associated with this CPU. */
critical_exit();
#ifndef __rtems__
if ((zone->uz_flags & UMA_ZONE_NUMA) != 0)
domain = PCPU_GET(domain);
else
domain = 0;
#endif /* __rtems__ */
zdom = &zone->uz_domain[0];
/* Can we throw this on the zone full list? */
@ -3317,9 +3336,13 @@ zfree_start:
critical_enter();
cpu = curcpu;
cache = &zone->uz_cpu[cpu];
#ifndef __rtems__
if (cache->uc_freebucket == NULL &&
((zone->uz_flags & UMA_ZONE_NUMA) == 0 ||
domain == PCPU_GET(domain))) {
#else /* __rtems__ */
if (cache->uc_freebucket == NULL) {
#endif /* __rtems__ */
cache->uc_freebucket = bucket;
goto zfree_start;
}

View File

@ -321,7 +321,11 @@ struct uma_zone {
/* Offset 0, used in alloc/free fast/medium fast path and const. */
struct mtx *uz_lockptr;
const char *uz_name; /* Text name of the zone */
#ifndef __rtems__
struct uma_zone_domain *uz_domain; /* per-domain buckets */
#else /* __rtems__ */
struct uma_zone_domain uz_domain[1]; /* per-domain buckets */
#endif /* __rtems__ */
uint32_t uz_flags; /* Flags inherited from kegs */
uint32_t uz_size; /* Size inherited from kegs */
uma_ctor uz_ctor; /* Constructor for each allocation */