From nobody Thu Feb 09 16:02:45 2023 X-Original-To: dev-commits-src-main@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 4PCM8P4xfFz3pkV2; Thu, 9 Feb 2023 16:02:45 +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 4PCM8P4F4Hz4Dyb; Thu, 9 Feb 2023 16:02:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675958565; 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=nGEul3H8QrLR2jXTsANK2IzuJo/DBLVwma2iACpS2RQ=; b=HREoHtFKXUbsN7xjWKp308a8nUnhIueAlpIKhf62RHL7L5WlaJBaItg+WNwECjGOrhBzl2 LK4GtmwEuvW2/TnpUv2eiY0P+nvm6b0u/np8npibSY5bwgiKchQRstXSXZW2xpLp0nIpJb wgOjwtgaHy+uL/+KM2FUP4fr8vkBwaYH246xDUp5cjQy7zBEsGnBzZMQsRPowNexP9Uqgi xieqG7Fjo49md/vt0nnm4fci8O/upcXHyhsQxSDswmTShPqezmyqFwbdXz7sPam9z8+GER eEW8yzdVDbgd892H8JuDIVqtjSOH1IEdifXYEc80XiHdQMM0y97x/yNWsXEeKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675958565; 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=nGEul3H8QrLR2jXTsANK2IzuJo/DBLVwma2iACpS2RQ=; b=H1wQYaGPHKhupgIdim5uNu0uagbOp1siW/BlMDJrwgBCtx7aUqc7HIl2Q3KOPPbpgrQdoj kvjYCWlmp5fSjL0ubffpuF0HZ2jhMRpzow/FCtMnvJmN1vit5XnxzUOYeBblGLnnn39nct kd+BmrEk72Sn2oWDDqB08WupN0joYaiqZ0jxJXrYtINbMCyiWNqLYvBpcPfa2jit9Ai82Q AluiFA2rxfa15gj/27BXLpQUXvnMmPWYW4UXi2bsPU1pa8vfYsKq1KVikv76o997D7+NBM pA104MhWCmJBc0cxzNgdsKL21scA12A5Ct6Q3cllu53e/e91VedHINoZp5sfLw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675958565; a=rsa-sha256; cv=none; b=pFlDz/INXBDAGL1CNl0Ev5SD9pYUq0H6FZEsEmZFNFZ7neb5yMPeoMhh2/FND8XjTSy3kb pAVbeGT13/U2Y6udjCCwm9J4owau47iAYfaRQ5Z0ij7xK9gD6QFgAJii4I409+MbYCd5Ze TSxBWKgUyh8ofoZhjocNQTp4Cr/j1bB/5ejZAX0AUt081MjrWdtHDL2M8akfdhdLHIyoM7 7RDd9oTMEODmqUkjk4Qq4zYCjkbhy8JZE25CljptpTTP14kU52cLO2kOiU4nKbGx9ir9Fh 5UqQpz0aDBKL/Hrzxi+eMcrHYpQ0G7+1qm8/XCMZSS6dLVxKAQxJnGXhCpZKMw== 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 4PCM8P3Klmzjjl; Thu, 9 Feb 2023 16:02:45 +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 319G2j6e094713; Thu, 9 Feb 2023 16:02:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 319G2jaX094712; Thu, 9 Feb 2023 16:02:45 GMT (envelope-from git) Date: Thu, 9 Feb 2023 16:02:45 GMT Message-Id: <202302091602.319G2jaX094712@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: bff02948ed87 - main - sched_4bsd: use the same switch flags as ULE List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bff02948ed87a9e791fa901557a88ae545bf3df7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=bff02948ed87a9e791fa901557a88ae545bf3df7 commit bff02948ed87a9e791fa901557a88ae545bf3df7 Author: Mitchell Horne AuthorDate: 2023-02-09 15:39:12 +0000 Commit: Mitchell Horne CommitDate: 2023-02-09 16:01:32 +0000 sched_4bsd: use the same switch flags as ULE ULE uses the more specific SWT_REMOTEPREEMPT and SWT_REMOTEWAKEIDLE switch types, let's do that here as well. SWT_PREEMPT is somewhat redundant when we also have the SW_PREEMPT flag. This only has an effect for kernels built with SCHED_STATS. Reviewed by: kib, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38183 --- sys/kern/sched_4bsd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c index 8bd697a67e7e..f0da4f8d8496 100644 --- a/sys/kern/sched_4bsd.c +++ b/sys/kern/sched_4bsd.c @@ -1542,13 +1542,17 @@ sched_choose(void) void sched_preempt(struct thread *td) { + int flags; SDT_PROBE2(sched, , , surrender, td, td->td_proc); if (td->td_critnest > 1) { td->td_owepreempt = 1; } else { thread_lock(td); - mi_switch(SW_INVOL | SW_PREEMPT | SWT_PREEMPT); + flags = SW_INVOL | SW_PREEMPT; + flags |= TD_IS_IDLETHREAD(td) ? SWT_REMOTEWAKEIDLE : + SWT_REMOTEPREEMPT; + mi_switch(flags); } }