From nobody Mon Nov 21 19:12:44 2022 X-Original-To: freebsd-current@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 4NGH8c5XHXz4hHRN for ; Mon, 21 Nov 2022 19:12:48 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NGH8b6rGQz3nxd for ; Mon, 21 Nov 2022 19:12:47 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=TaWzJR94; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::830 as permitted sender) smtp.mailfrom=markjdb@gmail.com; dmarc=none Received: by mail-qt1-x830.google.com with SMTP id s4so7900373qtx.6 for ; Mon, 21 Nov 2022 11:12:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=nxoFJ9uRaKzis8Ou/6d1kE9Qn6NH9avcqtnses/4M8M=; b=TaWzJR94CgNXv5j4rSP1Nb02oRUW2sTUXeOtt8yKnvZv675ZT84yM9X9rOrhBDHNKr ByRsIbATp6+RaRK1+qSi56oliSXaGhhBxiL1PWrR01Yn79d4ZuFpqb5XGH4J0ejd+z56 mAnAs3+QQUPMx81UmRN5WJBctlhvrSAxXaM+9dsfnxaQnpP8e6CZxSeoUIwBnwD0Cmx4 JKo796OH0d0s4PU9WI8sPcKW/NxvvhF96n2rUJmI69Gd/dSzDT+VCYIYDdSRWbJmmWI6 Hb8O2/Sp4vOTdDxngj2ZAEwvDCte1GRgThd4kfPVq2t8bofXw69bdKYz6A5Jaq2ePd8z AUmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nxoFJ9uRaKzis8Ou/6d1kE9Qn6NH9avcqtnses/4M8M=; b=3EGK0fQioJ6NsZ/cZuMKIXEauYIl9rfLe1BD6ELtcu1/4Aj9/3I3bE6NWf57ELtQM9 aJnIJsvLSTK3uJQ7Z2ZpEBsqPoxJ8RuQpthgdG5ccKvoV884GvgN6RaRfRXZtwC7mjMB XXW9iQzq6cNDfA4rExsdmDaf15aZuXHmT41CsjMiVeHeseHiU7nBSzs+VJdbiWr5+rlA tcytJhOUYaUPjpenJAyf1ykRz0Z1jKwn1Y+0hulr9eU4tmrUDqpO+9JBreZITnu6dyqw kngBVSCg3EioJDEAqinfiyLkm/8fT9+flLhxfBpc9IgQvYt3L6Eoe3rw52FsB7fzP6GD XoJA== X-Gm-Message-State: ANoB5pmMXbHhShGSnj7R0ynSeS4l6DiY78rKccgPr9To4rzNeng9vfVf NNHl7JPG2RNZpMbUBTjy05GyGRiipbI= X-Google-Smtp-Source: AA0mqf5ZVV+LGYO2qdUYNLSuArMY6zO4G+F0IB7wdL6tLqy2UHAGETUSjGu/GpsupoLoWB8EiyHxmw== X-Received: by 2002:ac8:6a1a:0:b0:35c:f2e5:a673 with SMTP id t26-20020ac86a1a000000b0035cf2e5a673mr19092904qtr.232.1669057966891; Mon, 21 Nov 2022 11:12:46 -0800 (PST) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id g24-20020ac87758000000b003a611cb2a95sm7091734qtu.9.2022.11.21.11.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Nov 2022 11:12:46 -0800 (PST) Date: Mon, 21 Nov 2022 14:12:44 -0500 From: Mark Johnston To: Hans Petter Selasky Cc: FreeBSD Current Subject: Re: ULE realtime scheduler advice needed Message-ID: References: <7ad10a5e-29d6-aaef-25cf-407d65f056cc@selasky.org> List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7ad10a5e-29d6-aaef-25cf-407d65f056cc@selasky.org> X-Spamd-Result: default: False [-2.70 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.996]; MID_RHS_NOT_FQDN(0.50)[]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; DMARC_NA(0.00)[freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::830:from]; TO_MATCH_ENVRCPT_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; ARC_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; DKIM_TRACE(0.00)[gmail.com:+]; TO_DN_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCPT_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 4NGH8b6rGQz3nxd X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N On Fri, Nov 18, 2022 at 05:47:58AM +0100, Hans Petter Selasky wrote: > Hi, > > I'm doing some work with audio and have noticed some problems with the > ULE scheduler. I have a program that generate audio based on > key-presses. When no keys are pressed, the load is near 0%, but as soon > as you start pressing keys, the load goes maybe to 80% of a CPU core. > This program I run with rtprio 8 xxx. The issue I observe or hear > actually, is that it takes too long until the scheduler grasps that this > program needs it's own CPU core and stops time-sharing the program. When > I however use cpuset -l xxx rtprio 8 yyy everything is good, and the > program outputs realtime audio in-time. > > Or is this perhaps a CPU frequency stepping issue? > > Any advice on where to look? There were some bug fixes earlier this year to address problems where high-priority threads were not getting scheduled quickly enough. If you're using an old kernel, they might improve things: https://cgit.freebsd.org/src/commit/?id=0927ff78147b4d00a75054bbad299946208e1e91 https://cgit.freebsd.org/src/commit/?id=6d3f74a14a83b867c273c6be2599da182a9b9ec7 https://cgit.freebsd.org/src/commit/?id=03f868b163ad46d6f7cb03dc46fb83ca01fb8f69 https://cgit.freebsd.org/src/commit/?id=a889a65ba36985dfb31111ac1607be35ca2b2c8c Otherwise, you might try using tools/sched/schedgraph.d and schedgraph.py to visualize what's going on. schedgraph.d logs all scheduler events of interest and schedgraph.py presents a row for each CPU and thread in the system, making it easier to see why threads are waiting on runqueues.