Date: Wed, 19 Sep 2018 16:02:34 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338802 - head/sys/vm Message-ID: <201809191602.w8JG2Y0X046254@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Wed Sep 19 16:02:33 2018 New Revision: 338802 URL: https://svnweb.freebsd.org/changeset/base/338802 Log: vm: check for empty kstack cache before locking The current cache logic checks the total number of stacks in the kernel, which even on small boxes significantly exceeds the 128 limit (e.g. an 8-way box with zfs has almost 800 stacks allocated). Stacks are cached earlier for each main thread. As a result the code is rarely executed, but when it is then (on boxes like the above) it always fails. Since there are no provisions made for NUMA and release time is approaching, just do a quick check to avoid acquiring the lock. Approved by: re (kib) Modified: head/sys/vm/vm_glue.c Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Wed Sep 19 15:39:16 2018 (r338801) +++ head/sys/vm/vm_glue.c Wed Sep 19 16:02:33 2018 (r338802) @@ -327,7 +327,7 @@ vm_thread_new(struct thread *td, int pages) else if (pages > KSTACK_MAX_PAGES) pages = KSTACK_MAX_PAGES; - if (pages == kstack_pages) { + if (pages == kstack_pages && kstack_cache != NULL) { mtx_lock(&kstack_cache_mtx); if (kstack_cache != NULL) { ks_ce = kstack_cache;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809191602.w8JG2Y0X046254>