From: Pavan Bobba <opensource206@gmail.com>
To: zack.rusin@broadcom.com, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
simona@ffwll.ch
Cc: bcm-kernel-feedback-list@broadcom.com,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Pavan Bobba <opensource206@gmail.com>
Subject: [PATCH] drm/vmwgfx: Replace schedule() with schedule_hrtimeout() in fallback wait
Date: Sun, 28 Sep 2025 11:19:13 +0530 [thread overview]
Message-ID: <20250928054913.7871-1-opensource206@gmail.com> (raw)
Replace the open-coded polling with schedule() in vmw_fallback_wait()
by schedule_hrtimeout(). The old code wakes up at jiffy granularity and
leads to unnecessary CPU wakeups during fence waits.
schedule_hrtimeout() provides high-resolution sleep with finer control,
reducing CPU utilization without affecting fence correctness. For the
non-interruptible case, use schedule_timeout_uninterruptible().
Signed-off-by: Pavan Bobba <opensource206@gmail.com>
---
drivers/gpu/drm/vmwgfx/vmwgfx_irq.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
index 05773eb394d3..64045b0efafc 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
@@ -202,16 +202,12 @@ int vmw_fallback_wait(struct vmw_private *dev_priv,
if (lazy)
schedule_timeout(1);
else if ((++count & 0x0F) == 0) {
- /**
- * FIXME: Use schedule_hr_timeout here for
- * newer kernels and lower CPU utilization.
- */
-
- __set_current_state(TASK_RUNNING);
- schedule();
- __set_current_state((interruptible) ?
- TASK_INTERRUPTIBLE :
- TASK_UNINTERRUPTIBLE);
+ ktime_t delta = ktime_set(0, NSEC_PER_MSEC);
+
+ if (interruptible)
+ schedule_hrtimeout(&delta, HRTIMER_MODE_REL);
+ else
+ schedule_timeout_uninterruptible(delta);
}
if (interruptible && signal_pending(current)) {
ret = -ERESTARTSYS;
--
2.43.0
next reply other threads:[~2025-09-28 5:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-28 5:49 Pavan Bobba [this message]
2025-10-07 10:51 ` opensource india
2025-10-18 9:22 ` opensource india
2025-10-20 4:18 ` Zack Rusin
2025-10-28 11:06 ` opensource india
2025-10-29 15:32 ` Zack Rusin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250928054913.7871-1-opensource206@gmail.com \
--to=opensource206@gmail.com \
--cc=airlied@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
--cc=zack.rusin@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®