From nobody Mon Jul 25 13:54:53 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ls1kj3M4Wz4XYCZ; Mon, 25 Jul 2022 13:54:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ls1kj2p19z4LSW; Mon, 25 Jul 2022 13:54:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658757293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XrEjN7nAKgvMmP6MrcAcFP8vBeac/bLKfSzLBssRlcI=; b=E7axgCl8KWEIy1GerK/fW915nA4fGcHGisJvwVXkjnohvdBRbodWR2ULYg5bx2iPlLKk6a oxevHqVE5pmuse2PIHcR1pqussyfn9FbL/s5fR0Zzg5nZ3N6byF6kBfIZJv4wMdsq1KU7R qg8kStUeLjJgIiay9cgytICLzSrtIt1oiTZlmvNfCb5agOh9kB+CYtPm9paQqZ0o+/IyPG CQbxPm0D4ccIzm6B8B7YDC9FyXHECSqSl1Q790dKuNKASupqIf58mJtL0fsyuah+nTSE7A EPo43L6XTpKXvKRKzG7IIkyJ8e7zivHHqzGAXS7MARLswhomOHbAEqsowT9o0Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ls1kj1rsJz108N; Mon, 25 Jul 2022 13:54:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26PDsrec019767; Mon, 25 Jul 2022 13:54:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26PDsrBK019766; Mon, 25 Jul 2022 13:54:53 GMT (envelope-from git) Date: Mon, 25 Jul 2022 13:54:53 GMT Message-Id: <202207251354.26PDsrBK019766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: adc4dcada3d7 - stable/13 - uma: Use a taskqueue to execute uma_timeout() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: adc4dcada3d7a975bb7d1745c2664a85d1b06da2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658757293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XrEjN7nAKgvMmP6MrcAcFP8vBeac/bLKfSzLBssRlcI=; b=MKafMmyedXnlxDVnKZlnT+rEH+bT47yNuyyoHe5V2vqQySlZk1U0gW40KsuoYe1Qe9I54i zM6XvACqxzqnEcTsVcvCskxL9LUN5Ulf4GqUUzrINugwwUcKgxczEghFF2PhCz2eZE8iBT ACWcfP0m1Ez7+AFw+Za230RmFvd6lmSU/mSBl8QAkNXkzuYJ5Y0LyNZGgSfu/xX9ALNgrS ddTe49CJQdxhUilQ6/AhLfqCYG/FqUOy+00g50M6p31RaFJ1H4sDcefgw3QnoznaccjjQO snw1EAVKZxIu9M1+txPpwKPTAJT/KRXRMQAPH0+2HsXE/d3aOV8u2mHcb9os0A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658757293; a=rsa-sha256; cv=none; b=TAyniwFcbZfE1MFEXOGtx1flDjbpqA6n1VifB4OC+PAUc7i8RPv8Hcq+7ZEqsWsrlpcTGv Jz5ek7Blpod+rwvWCReLyg3Q8aT6kI3Ia/4DMOgiLPmc8DLUmxfjFLLTOf3PlSAn205RPc 20hNNU8WHPLkiB6jLN4Y3iXimV05ZYFquhcSjQPcBIj6qcRMUncGC2nfmM019/a3gMIYjM MQtiapW1GOQ+gEgqfl2oQHAPEDzamXqcG9wJst8QDETku1oyJnxIs/ommu+yQcjQ10IIlU Nmd4rS6IvpJubX+YWtb+K238za/8iqQxpsCCky6owfFW85TS/VYf4s91KZPH9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=adc4dcada3d7a975bb7d1745c2664a85d1b06da2 commit adc4dcada3d7a975bb7d1745c2664a85d1b06da2 Author: Mark Johnston AuthorDate: 2022-07-11 19:45:36 +0000 Commit: Mark Johnston CommitDate: 2022-07-25 13:43:44 +0000 uma: Use a taskqueue to execute uma_timeout() uma_timeout() has several responsibilities; it visits every UMA zone and as of recently will drain underutilized caches, so is rather expensive (>1ms in some cases). Currently it is executed by softclock threads and so will preempt most other CPU activity. None of this work requires a high scheduling priority, though, so defer it to a taskqueue so as to avoid stalling higher-priority work. Reviewed by: rlibby, alc, mav, kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 93cd28ea82bb7b5e9489c8febfe1ae7ed2c044fb) --- sys/vm/uma_core.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 754e9d9ff15e..39946849d9ec 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -206,7 +206,7 @@ static enum { * This is the handle used to schedule events that need to happen * outside of the allocation fast path. */ -static struct callout uma_callout; +static struct timeout_task uma_timeout_task; #define UMA_TIMEOUT 20 /* Seconds for callout interval. */ /* @@ -310,7 +310,7 @@ static void zone_timeout(uma_zone_t zone, void *); static int hash_alloc(struct uma_hash *, u_int); static int hash_expand(struct uma_hash *, struct uma_hash *); static void hash_free(struct uma_hash *hash); -static void uma_timeout(void *); +static void uma_timeout(void *, int); static void uma_shutdown(void); static void *zone_alloc_item(uma_zone_t, void *, int, int); static void zone_free_item(uma_zone_t, void *, void *, enum zfreeskip); @@ -1052,13 +1052,14 @@ zone_maxaction(uma_zone_t zone) * Nothing */ static void -uma_timeout(void *unused) +uma_timeout(void *unused __unused, int pending __unused) { bucket_enable(); zone_foreach(zone_timeout, NULL); /* Reschedule this event */ - callout_reset(&uma_callout, UMA_TIMEOUT * hz, uma_timeout, NULL); + taskqueue_enqueue_timeout(taskqueue_thread, &uma_timeout_task, + UMA_TIMEOUT * hz); } /* @@ -3150,8 +3151,6 @@ uma_startup3(void *arg __unused) uma_skip_cnt = counter_u64_alloc(M_WAITOK); #endif zone_foreach_unlocked(zone_alloc_sysctl, NULL); - callout_init(&uma_callout, 1); - callout_reset(&uma_callout, UMA_TIMEOUT * hz, uma_timeout, NULL); booted = BOOT_RUNNING; EVENTHANDLER_REGISTER(shutdown_post_sync, uma_shutdown, NULL, @@ -3159,6 +3158,16 @@ uma_startup3(void *arg __unused) } SYSINIT(uma_startup3, SI_SUB_VM_CONF, SI_ORDER_SECOND, uma_startup3, NULL); +static void +uma_startup4(void *arg __unused) +{ + TIMEOUT_TASK_INIT(taskqueue_thread, &uma_timeout_task, 0, uma_timeout, + NULL); + taskqueue_enqueue_timeout(taskqueue_thread, &uma_timeout_task, + UMA_TIMEOUT * hz); +} +SYSINIT(uma_startup4, SI_SUB_TASKQ, SI_ORDER_ANY, uma_startup4, NULL); + static void uma_shutdown(void) {