Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4327764pxb; Mon, 27 Sep 2021 14:38:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH1DuPsZFSb++jxxRfL7JZhg8/uAu/a+u6OShrK0pz89LL1ZF6RZM2uzje7f14SzkdAq2b X-Received: by 2002:a50:8285:: with SMTP id 5mr1605945edg.318.1632778682237; Mon, 27 Sep 2021 14:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632778682; cv=none; d=google.com; s=arc-20160816; b=ollx1oD/8tdJQ4U/YPUor7QmdFcAhZwgIiEVWvfONJI56TtpABXp0I32ApERc7HbM2 uclRbhKaahqeRMzK3mYuf4o97uoR09Np8SGbzfY7UU8RxA4eNiwDNwjQy92TOD7JrzYO vZe8gxGTXVTiuazb6Ma0yIdTrUleSdNYL9QpOIU2mP8B9LhFtXnUbOWy4+6coMKgyj58 WYc3Ut5wkOKBaic5CfrH4CJzNJ6stfFYIH1f5SiXGGQKILbnPJGP8WaGHDv2fud/348d UmAjhw+B+stDkRbtytELx3Kcfm3IciDPO1LP5VFTOzukHw9gjgVa3h08r6+9uRurhq3k Jk9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=KRUntgfDBi53GMkxCXevXBnnvVff9jqBgaMDIpl5H9U=; b=VL8RA4AwN8ZmH/0PgmXiVGRx3eKHcDBigkGkoyM8RlOQtLoHQlVU23yQUSVxzyZGat UJMKXPiRtxWhCA563/zKgwjlR9U4Zr3lfmXpHi0aBiydtb0Stmbo5cOcawZ4LU6hmevy Y62RwtNpmqdaUBaVRq04904IdiT7d5yhm2K3WXxEObBAB4Vn7R+MqS9HgAyaZ3DoaIU5 IdboPgi4UyIUcqBXCNxx9w1adCTdc+3TGLukR4yewrqZWQpVQs21F3B5XqCHBz1ZwNCU fzC77nkWN0/cT3FxOpgur981Vo7/bnIGevx5oJx6OHwjUs6D0iIZtHJgBH/gCFeoG3rP ngoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NZG3prOK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si19116495eju.171.2021.09.27.14.37.38; Mon, 27 Sep 2021 14:38:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NZG3prOK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237277AbhI0Vfg (ORCPT + 99 others); Mon, 27 Sep 2021 17:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237222AbhI0Vff (ORCPT ); Mon, 27 Sep 2021 17:35:35 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC41DC061575; Mon, 27 Sep 2021 14:33:56 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id n23so14258377pfv.4; Mon, 27 Sep 2021 14:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KRUntgfDBi53GMkxCXevXBnnvVff9jqBgaMDIpl5H9U=; b=NZG3prOK6Mm7t4GMt7iudh91oMNsRrL3PwjYwvntsEwTdafFfnzHZbyLXzmrc+C1v6 2alNXGI3br9pd+zw1FoScE0y4hqEoggzGiIZugN3fija0q2BeMNutWmuGbIfcyurqUAC BshrTpfMsuQ9+v4+s8EQHhQ+B72n5B54bCagkSmwetYr4SZf6s8WP83RWcdRqoebaydW HByv7sJjahpqWiexJsTRXarwyDESHgvhEe2NOLnUqoLmicvtKw0l0bXCZQANLCAErMfL x+oGylpo8KIc+1f1/cS4824fmQetsKrJJkkZi2ioVdrrPAoSHZjLL26ZrnzDLVAlqhjh 9YCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KRUntgfDBi53GMkxCXevXBnnvVff9jqBgaMDIpl5H9U=; b=hyPmH7EmAW1azNIwZKcjg1G0KTq6KOl91x34Ngp4WxuEOaoBqS/1v3G74PaMvP4R0l Uj1rMIdWdFw+b18Q4GF4PgY55dijzeknSL/1wVjA4TpiqLGrFt5SxK/8W2YqETkFfwlp OwvmGujZqAOM5eCf5yowRYhp/+lDIu9SOeB58NMln2eVTxnfzulz3k7LdX4mQbaPEv6y Ne6TQmbOObia1yBUOX696JHdF7wag2GKH15VkM+jBZIIs2K4UJM875SUS8RLLx/lgdhk 14gqe0yLFes/9fzh4amEG4E/jUghcyirArhjkLWu4o9atTao3GNqEfqIFeFcTte8jMJz km7Q== X-Gm-Message-State: AOAM532QG6V7eZ+4ZMTdR4nLHcwO0tJlFobPv7uIdbBS+EKt6M5kws83 TaFN/ll70B9fQ5PXCLbxjW4= X-Received: by 2002:a63:ce52:: with SMTP id r18mr1470379pgi.350.1632778436358; Mon, 27 Sep 2021 14:33:56 -0700 (PDT) Received: from [192.168.86.235] (c-73-241-150-58.hsd1.ca.comcast.net. [73.241.150.58]) by smtp.gmail.com with ESMTPSA id i24sm339788pjl.8.2021.09.27.14.33.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Sep 2021 14:33:55 -0700 (PDT) Subject: Re: [PATCH] fs: eventpoll: add empty event To: Johannes Lundberg , Eric Dumazet Cc: LKML , "David S. Miller" , Jakub Kicinski , Hideaki YOSHIFUJI , David Ahern , Paolo Abeni , Florian Westphal , Alexander Aring , Tonghao Zhang , Yangbo Lu , Thomas Gleixner , netdev , Willem de Bruijn References: <20210927202923.7360-1-jlundberg@llnw.com> From: Eric Dumazet Message-ID: Date: Mon, 27 Sep 2021 14:33:53 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/27/21 2:17 PM, Johannes Lundberg wrote: > > On 9/27/21 1:47 PM, Eric Dumazet wrote: >> On Mon, Sep 27, 2021 at 1:30 PM Johannes Lundberg wrote: >>> The EPOLLEMPTY event will trigger when the TCP write buffer becomes >>> empty, i.e., when all outgoing data have been ACKed. >>> >>> The need for this functionality comes from a business requirement >>> of measuring with higher precision how much time is spent >>> transmitting data to a client. For reference, similar functionality >>> was previously added to FreeBSD as the kqueue event EVFILT_EMPTY. >> >> Adding yet another indirect call [1] in TCP fast path, for something >> (measuring with higher precision..) >> which is already implemented differently in TCP stack [2] is not desirable. >> >> Our timestamping infrastructure should be ported to FreeBSD instead :) >> >> [1] CONFIG_RETPOLINE=y >> >> [2] Refs : >>     commit e1c8a607b28190cd09a271508aa3025d3c2f312e >>        net-timestamp: ACK timestamp for bytestreams >>      tools/testing/selftests/net/txtimestamp.c > > Hi Eric > > Thanks for the feedback! If there's a way to achieve the same thing with current Linux I'm all for it. I'll look into how to use timestamps for this. > You are welcome ! Note that timestamping allows to trigger many events, even if write queue is not empty. This is particularly useful when an application does not want a write queue to be drained, since this would add transmit stalls. Also, since the events are time stamped exactly when the relevant ACK are processed, they are more accurate than something based on epoll, since I guess you would get timestamps after a thread wakeup.