Date: Fri, 2 Oct 2020 19:04:09 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366378 - head/sys/vm Message-ID: <202010021904.092J496V049174@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Fri Oct 2 19:04:09 2020 New Revision: 366378 URL: https://svnweb.freebsd.org/changeset/base/366378 Log: uma: Use LIFO for non-SMR bucket caches When SMR was introduced, zone_put_bucket() was changed to always place full buckets at the end of the queue. However, it is generally preferable to use recently used buckets since their items are more likely to be resident in cache. So, for buckets that have no constraint on item reuse, use a last-in-first-out ordering as we did before. Reviewed by: rlibby Tested by: dhw, glebius Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26426 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Fri Oct 2 19:03:42 2020 (r366377) +++ head/sys/vm/uma_core.c Fri Oct 2 19:04:09 2020 (r366378) @@ -733,7 +733,15 @@ zone_put_bucket(uma_zone_t zone, int domain, uma_bucke zone_domain_imax_set(zdom, zdom->uzd_nitems); if (STAILQ_EMPTY(&zdom->uzd_buckets)) zdom->uzd_seq = bucket->ub_seq; - STAILQ_INSERT_TAIL(&zdom->uzd_buckets, bucket, ub_link); + + /* + * Try to promote reuse of recently used items. For items + * protected by SMR, try to defer reuse to minimize polling. + */ + if (bucket->ub_seq == SMR_SEQ_INVALID) + STAILQ_INSERT_HEAD(&zdom->uzd_buckets, bucket, ub_link); + else + STAILQ_INSERT_TAIL(&zdom->uzd_buckets, bucket, ub_link); ZDOM_UNLOCK(zdom); return; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010021904.092J496V049174>