Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7797245ybl; Thu, 16 Jan 2020 05:51:00 -0800 (PST) X-Google-Smtp-Source: APXvYqztLdwHge2470Ux1hXUYIzXzn23QOkvIeOuUhsFMsPO/FfSr08j/8GO6w6Ui/sS165148GK X-Received: by 2002:a9d:7593:: with SMTP id s19mr1899944otk.219.1579182660407; Thu, 16 Jan 2020 05:51:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579182660; cv=none; d=google.com; s=arc-20160816; b=Ex58ZJhlGVnYiP3PbSjXF7xBYkYQSM97js0hIeIrgqmtMhDrIc/1bcYEpakZD7+H0l l+aRT0bNdDsB/qpm3MQsjBY4kVi0PC1icagslscDCKGgMH+4sOHrcQOESgbRJWeLYRDG 8Ad7nXChjTN79ofnWUx2973s+5dJVkt4QkKGpuwX/S/aWIVMohaDTo6FQ4RcM/IppOTD eKuZ0+Hq8a1fpGC4sEoZw9REwtnGBgpWkyBNG8KeFdUH1d05ua4NICCvrm0dSx89ak8q ehjYAjY/O2AFdObtkapmVsqzsM//YArHRl0UBVfi2qUAMQcdQG4Tvi6VjXLq34Cp8CEh o3vA== 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=tW8QepJVzZQv/Ygdvwl07xvaRaFmGC5EBwa4NFuhNeM=; b=gH1LZWHOYblEn+AgvlXbVx0IbFiOcRFHIISnim6CRXdQyUjbsla2rjv++qPj4ETKVr wQx4PcbFHNDE0IStNr4Uo0hCSjo3GFcCawGr9maRqVQHs/rUvX76zStc3oUIPuhkw4Dm fRAsJPAeC1c7BW5gErnlBtZqAhvPYwG8qeA6yjJRArbzzjZox4sLeC1JLxMaHjTAPS+e nMSpquSigxnkZQha7zhG72wi42fIByFTXY0QYl2KiMRMMLmUwl7QMgGJ5NoJm6zZuUqt mTenpR0RskdmxyeUiFgzRMIj9xC025xzsXcENXqBYwFrvfdQog5kVeFnEc1leuWXWUGP ibBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Kat1ueh6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s5si11131940oic.116.2020.01.16.05.50.48; Thu, 16 Jan 2020 05:51:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Kat1ueh6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726555AbgAPNty (ORCPT + 99 others); Thu, 16 Jan 2020 08:49:54 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:25122 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726366AbgAPNty (ORCPT ); Thu, 16 Jan 2020 08:49:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579182593; 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=tW8QepJVzZQv/Ygdvwl07xvaRaFmGC5EBwa4NFuhNeM=; b=Kat1ueh6URun3U1Gioba4aadsYehGLOvYzefcLU/PleyAhq0GxYRr0wxXuA0gW3XcuLotu lcnOsJJFdykht33mkCXt3DG4OVLYPmjbzFPbZjajdVuWleJCKWVj5KKmc20fZ24TVCGOJP ao8oC9G68RrktlFxypXayENsI2GhwK0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-92-jzdK0iVEON-09vfB4a5Ciw-1; Thu, 16 Jan 2020 08:49:50 -0500 X-MC-Unique: jzdK0iVEON-09vfB4a5Ciw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1E9EC8DF704; Thu, 16 Jan 2020 13:49:49 +0000 (UTC) Received: from steredhat.redhat.com (ovpn-117-242.ams2.redhat.com [10.36.117.242]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF7AA860DA; Thu, 16 Jan 2020 13:49:47 +0000 (UTC) From: Stefano Garzarella To: Jens Axboe Cc: Alexander Viro , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH] io_uring: wakeup threads waiting for EPOLLOUT events Date: Thu, 16 Jan 2020 14:49:46 +0100 Message-Id: <20200116134946.184711-1-sgarzare@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org io_uring_poll() sets EPOLLOUT flag if there is space in the SQ ring, then we should wakeup threads waiting for EPOLLOUT events when we expose the new SQ head to the userspace. Signed-off-by: Stefano Garzarella --- Do you think is better to change the name of 'cq_wait' and 'cq_fasync'? Thanks, Stefano --- fs/io_uring.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index 38b54051facd..5c6ff5f9e741 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3687,6 +3687,11 @@ static void io_commit_sqring(struct io_ring_ctx *c= tx) * write new data to them. */ smp_store_release(&rings->sq.head, ctx->cached_sq_head); + + if (wq_has_sleeper(&ctx->cq_wait)) { + wake_up_interruptible(&ctx->cq_wait); + kill_fasync(&ctx->cq_fasync, SIGIO, POLL_OUT); + } } } =20 --=20 2.24.1