Message ID | 20240209211528.51234-4-jdamato@fastly.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-60021-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1138198dyd; Fri, 9 Feb 2024 13:22:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEy6aB4ivxGvsKc25s9boPqPbKOa94ZypkdAK37fIOOoDLF+6qustLBj+By+se5NOacfpS4 X-Received: by 2002:a50:fc16:0:b0:560:d8e6:8da6 with SMTP id i22-20020a50fc16000000b00560d8e68da6mr100010edr.3.1707513754188; Fri, 09 Feb 2024 13:22:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707513754; cv=pass; d=google.com; s=arc-20160816; b=irxToO+SqJ19p+Hm3RSG2N6w8UxfTfpj9vL0+TC0zifmkXER6yueYdSG4tKT4wq+qq yJSod5Sp5fqac+oAHd1mcUa711GVVOtt7wECWkdYDEW8RhOLmGBP0U7ae5QhLBwkIZrZ WP994x476t+DuAUg9c1i0v07RovWuRESfegabxKgqIhg4x0H2hrYPTvsSFo5YPxvjdzx 73Kz9dTbKvAjV8lvOETgPh2VQqE7iTj1Ggh5GJ5T2ZIXUifVfTBrelNDHe8XXqieIqy4 QX6QJgT3eVumH+alSyiWFWzsQqG1w2rtKIVR4Kha75qzo3wmDGr5Kraem6Gd9Q8GcY15 9fUQ== 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 :date:subject:cc:to:from:dkim-signature; bh=G0NsVP2+DJYJlYo79AHfvXsFPLMqC3dLNa8zH3nE+As=; fh=djdNnzYjz/4yR7JXCYgc3C3fqB4XSGEes39lqDDrw9k=; b=Bm+jzUiDKVUBA0SyBbCPhmKNUfUJxk6pjG61jHj0E4pqsOz053oE+eeQaejLP8D62o Y22y0xTq9K+wyNNh6h85TDCArfiyo0QzR2s6BEaLMO4Kh1DFvAIT4WSv+b0w6oojAhwb wGjnQiq18wIjYbkhlDVBA4sSncfauFn0Z9BqLXnD34bbW3Dl7kZOrHWAFAJ+xjQDe7Zb ejK8lzYXmzEMvezJ985aA9G278X1PftlhRxdlgZjaoEdERHW4E4oqXqbk/n856qCD2FW cKpYq/nAAa0NHwJYZbrDtxGt/ivyZc2pnJHiBpWOQxFkRL2HpQ0Tq1aWTh1zDYM42eay qAPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=tG2UUo5K; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-60021-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60021-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com X-Forwarded-Encrypted: i=2; AJvYcCVBzOMha/uUO51T6nRzCRsunwYz7IAXNwhj6BD++0HzBQ9L9cviOUnNHcBdDH8X02jQdAK9M7SlUt1MMHVfgm/VETFa8w== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y19-20020a056402135300b0056022a0d6e5si123389edw.466.2024.02.09.13.22.33 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 13:22:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60021-ouuuleilei=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=@fastly.com header.s=google header.b=tG2UUo5K; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-60021-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60021-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com 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 2994D1F29E75 for <ouuuleilei@gmail.com>; Fri, 9 Feb 2024 21:22:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 828AF3B79E; Fri, 9 Feb 2024 21:15:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="tG2UUo5K" Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00D8E3A1B1 for <linux-kernel@vger.kernel.org>; Fri, 9 Feb 2024 21:15:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707513352; cv=none; b=pZKWyuI1EvPSAfhRdAOSqLO+YYq6IKlKa514FdcyntUERspKYv9PnXBd49QaAEgOna8bKJk93yC61LSIOQb1LnRYw460DqcV/VOs5ulCmYSQkrot4CRd002QpIDwid50zkC199C2IU9KQ59yTDTvDr6pGbhBbT0dW8OeeCCLy9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707513352; c=relaxed/simple; bh=CJVUUyQixO3GY5CVmRJIGygCqjREOllOxrIr3Eh94fc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jvpoxNgr1VwZWcYTrFV0ZzZWAHJ/fTqOGtkIq8BLTUeQJgAITuAVrOoRVlK37/9kyf0i27eDxTg1FAG67si/qiu35NnfrfQuys8vvCrSbjvGywn25mzf6RJInNZC345itTv8FOmb3ScLpPK77bNWnqbsg8F5UWQagwQRyjeiGhs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=tG2UUo5K; arc=none smtp.client-ip=209.85.215.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-5d8ddbac4fbso1194116a12.0 for <linux-kernel@vger.kernel.org>; Fri, 09 Feb 2024 13:15:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1707513350; x=1708118150; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G0NsVP2+DJYJlYo79AHfvXsFPLMqC3dLNa8zH3nE+As=; b=tG2UUo5Kpulb48owiZcJFB8pxTuNhFU9SFG3y6Pp2+m3iTqxdP0TNvApcT4I8+TCqd g46fYzuQUTpOtXqJJQuOh1qkYpoEarnlL0Fna8bntuGSxxCWfXSbQkAY4Ft4wi+GltSY VWO9pMWohX3ut8JEMS147DOZyzh0Q4/O3Y8UU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707513350; x=1708118150; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G0NsVP2+DJYJlYo79AHfvXsFPLMqC3dLNa8zH3nE+As=; b=sqR+lvHq9QTD7Lwf351BF3kO/DPieiBZ9BHtxg+Olf3C2lWx+NgybItnQsIAO6/03m IWrISxyJTaENcrAVTu/AqljxrcY19qtuqNCSXovngQ66Qn4KRrrV70w39VQjNSUMDjv5 yQ3V9QR5JvtZrqmly3jWoyUX4toBfx2jk614dLkxdcEbqI7Fmy/oQQTfXzPhtQt3M3VD 4n8xtRdZprDKfRCe1dlsBc8+RaeZ2lio0C/xOiBEOV/VfvhCFE/gXeyo12M2KO2Bexmb s2CkJowvP1owsb3a9q7YKVlpuA8T/4F5sWw2lgtHe+9ksf+pnupXXEbJBaw+lbjoutG+ 4I5Q== X-Gm-Message-State: AOJu0Yw+e1svK4w26G4aGQAmMYT+hpA1X3eKCmWRigPw0Iq9nj3Tj1hX 1rK4VEoK+Z+Y6rP8enhHg2OOW0Z3bmnEwsX9Y+ywSVM8KUvqUYgwZs/xbJdOkcMYjuK5FfZsjxU sc2K7h+Vv23jcdZWDWajRXDhuU3gwfso9U3Fbthh/UKQFMx0KLibfxherzuElKp1Kglylklf3IM 9BHkWBsxbBjhng7o1HbrMnYgixawel7aYCODFXvgmPOC1+6Q== X-Received: by 2002:a05:6a20:9c99:b0:19e:9a59:20df with SMTP id mj25-20020a056a209c9900b0019e9a5920dfmr417488pzb.9.1707513349972; Fri, 09 Feb 2024 13:15:49 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWNGCpYwEjdWOp9Af1u8tW2O5xfC8VpboIT36q3QoQQ0xH8ctFz596nOAMoJ6F9eyhTK4CEvJ51uFuMx4RHYRgPLExDttotnTGSfTdhT23/b36g8AFG7+uss8UnzMKMa53LRAHzowhtf0al3hzyCvrkY11h/lWzYIPynIHTbIN6G5UcjMAIPlzOVTX095Co2AVRH9cDkWKI8/1rFzGFHNlXbp85kHT81yA+mrIfbgPMAMw+U1nAeAtmV5ebnFKXhLt/PI9r5tcZhGMuVg1ZfywC+HV8IxiRKzPV/lxrB8MPOR8HgvmRPf2u0u/QI5ISX9m31W8z6zinbpMD8h2Hb4jl7zx3p4ZPGSM7XSYfzsXJNLqAmY9wa0hkB+0hnDhEMgvImlirN4gAJGlPng+ARn+AZpzmpIk4WS++qFSfmnCroCn4gOE4F+T2RUvPsGLi+7fMs3YNc5Z747JAwSsALvsjuGQ1fvuK/rQO4ph0xMzubDjDQzWiPoXGGnNdIa7pyamFRUmN5+5V2DdYXB7H1i20ZEHsDOqik5LK4JATJ3l08TuBrqHTaHawQ8+MnQomcrLFsBX9LzSWPMf7UK9UZzaVwSRWUnGTI+hnps+26D5KUGMH5xl8Lr3OSaL/c/Q= Received: from localhost.localdomain ([2620:11a:c018:0:ea8:be91:8d1:f59b]) by smtp.gmail.com with ESMTPSA id x23-20020aa79197000000b006e05c801748sm969629pfa.199.2024.02.09.13.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 13:15:49 -0800 (PST) From: Joe Damato <jdamato@fastly.com> To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: chuck.lever@oracle.com, jlayton@kernel.org, linux-api@vger.kernel.org, brauner@kernel.org, edumazet@google.com, davem@davemloft.net, alexander.duyck@gmail.com, sridhar.samudrala@intel.com, kuba@kernel.org, willemdebruijn.kernel@gmail.com, weiwan@google.com, David.Laight@ACULAB.COM, arnd@arndb.de, sdf@google.com, amritha.nambiar@intel.com, Joe Damato <jdamato@fastly.com>, Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>, linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)) Subject: [PATCH net-next v7 3/4] eventpoll: Add per-epoll prefer busy poll option Date: Fri, 9 Feb 2024 21:15:23 +0000 Message-Id: <20240209211528.51234-4-jdamato@fastly.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240209211528.51234-1-jdamato@fastly.com> References: <20240209211528.51234-1-jdamato@fastly.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790457942272223327 X-GMAIL-MSGID: 1790457942272223327 |
Series |
Per epoll context busy poll support
|
|
Commit Message
Joe Damato
Feb. 9, 2024, 9:15 p.m. UTC
When using epoll-based busy poll, the prefer_busy_poll option is hardcoded to false. Users may want to enable prefer_busy_poll to be used in conjunction with gro_flush_timeout and defer_hard_irqs_count to keep device IRQs masked. Other busy poll methods allow enabling or disabling prefer busy poll via SO_PREFER_BUSY_POLL, but epoll-based busy polling uses a hardcoded value. Fix this edge case by adding support for a per-epoll context prefer_busy_poll option. The default is false, as it was hardcoded before this change. Signed-off-by: Joe Damato <jdamato@fastly.com> Acked-by: Stanislav Fomichev <sdf@google.com> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Eric Dumazet <edumazet@google.com> --- fs/eventpoll.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index ed83ae33dd45..1b8d01af0c2c 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -231,6 +231,7 @@ struct eventpoll { u32 busy_poll_usecs; /* busy poll packet budget */ u16 busy_poll_budget; + bool prefer_busy_poll; #endif #ifdef CONFIG_DEBUG_LOCK_ALLOC @@ -438,13 +439,14 @@ static bool ep_busy_loop(struct eventpoll *ep, int nonblock) { unsigned int napi_id = READ_ONCE(ep->napi_id); u16 budget = READ_ONCE(ep->busy_poll_budget); + bool prefer_busy_poll = READ_ONCE(ep->prefer_busy_poll); if (!budget) budget = BUSY_POLL_BUDGET; if (napi_id >= MIN_NAPI_ID && ep_busy_loop_on(ep)) { - napi_busy_loop(napi_id, nonblock ? NULL : ep_busy_loop_end, ep, false, - budget); + napi_busy_loop(napi_id, nonblock ? NULL : ep_busy_loop_end, + ep, prefer_busy_poll, budget); if (ep_events_available(ep)) return true; /* @@ -2098,6 +2100,7 @@ static int do_epoll_create(int flags) #ifdef CONFIG_NET_RX_BUSY_POLL ep->busy_poll_usecs = 0; ep->busy_poll_budget = 0; + ep->prefer_busy_poll = false; #endif ep->file = file; fd_install(fd, file);