Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170916032
D23824.id68870.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23824.id68870.diff
View Options
Index: head/sys/vm/uma_core.c
===================================================================
--- head/sys/vm/uma_core.c
+++ head/sys/vm/uma_core.c
@@ -564,26 +564,29 @@
}
/*
- * Search for the domain with the least cached items and return it, breaking
- * ties with a preferred domain by returning it.
+ * Search for the domain with the least cached items and return it if it
+ * is out of balance with the preferred domain.
*/
static __noinline int
zone_domain_lowest(uma_zone_t zone, int pref)
{
- long least, nitems;
+ long least, nitems, prefitems;
int domain;
int i;
- least = LONG_MAX;
+ prefitems = least = LONG_MAX;
domain = 0;
for (i = 0; i < vm_ndomains; i++) {
nitems = ZDOM_GET(zone, i)->uzd_nitems;
if (nitems < least) {
domain = i;
least = nitems;
- } else if (nitems == least && (i == pref || domain == pref))
- domain = pref;
+ }
+ if (domain == pref)
+ prefitems = nitems;
}
+ if (prefitems < least * 2)
+ return (pref);
return (domain);
}
@@ -4102,8 +4105,11 @@
bucket = &cache->uc_crossbucket;
} else
#endif
- if (bucket->ucb_cnt >= bucket->ucb_entries)
- bucket = &cache->uc_freebucket;
+ if (bucket->ucb_cnt == bucket->ucb_entries &&
+ cache->uc_freebucket.ucb_cnt <
+ cache->uc_freebucket.ucb_entries)
+ cache_bucket_swap(&cache->uc_freebucket,
+ &cache->uc_allocbucket);
if (__predict_true(bucket->ucb_cnt < bucket->ucb_entries)) {
cache_bucket_push(cache, bucket, item);
critical_exit();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Sep 8, 1:45 PM (10 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38519159
Default Alt Text
D23824.id68870.diff (1 KB)
Attached To
Mode
D23824: A pair of UMA optimizations to improve cache behavior.
Attached
Detach File
Event Timeline
Log In to Comment