From nobody Mon Jul 28 13:31:39 2025 X-Original-To: dev-commits-src-all@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 4brKBh12Ksz634YN; Mon, 28 Jul 2025 13:31:40 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4brKBg4SJtz3v9C; Mon, 28 Jul 2025 13:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709499; 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=+pCPf7vwCdUicqC9sqp1uNqpNNgWKMuVCYo89bHZHtk=; b=L5eKWi/DPhAeFnp3aPPM6FIDcVoB1jjtmi7s5bHvGJX9KaaB0j3r9Xy8yTe85QOqTU/dga JSzwhahiuTyndYheHKQue9M9kSpVMe+tnASpX0eDBKLAJnCuJYVG2rhoG9tfXJtlD05uSg 30WR9+goP5bPYAtp6bmpVP84JdOkglzGJeJ2ZQWJj9qC8o/f5Qa0NQTGaUtnbG542cxQU1 FcCVZMH7rj7Z1yd1JrhuhlUbZa5Pg4jd9+m+osGuxyWQ1QzOym/d6/7F9mNZlaqdwf6X/H lVVZ2M2qjuH/eP2oefiyWffhESHWoBnA8zcpW12x3841WsbALHhGupgxPV+Cow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1753709499; 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=+pCPf7vwCdUicqC9sqp1uNqpNNgWKMuVCYo89bHZHtk=; b=oELLIFOE1SVr8GJc3JPROvkVRneNygI2ja/MUezdCXLlYtZT4mJl5i1g2dkM+gyDXisGIr b4cIbHJXjOHp6KLYgfZT1qTemG4T7RGRanZqHsX+NO+0Lowq81YpTqUBFh0QPf5zJn0wHP LZgSr7NcBe+u8N+hp7tNXN+5SUkPVF2DbSqa7wtTHWUW2hmeClw3fgf69mlKqm5iG9vcuU ShkICoA6QsGyUqj/IVyzO1oGckgrQx7hHn3c5ERX0++u+3QcOZgoAZyoNHPUazFdDRZvMF w2lGsEh32ROeL0pqWm0kUSM2oNLby9EU6SxO3D1OB0xMBklEvbFx9Jc1r+D6gQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1753709499; a=rsa-sha256; cv=none; b=CaGu2QdMFetXTfWVgz7yt95iXWUdzXQlqISXsiGUdqSaa9Lf6waFt+crJi0ZGODHRGudnC ExkAvJTSrc1jdCoNNFr4CAucEdnQ0KncUhljyuCJwKOT14SPmsvd+A5SQDxtis8gphPqE8 0/FndzrmCg+u1B1ozGsKKxLvWokObLno9YrVIgCkzhwKnSOIBFBf+DRCFmIbgSKzdMj6mJ 471VzGe6YPVR9xXKbzyjqe0ZK9YR8IXEVkMObYak5ON+klV0HSJ570N+goIdC4agewbpL7 HmZNHQLiaZ5xMKHvNyuE85U/1azJq4DQ8UI3adXAPxvxdR+TszOLYQDaK3RhKw== 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 4brKBg3xkBznCZ; Mon, 28 Jul 2025 13:31:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56SDVdjY082155; Mon, 28 Jul 2025 13:31:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56SDVdpS082151; Mon, 28 Jul 2025 13:31:39 GMT (envelope-from git) Date: Mon, 28 Jul 2025 13:31:39 GMT Message-Id: <202507281331.56SDVdpS082151@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: cc604213b597 - stable/14 - sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: cc604213b59777b33c413e2d2c70f63d4c3665bf Auto-Submitted: auto-generated The branch stable/14 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=cc604213b59777b33c413e2d2c70f63d4c3665bf commit cc604213b59777b33c413e2d2c70f63d4c3665bf Author: Olivier Certner AuthorDate: 2024-05-21 12:55:43 +0000 Commit: Olivier Certner CommitDate: 2025-07-28 13:28:42 +0000 sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range The current formula wastes queues and degrades usage estimation precision, since any increase of ticks that goes over 40 priorities (so, 8 * 40) is clamped to the last of these 40 levels (the nice value is subsequently added to that number to get the final priority level). Allow 'ts_estcpu' to grow up to a value corresponding to the greatest (i.e., lowest) priority of the timeshare range. MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45392 (cherry picked from commit eebc148f25c3012b943083b48fbfc13494e9c77f) --- sys/kern/sched_4bsd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index e9d180fde303..0e7ac9feb686 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -80,7 +80,9 @@ dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif #define NICE_WEIGHT 1 /* Priorities per nice level. */ #define ESTCPULIM(e) \ - min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN)) \ + min((e), INVERSE_ESTCPU_WEIGHT * \ + (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) + \ + PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) \ + INVERSE_ESTCPU_WEIGHT - 1) #define TS_NAME_LEN (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX)))