Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7965903ybl; Thu, 16 Jan 2020 08:27:49 -0800 (PST) X-Google-Smtp-Source: APXvYqw+NCemSds2/ArBrGZoFzQEuJnHWChj+hirKvyiPmDUo8AkXHukeEMUbYqBcBjna0NhWNEN X-Received: by 2002:aca:c494:: with SMTP id u142mr4843312oif.86.1579192069476; Thu, 16 Jan 2020 08:27:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579192069; cv=none; d=google.com; s=arc-20160816; b=ByMvfQokXVVkqqDTA/rTrJ4ZY99yBlnHT715PRYUC6QzJOZUr2TSY6u8d2w2sPXocE /3qeXM8zmjuItUujF/PxlDd1nJTTS6QRnGHQnt15jqrVQpSKylJ+pTPtDy/PBUgqomva QRQiMJq/dUjdnfndU/GXMdHo8UEjPHUcpzWpgKFJhbe491xbw25aCtd7HV6d16D8NSgb skzGMO4Gz5rAXrr9ZX5D1ei9jDto5LPMn+Rc0WPtHUcGr29rR4WDWnhIIZsQ8CBlL6Hb x0RpIIodlyIbVmxRBctZ0xUACa1eBBjpmc69u59+CoqRLeuQciVWMl5ZW+9whuY3kw5m tIYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=G6RNGzjUW843+AgIaDtl8qCHGuApw8Cu8ZmlHAq9RaQ=; b=L5RPEPkH7Q+y5TiL5VSv/DwjHG3zPGFr54O9N3//AGxJjlsBARWraOG4ZhRk8hJxWH CsyHXRfHiT3cvCOHza2uD8LptRQzD45ih+jKpBQA/g37o2JzNMPr73Pk0Lr6xIyBWy1C +Cmyw80tDpTq5jJ6/AqfFGdHeyU9vDzOFDYcbsSBTqjwcDopwOMxv9INciu1zekw2C5t qM4mlFd2FJZTGp9rsZWOywcgq7zViyVU84fyEKYDuzAUhTRLDRf/WV9dcNaZ9ofsNpB4 PLlsvuakOlj5GED0G1ODYO5Sqef8KRNW9moiDre7wUsf+oCF/gtSAr9gmCHH0VGXU5iq mUYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SVxAUh98; 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 x3si11886087oic.251.2020.01.16.08.27.36; Thu, 16 Jan 2020 08:27:49 -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=SVxAUh98; 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 S1726936AbgAPQ0i (ORCPT + 99 others); Thu, 16 Jan 2020 11:26:38 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:50940 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726088AbgAPQ0h (ORCPT ); Thu, 16 Jan 2020 11:26:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579191996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=G6RNGzjUW843+AgIaDtl8qCHGuApw8Cu8ZmlHAq9RaQ=; b=SVxAUh98rP5ybdTpel0kaXdzL/gJDg0alW01oJAdh5ESptSMDT0CmRPG+9qpRyE3WzQFUz /9C3I9KUl+4HlDpl2j8cFZKtaAGa7cyRbPaxA7XTtDp+IWcqqLFB2SdBuKcFvcDa/tXx7U 99Z+eBpma+cnca64lXGOse2bD5mEazU= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-341-kX5aq_m0NJGNs9GdP1eJVQ-1; Thu, 16 Jan 2020 11:26:34 -0500 X-MC-Unique: kX5aq_m0NJGNs9GdP1eJVQ-1 Received: by mail-wm1-f69.google.com with SMTP id o24so695605wmh.0 for ; Thu, 16 Jan 2020 08:26:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=G6RNGzjUW843+AgIaDtl8qCHGuApw8Cu8ZmlHAq9RaQ=; b=F7E30YLf2y/mfdaERfMUxlKfiPZwBWpqMM3s1dlZh3uK+g5l5EQ7XRtrDDArA4mT38 lqw+20mpA1ytYb6+QyagnavwJnnQMzdqkQB3gMnolq7kaKnaHFsSbLgf4KEiOenq3lc9 mhJ7mjbtKKqOsAPSlcbw6iUyMAO9JY1fL2YcK2bnC0FwtTxV9FZ/xXjepyUux5NOIY4t y9Q1dI6EjsSDOs+ikFsXS15YekPtclV0nlPDnvyae5f/xp1PnZFPiC12MnryDyffkChR Oux249pEc3g/sj8Wdr91mIz4Mnz62lJBqjEGb+KQjGqcr937nHuxWMBB9YBXrFW4CS03 AJJA== X-Gm-Message-State: APjAAAUN8LBTxNyNpEdKGHZX9rMdHK3Bz9G6v4HVRsC7bBcrwPWhuHXZ fdardq3MPp/0dnKOM9aMbzQXIRMXco7Uf1/RMNdQpF1k6kj2Q0m1KJE4wKzcO/jrDTsa/OqHfhH G3HDiDpQwD5QKSZq6QrowcxNW X-Received: by 2002:a7b:c38c:: with SMTP id s12mr179122wmj.96.1579191993842; Thu, 16 Jan 2020 08:26:33 -0800 (PST) X-Received: by 2002:a7b:c38c:: with SMTP id s12mr179105wmj.96.1579191993610; Thu, 16 Jan 2020 08:26:33 -0800 (PST) Received: from steredhat (host84-49-dynamic.31-79-r.retail.telecomitalia.it. [79.31.49.84]) by smtp.gmail.com with ESMTPSA id p18sm5370071wmb.8.2020.01.16.08.26.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 08:26:32 -0800 (PST) Date: Thu, 16 Jan 2020 17:26:30 +0100 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: Re: [PATCH] io_uring: wakeup threads waiting for EPOLLOUT events Message-ID: <20200116162630.6r3xc55kdyyq5tvz@steredhat> References: <20200116134946.184711-1-sgarzare@redhat.com> <2d2dda92-3c50-ee62-5ffe-0589d4c8fc0d@kernel.dk> <20200116155557.mwjc7vu33xespiag@steredhat> <5723453a-9326-e954-978e-910b8b495b38@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5723453a-9326-e954-978e-910b8b495b38@kernel.dk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 16, 2020 at 09:00:24AM -0700, Jens Axboe wrote: > On 1/16/20 8:55 AM, Stefano Garzarella wrote: > > On Thu, Jan 16, 2020 at 08:29:07AM -0700, Jens Axboe wrote: > >> On 1/16/20 6:49 AM, Stefano Garzarella wrote: > >>> 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'? > >> > >> I honestly think it'd be better to have separate waits for in/out poll, > >> the below patch will introduce some unfortunate cacheline traffic > >> between the submitter and completer side. > > > > Agree, make sense. I'll send a v2 with a new 'sq_wait'. > > > > About fasync, do you think could be useful the POLL_OUT support? > > In this case, maybe is not simple to have two separate fasync_struct, > > do you have any advice? > > The fasync should not matter, it's all in the checking of whether the sq > side has any sleepers. This is rarely going to be the case, so as long > as we can keep the check cheap, then I think we're fine. Right. > > Since the use case is mostly single submitter, unless you're doing > something funky or unusual, you're not going to be needing POLLOUT ever. The case that I had in mind was with kernel side polling enabled and a single submitter that can use epoll() to wait free slots in the SQ ring. (I don't have a test, maybe I can write one...) > Hence I don't want to add any cost for it, I'd even advocate just doing > waitqueue_active() perhaps, if we can safely pull it off. I'll try! Thanks, Stefano