[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKPKb8_8uQdzNevB4wVpXcRrBr0-rjfvBR=oNNyCCA4yASgK-g@mail.gmail.com>
Date: Tue, 7 Oct 2025 16:21:34 +0530
From: opensource india <opensource206@...il.com>
To: zack.rusin@...adcom.com, maarten.lankhorst@...ux.intel.com,
mripard@...nel.org, tzimmermann@...e.de, airlied@...il.com, simona@...ll.ch
Cc: bcm-kernel-feedback-list@...adcom.com, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/vmwgfx: Replace schedule() with schedule_hrtimeout()
in fallback wait
On Sun, Sep 28, 2025 at 11:19 AM Pavan Bobba <opensource206@...il.com> wrote:
>
> 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@...il.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
>
anyone please review this patch
Powered by blists - more mailing lists