Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2735505ybb; Sun, 12 Apr 2020 13:34:15 -0700 (PDT) X-Google-Smtp-Source: APiQypLAy9IB+nuQL4/YYyk3tU2IgzEx5XNpczNAc7ktzUcg2+RtOrNbWFhNtDYzz3fz874g6Mmo X-Received: by 2002:a37:8741:: with SMTP id j62mr12807326qkd.441.1586723655234; Sun, 12 Apr 2020 13:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586723654; cv=none; d=google.com; s=arc-20160816; b=dx+Tsx38xRLaLWgfMT3mkqtPCgjZZ4YjG5YyFw/lRoMMdufyr6ASCeMsVAly5t+Xu0 9Z5Q5ewPjvIn2F9csl7EYnZIc/4eCR3UJCtQEL277yHNJvsWeagt5e6GgIah4n6Z8vVS B00XDWlEWYru9yKrd10eiApL1hoANN00vt153ZV/Ku07gSY04vDip+KTKSVOkUz9hfdX yTFt9H3CPlRVFNDjTLvTg3Bnz9hniaX+igE1NsCkHCJ7YkOjjCBRk16T5XpIRQYkWSsZ V83W8lmhv9ikaUTouRGzx2fsFc41b2zIPgo/SNsdtWYIWhdRq6XCO5aVpuMUaaGkf3f5 KDQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=QGTj9vacKFMe4KyrGZOKCTbV4bswudoVDUKoucM67y8=; b=keor5KoAo3JlVsdZ+31j9I0TLfy8GFhf2tbHRSk0shIYfEUbocywrq7p4/aOFhyoS9 hkikFD8fiIBPI4tg6M42H/o9ZeSP+tZFZmFiQ9HtSZ7idNkYXHYr2sF7F8Kzsm7goUWG oA7nVWDYPMBlaQQztlvEORmBeEBeVUTCdMQgLXEPnWZA6PEi7EcAX820NSN2TgQHroTz sfEX2smYlUKfCGeSYgxUc9y5ub0plF5/5i4JfGtLImEZkDB3OrDRKCly/lbGNr0xnxhv E0KwBMNU948b9iQnHqfyy1Omz7UcuX8Vx+VevcFg8AvRFHnxTS4+WbHG/dQPoFpODw2A vMGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kl.wtf header.s=default header.b=qjzzKIFT; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kl.wtf Return-Path: Received: from vger.kernel.org ([209.132.180.67]) by mx.google.com with ESMTP id j26si1224qtq.288.2020.04.12.13.33.59; Sun, 12 Apr 2020 13:34:14 -0700 (PDT) Received-SPF: neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kl.wtf header.s=default header.b=qjzzKIFT; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kl.wtf Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727425AbgDLRzI (ORCPT + 99 others); Sun, 12 Apr 2020 13:55:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:38224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727190AbgDLRzI (ORCPT ); Sun, 12 Apr 2020 13:55:08 -0400 X-Greylist: delayed 370 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 12 Apr 2020 10:48:37 PDT Received: from out1.migadu.com (out1.migadu.com [IPv6:2001:41d0:2:863f::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61B47C0A3BF7 for ; Sun, 12 Apr 2020 10:48:37 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kl.wtf; s=default; t=1586713341; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QGTj9vacKFMe4KyrGZOKCTbV4bswudoVDUKoucM67y8=; b=qjzzKIFTCoUEqkc0DGzsUhIqN58i8tuW/sStNYiH4CjG9TbQ4WDzmF7EXJcvp+mhx+VsiR mUDd0w9MZj5fytBVT6iNwx8BIGgeV8iG+KPituHpcHAphUQLuzCBLh0ZFrj38LX7vzVAn0 v7jNSrD3VsUQ6dgbQCPJugnx9W1/sgw= From: Kenny Levinsen To: dri-devel@lists.freedesktop.org Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, linux-kernel@vger.kernel.org, Kenny Levinsen Subject: [PATCH] drm: make drm_file use keyed wakeups Date: Sun, 12 Apr 2020 19:41:21 +0200 Message-Id: <20200412174121.5841-1-kl@kl.wtf> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 4.90 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(&e->link, &file_priv->event_list); spin_unlock_irq(&dev->event_lock); - wake_up_interruptible(&file_priv->event_wait); + wake_up_interruptible_poll(&file_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(&e->pending_link); list_add_tail(&e->link, &e->file_priv->event_list); - wake_up_interruptible(&e->file_priv->event_wait); + wake_up_interruptible_poll(&e->file_priv->event_wait, + EPOLLIN | EPOLLRDNORM); } EXPORT_SYMBOL(drm_send_event_locked); -- 2.26.0