Re: [PATCH] drm: make drm_file use keyed wakeups

2020-04-28 Thread Daniel Vetter
On Fri, Apr 24, 2020 at 04:51:03PM +0200, Kenny Levinsen wrote:
> Some processes, such as systemd, are only polling for EPOLLERR|EPOLLHUP.
> As drm_file uses unkeyed wakeups, such a poll receives many spurious
> wakeups from uninteresting events.
> 
> Use keyed wakeups to allow the wakeup target to more efficiently discard
> these uninteresting events.
> 
> Signed-off-by: Kenny Levinsen 

intel-gfx CI is happy, I'm living with the illusion that this seems to
loook correct (linux kernel poll code is too much magic for me). Thanks
for your patch, queued up in drm-misc-next for 5.8.

Cheers, Daniel

> ---
>  drivers/gpu/drm/drm_file.c | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index c4c704e01961..ec25b3d979d9 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -608,7 +608,8 @@ ssize_t drm_read(struct file *filp, char __user *buffer,
>   file_priv->event_space -= length;
>   list_add(>link, _priv->event_list);
>   spin_unlock_irq(>event_lock);
> - wake_up_interruptible(_priv->event_wait);
> + 
> wake_up_interruptible_poll(_priv->event_wait,
> + EPOLLIN | EPOLLRDNORM);
>   break;
>   }
>  
> @@ -804,7 +805,8 @@ void drm_send_event_locked(struct drm_device *dev, struct 
> drm_pending_event *e)
>   list_del(>pending_link);
>   list_add_tail(>link,
> >file_priv->event_list);
> - wake_up_interruptible(>file_priv->event_wait);
> + wake_up_interruptible_poll(>file_priv->event_wait,
> + EPOLLIN | EPOLLRDNORM);
>  }
>  EXPORT_SYMBOL(drm_send_event_locked);
>  
> -- 
> 2.26.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm: make drm_file use keyed wakeups

2020-04-13 Thread Kenny Levinsen
Some processes, such as systemd, are only polling for EPOLLERR|EPOLLHUP.
As drm_file uses unkeyed wakeups, such a poll receives many spurious
wakeups from uninteresting events.

Use keyed wakeups to allow the wakeup target to more efficiently discard
these uninteresting events.

Signed-off-by: Kenny Levinsen 
---
 drivers/gpu/drm/drm_file.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
index c4c704e01961..ec25b3d979d9 100644
--- a/drivers/gpu/drm/drm_file.c
+++ b/drivers/gpu/drm/drm_file.c
@@ -608,7 +608,8 @@ ssize_t drm_read(struct file *filp, char __user *buffer,
file_priv->event_space -= length;
list_add(>link, _priv->event_list);
spin_unlock_irq(>event_lock);
-   wake_up_interruptible(_priv->event_wait);
+   
wake_up_interruptible_poll(_priv->event_wait,
+   EPOLLIN | EPOLLRDNORM);
break;
}
 
@@ -804,7 +805,8 @@ void drm_send_event_locked(struct drm_device *dev, struct 
drm_pending_event *e)
list_del(>pending_link);
list_add_tail(>link,
  >file_priv->event_list);
-   wake_up_interruptible(>file_priv->event_wait);
+   wake_up_interruptible_poll(>file_priv->event_wait,
+   EPOLLIN | EPOLLRDNORM);
 }
 EXPORT_SYMBOL(drm_send_event_locked);
 
-- 
2.26.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel