Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2662797rdb; Mon, 5 Feb 2024 13:36:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEEyNN+FMAZDWN3dM3TV5t4WWUoJpjng0HfBRzE22w1Cj6enl6B2lTE8wnKwqGz4rU+B46m X-Received: by 2002:aa7:c342:0:b0:560:12cf:c83 with SMTP id j2-20020aa7c342000000b0056012cf0c83mr371636edr.22.1707169017536; Mon, 05 Feb 2024 13:36:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707169017; cv=pass; d=google.com; s=arc-20160816; b=k7YIfRWvIUSbFDThVVJqAH2HDNhp/vmLFl2L81ym5jkhLbKlnsiB01SDW+9FxGBy9O RrowDdOOuYsQqMAN7/Yb/7+tCI1uYq2YYuLtcz8AuVQg82BipzAPtoHjsVTpwofRg+gM ykeuE+0ymruhIlh+BD2eAP2Vh+TASx6zqWM5SL/fkiT2anTFLhgCrqtT+ObnpYUYE7US CJ6jgu4fL9+61mJpcb/v3quScymMVMc4f0+kOoardiWU1PzxKwT8a7uBA4blkyLIdYR6 ItXpfLGtRuML1vSxdV9dWB7L41LkZmokAElNgXUAZfSCliFn1ZfFeWMBgWJKxdrPkTtA /XTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=eklTjBg89YKazC1peSM8126WldMO/ZjVxJCCMIamxkU=; fh=anBb4LajQ+ET4P6TQ81vjiDHnY/9/ALkYtVtHVLt4rE=; b=Y73KTC3vZs8GRWQkwiOayRnfjUVueqEiMmQ2aCbCzHkyvLvoq2F19Qci+EA3NJ+ys8 AzW4ejcv9IoN0G0pKZe6bD7a0MV6Kao/fBn+V2xXUvY3WGcP22KeXrRUK3MEKLN+7DnK 9cvjLTWAwsZtF1lXXmDr980h8spFo2xsXKU0GcO8k/n0CNdCWxSeja+jQFKfn2U1dzxS s/GXasrJsP1jUsxHpZsIqpqwkJIGL5wgqr+N7DoRU/2xpp7ZFZrBjtJRUFYWR6wykH61 TFl5ll+j62kdGgX8ty+PzcIZYyiHlhPA9Ot8rLcqibgEeoJ74NsKSKp+U2Pu4tvSCQ9b PK7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EgDhUO0C; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-53880-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53880-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVzhaDH01QyHo4JjaSSEQx+9Lb8D4P6nRydLYt3q5/Pv4vWyyoRcajtyJzVsWGk6PQgWlgOt8Ueqb3gtjexXnldYFqKdwQnli0hDGvUHA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n3-20020aa7db43000000b0056062e07425si301924edt.263.2024.02.05.13.36.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 13:36:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53880-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EgDhUO0C; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-53880-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53880-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 415271F26444 for ; Mon, 5 Feb 2024 21:36:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6872E127B48; Mon, 5 Feb 2024 19:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EgDhUO0C" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D987482FE; Mon, 5 Feb 2024 19:59:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707163197; cv=none; b=hPT9CRb+GUyi3I0a4VEOLoyWYE4eGeqFs/H+p1uE99UEjLNtxtIwotruwe2P92VzfjJM6NXEpw55brSdHDrf+8eHLRGMtez31QRbhuAzFYXxUlmkgoC+aD6PnQ45NQfn0D8yPCnOhAH1956pzL7Az+gl0gHrqdvaRsREQ6MP0co= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707163197; c=relaxed/simple; bh=rAvvqDnfZeAp295dKfcQtZOZPde72TlT5r3yx2DZBF4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YXssXza0lyt4sUi6m5d6mBrTy9BRdWCDmicO5JznnQDEYTDfcgj4MI20xtvojW6E4x1+hX9OAfG9N4KfSna85CffkLL3F5uKIY9g6Q9+qDOwfwgJKV3q3j4lgI/BR427XvLSc0GBc4A5Hux37BshOSOnOdI9l4Sd6atrCqhwvlo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EgDhUO0C; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5B74C433F1; Mon, 5 Feb 2024 19:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707163197; bh=rAvvqDnfZeAp295dKfcQtZOZPde72TlT5r3yx2DZBF4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=EgDhUO0C4lOhCJkeOA7I6SmBbl4eCzlG1gviuIUcejV/W1MYgpgf2RBb572z0+hzj TWq69eDLPurUWHZTlkfBHRu3wWaKr13LlUr9rgd/j4CiTEgfP5wYltEclz8IFA+qUB nMvEQ2JmAP+2y5o4xWxEgEr06KIutrd+Oy2qM1QIzst4/ni1Et0Jgk31pWyeE0PoWL i4L3ElpOwI8fjurwbRFXKVGMWS04LZ38simXTnPhV1S/SUaB8Y6ICOlPxZRfI3zTyF 0VsZHsN/91OJQuHgwoetepAfujLll9X4yVVOQ0oaZit158gmB/qJuiaNPh12iy/GF+ MuxRaOkTVYGqQ== Date: Mon, 5 Feb 2024 11:59:55 -0800 From: Jakub Kicinski To: Joe Damato Cc: "Samudrala, Sridhar" , Eric Dumazet , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, chuck.lever@oracle.com, jlayton@kernel.org, linux-api@vger.kernel.org, brauner@kernel.org, davem@davemloft.net, alexander.duyck@gmail.com, Wei Wang , Amritha Nambiar Subject: Re: [net-next 0/3] Per epoll context busy poll support Message-ID: <20240205115955.5cde5a13@kernel.org> In-Reply-To: <20240205185130.GB10463@fastly.com> References: <20240124025359.11419-1-jdamato@fastly.com> <5faf88de-5063-421f-ad78-ad24d931fd17@intel.com> <20240202032806.GA8708@fastly.com> <20240202102239.274ca9bb@kernel.org> <20240202193332.GA8932@fastly.com> <20240202115828.6fd125bf@kernel.org> <20240202202344.GA9283@fastly.com> <20240202171539.7347cb01@kernel.org> <20240205185130.GB10463@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 5 Feb 2024 10:51:30 -0800 Joe Damato wrote: > > We reused the gro_flush_timeout as an existing "user doesn't care if > > packets get delayed by this much in worst case" value. If you set > > SO_PREFER_BUSY_POLL the next time you busy pool the NAPI will be marked > > as "already scheduled" and a timer is set (to gro_flush_timeout). > > If NIC IRQ fires before gro_flush_timeout it gets ignored, because NAPI > > is already marked as scheduled. > > If you busy poll again the timer gets postponed for another > > gro_flush_timeout nsec. > > If timer fires we go back to normal NAPI processing. > > Ah, I see. From my reading of the code in busy_poll_stop (which could be > wrong), defer_hard_irqs_count must also be non-zero to postpone the timer. > > Is that right? > > If so, I think the tricky thing with this is that these settings are > system-wide, so they'd affect non-busy poll apps, too. > > I think in the ideal case being able to set these on a per-NAPI basis would > be very helpful. Maybe something for me to try working on next. If wonder if it'd be good enough to do: min(defer_hard_irqs_count, 1) there. If caller asked to prefer busy poll they clearly want to poll. An explicit per-NAPI API works too, but it's a bit more work. If I was doing the work I'd try min(..., 1) with the workload. If there's value in having the full config - go for it.