svn commit: r339963 - stable/12/sys/vm
Gleb Smirnoff
glebius at FreeBSD.org
Wed Oct 31 18:01:03 UTC 2018
Author: glebius
Date: Wed Oct 31 18:01:02 2018
New Revision: 339963
URL: https://svnweb.freebsd.org/changeset/base/339963
Log:
MFhead r339596:
If we lost race or were migrated during bucket allocation for the per-CPU
cache, then we put new bucket on generic bucket cache. However, code didn't
honor UMA_ZONE_NOBUCKETCACHE flag, so potentially we could start a cache
on a zone that clearly forbids that. Fix this.
Approved by: re (gjb)
Modified:
stable/12/sys/vm/uma_core.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/vm/uma_core.c
==============================================================================
--- stable/12/sys/vm/uma_core.c Wed Oct 31 17:47:08 2018 (r339962)
+++ stable/12/sys/vm/uma_core.c Wed Oct 31 18:01:02 2018 (r339963)
@@ -2410,6 +2410,7 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags
* the current cache; when we re-acquire the critical section, we
* must detect and handle migration if it has occurred.
*/
+zalloc_restart:
critical_enter();
cpu = curcpu;
cache = &zone->uz_cpu[cpu];
@@ -2551,12 +2552,18 @@ zalloc_start:
* initialized bucket to make this less likely or claim
* the memory directly.
*/
- if (cache->uc_allocbucket != NULL ||
- (zone->uz_flags & UMA_ZONE_NUMA &&
- domain != PCPU_GET(domain)))
- LIST_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link);
- else
+ if (cache->uc_allocbucket == NULL &&
+ ((zone->uz_flags & UMA_ZONE_NUMA) == 0 ||
+ domain == PCPU_GET(domain))) {
cache->uc_allocbucket = bucket;
+ } else if ((zone->uz_flags & UMA_ZONE_NOBUCKETCACHE) != 0) {
+ critical_exit();
+ ZONE_UNLOCK(zone);
+ bucket_drain(zone, bucket);
+ bucket_free(zone, bucket, udata);
+ goto zalloc_restart;
+ } else
+ LIST_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link);
ZONE_UNLOCK(zone);
goto zalloc_start;
}
More information about the svn-src-stable-12
mailing list