Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1472059lqe; Mon, 8 Apr 2024 09:45:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXsFqNfLSjuh7AoNYfoRDKAnN2uGdZu3yhZ64UTxvWxmdAQMOciy3xkDe0Y4hTDHfYazk/1xO8ylEsI9xwvsofo31uALXlmM1aGkG4GrA== X-Google-Smtp-Source: AGHT+IEEghND/y8t0wZkAJ9IlB5kEdDKBSJEGBXYEL4A8iRn6fricJsz8KoNXe51PqLDwmLJ6OBW X-Received: by 2002:a17:902:ee4c:b0:1e2:a449:da15 with SMTP id 12-20020a170902ee4c00b001e2a449da15mr8444512plo.15.1712594727368; Mon, 08 Apr 2024 09:45:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712594727; cv=pass; d=google.com; s=arc-20160816; b=bymkhgh2E6VbB8et3zceGE4LGntWaOM5sXnGiGUInyPD5cEfqBSMC6YjKv+cGbASu1 A9SCawyotFuio/9PNtWuL+KrOQ9ryybPruKQAl5CnAc2JakYSY+O3KP/5oWaWtHvWhRK voVLq8PQ/hc31eRuEyiNCVtG4mBJ0ZI8GXHtVqq4JVOvZWyBq9CfdX//dAI2a76fiXbs 7hA5HnCQhb/apF2wO64gOVb0fVFKs7VFTpn0uej5rEhZ/knU/NIGRxUXEoPk57pECMWA oKs7CKHQqF3qDOS4bsTT0ErYiycEbhnaLws/uR/x5wJE24UYl9YCrAQin81WqgXGFuJZ ITBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date; bh=P2EhArtYiqyvGPV+LTB9gPEv+phrRjdmzBmn4ktvhm8=; fh=P0rVDzQjWnr6dOAR99D3vO5Hlu8PDW5NBgMrHjMJsr8=; b=KGHaeEJJn4arrR7znDZKm5AFcGLLJ4Mp6VdZhu+VYNEtReCE8dD8c4c1LvIATyaToz YquxWcTnCpZk+7ZlVAEFniGxbSG82WaWyWCs0S77Nnk3E52E/MbENwuy7MZ40zdY5HMc fBSoUjkM1OiaLorHHqTPIvYleKcW1GqTQRtGKX26sJJ5TufCT1TDKfZlM3/lGwppimy4 f4UFPbpO6OjZeyQq18RehqKJXurFVDHYkN7yrdXRAi5eTPiuBsBFljn1AEGjibcyci5q Eaal7iQ2k7x9KT5k6G0y7nPqmF8tmkQ2/sWbnzBhFcmrPQIMvfIzkqW34O1P9qCAHEJ8 UnyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-135669-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135669-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e5-20020a170902ef4500b001ddda95075esi6863141plx.431.2024.04.08.09.45.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 09:45:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135669-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-135669-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135669-linux.lists.archive=gmail.com@vger.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 0D8B1B25553 for ; Mon, 8 Apr 2024 16:26:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA6A3142651; Mon, 8 Apr 2024 16:25:45 +0000 (UTC) Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 66AD6142640; Mon, 8 Apr 2024 16:25:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712593545; cv=none; b=eVxNdA/uv51U4fxs6A/gIm9kFackyaAjntHg4i1QIzTOB6oIfBhMVUsdBSzR3hG38vI6RwovNq0SGIKEe5pWFviIaewHVtvGGkZYzO0Rk4fT7TKPgV2d2ZVDU2C8CvjiaSYCxP3kybpN+MRROd1pyyBc8Vxyt6MdLWNw9mDLDik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712593545; c=relaxed/simple; bh=yLhAozbKSgSEEVWL2zZSEiQilYIPhxqpASbxKKAFji8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fXRE1ZqbT+pz05dMGl6GLB0dKuWMVlC7HMto8IklIwJqMv4sPqTqEdMHqeoJpdg2sPAftoiImmBHeRJ0LsPYB43LFWJldA4hDk1Qw5XBaoYaCL60OQ0WqF9mCIdHJqICihxip1A7ftKprHsFcbDT61Llc/dawk6a3bNx56Nu7yo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-56c404da0ebso7029475a12.0; Mon, 08 Apr 2024 09:25:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712593542; x=1713198342; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=P2EhArtYiqyvGPV+LTB9gPEv+phrRjdmzBmn4ktvhm8=; b=HNT6CCIGMI0VAxImhBdnCPLrn+wWGbdFZ9Tk2kUJUa1DzW+ZCRalckmthEOb6d8KGi ruH5fuG3FxRBCmg2L7qm7konRPjV0OA1+GreH8NohhkuoglUWPc20+qCN9b+hX0uovzF aGcAkCgdWPV4IKZbpZYZbS4e7tEXaJQz8+YuRWWEgJYdvUtO/ZTAhA2JWeBHaImbLTCr QbUQPKccssfyhJeEQBZnE8HMCXBp9iSVWJ/Gk6YJTk6AdhHf9ot9Ff70TPI9jtkmoxa+ C+CLnhMBhmjXiXNFufb5RXaV+ruv6/pJjgODzIQTRY49S8msz9ip2ABu5O3JQ1DsBf/Z OQ7w== X-Forwarded-Encrypted: i=1; AJvYcCWyJhImAE0oNtt10su9C6+5rYCpz3dXpCQOD08LwxLMEjFjyc8ecdaax7Qf0CGFGLkKKvXrkWPg12fOS5OKnkmXWabRo7b0Yy+xf8TxuCE9W8ey1cHtqAwlP0C5SrXFIO/2LLvm X-Gm-Message-State: AOJu0YztmbqKl/qMiP4gLFm9dToKZycMjU4bE65+hunLTICVtbWzLKiN m5qnfDG2jwzXAzvHmSMy7SC7V/DxeYhLjlvpIKVHfAexPlwtc6/U X-Received: by 2002:a50:8ad1:0:b0:56d:c937:7558 with SMTP id k17-20020a508ad1000000b0056dc9377558mr7784316edk.9.1712593541482; Mon, 08 Apr 2024 09:25:41 -0700 (PDT) Received: from gmail.com (fwdproxy-lla-117.fbsv.net. [2a03:2880:30ff:75::face:b00c]) by smtp.gmail.com with ESMTPSA id eh15-20020a0564020f8f00b0056e67f9f4c3sm766731edb.72.2024.04.08.09.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 09:25:41 -0700 (PDT) Date: Mon, 8 Apr 2024 09:25:39 -0700 From: Breno Leitao To: Eric Dumazet Cc: kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net-next 3/3] net: dql: Optimize stall information population Message-ID: References: <20240404145939.3601097-1-leitao@debian.org> <20240404145939.3601097-4-leitao@debian.org> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Apr 04, 2024 at 06:36:00PM +0200, Eric Dumazet wrote: > On Thu, Apr 4, 2024 at 5:00 PM Breno Leitao wrote: > > > > When Dynamic Queue Limit (DQL) is set, it always populate stall > > information through dql_queue_stall(). However, this information is > > only necessary if a stall threshold is set, stored in struct > > dql->stall_thrs. > > > > dql_queue_stall() is cheap, but not free, since it does have memory > > barriers and so forth. > > > > Do not call dql_queue_stall() if there is no stall threshold set, and > > save some CPU cycles. > > > > Signed-off-by: Breno Leitao > > --- > > include/linux/dynamic_queue_limits.h | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/include/linux/dynamic_queue_limits.h b/include/linux/dynamic_queue_limits.h > > index 9980df0b7247..869afb800ea1 100644 > > --- a/include/linux/dynamic_queue_limits.h > > +++ b/include/linux/dynamic_queue_limits.h > > @@ -137,7 +137,9 @@ static inline void dql_queued(struct dql *dql, unsigned int count) > > > > dql->num_queued += count; > > > > - dql_queue_stall(dql); > > + /* Only populate stall information if the threshold is set */ > > + if (READ_ONCE(dql->stall_thrs)) > > + dql_queue_stall(dql); > > Note that this field is not in the first cache line of 'struct dql', > we will have some false sharing. > > Perhaps we could copy it in a hole of the first cache line (used by producers). That is a good point. Let me move stall_thrs to the first hole. Thanks