Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp156732lqj; Wed, 10 Apr 2024 07:02:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWTK29OGtb9kHggHH+KRtJarFWQs9FN4QPcgPOnc4PElsqGyE2/9qGS0LTdSSrZhq3GRfjqmdN4vRwN0XCnAsFmLLvrBY7teBmye7bT2A== X-Google-Smtp-Source: AGHT+IFCJHS+TPEXAvcK/OdI81rQui1yRpGlAfTi8B5roQ5wf+M8uua4GoruT/nzHco7P2pi2p7i X-Received: by 2002:a05:6122:3b81:b0:4d4:4ff8:c367 with SMTP id fs1-20020a0561223b8100b004d44ff8c367mr2143744vkb.6.1712757726658; Wed, 10 Apr 2024 07:02:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712757726; cv=pass; d=google.com; s=arc-20160816; b=p0Xc+SLzfHUeBmliDh6mRPWaEp7uz4BSaCZNDP/8IZ9poZ0B6lXQcO7mtuXChW69ch a13fMoDO5zTJrFM3kWCxPIjO5WDkspuuMHHBZHVWqlcul6YJqSQld9NvUgrTPNps5T0M kmBMvK1u+dXZwnELwy2Tm+c1Taz2042dAK9SOwMvCDEBxG9M+C90hrOMaKftUcjdqnqn 6DpbZO05NVfj+y5vGjPQxH3uZlq57soXdKaYsNhbCBjBfaszpvp3/+xa+P1gWY539QZW 9wXSF0uCw6/JYRZHH/jjtbZJOaxgvsRtr3WK/KGGlv0W09w1WJ8kFzRPv8RhRg03duV6 lTMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=2+nHNpjc7nbxViZPMz2OFh3H9yMSlCGh2OFCJgFJuZo=; fh=n8IgcVSs51DKkNNO8Neeppf4KYdNOlhoxuFMWToGxHo=; b=SiFJixapprv2q0JRBrC7dmMq+zA95FTvRAqRLfD9ZzmuXp9S2za0sIyPpjMqm8+i9D 2c34/hVblXoERWrrgUoKjfIBlOW+g2gj4jcXVIOhcRMLflmT5qyYsHpmVgZ8m0NiXE7h OLAwLEeg8nGx0CMavuEQ8DcGv6M7F7tAGlLsI3SIH4TIiI6710SWUbBF9usSC9mDHPJh qRPz4OUWLCn1IfblOTBzHJtERDorDtUQeiLpqXdcE8QGwJeQ1gztI7tcccZAX2vEe6rs EntJRajEGGWpPG/Iz5Y433/bE4FIUibRP440/iIA5goN5B9ZQkx+rE0jgzOETYJejPES TuLg==; 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-138684-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138684-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w11-20020a67f74b000000b004787e69ee57si1560254vso.591.2024.04.10.07.02.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 07:02:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138684-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-138684-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138684-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 298B61C278A0 for ; Wed, 10 Apr 2024 13:58:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC4F816F26B; Wed, 10 Apr 2024 13:53:02 +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 94F2915FA6D; Wed, 10 Apr 2024 13:53:00 +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=1712757182; cv=none; b=VouapikejDUDKDB6J9pdD9uJmUdjtPMwQPUwocg8rjLfAo+N7f+RUn1kPY8orL2oJb0mUkPnnM8vsct02vzk6WqbqZJNZ48QkfRJu1Y6qcymaRe4ZoECNR1f3FaMSPhK2ten4XpHAS7zbLF8PISds7YIbxZQFZkLJDp5D7yaxQQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712757182; c=relaxed/simple; bh=eQCGM2hLXlsELqKGuPmo5wliilM5OD/y4FEKpn+8sGk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BBtS8+DxXH3AT5A7YMrNvOuockvJTmjDDXyTy8C7Y9+PsrMZ3OKPfM3QDMJ3NAh+RXkoFt3CCc7JHAcj/DmwZCxBRd8uPoZ9ofRO8d161X/TqfYDxxJGyUV/ASvTMUqf5oHkucXAGrEWw1bNbKAGGyfPjq5fdOQzUDIzHdFh9iQ= 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-56e56ee8d5cso5168267a12.2; Wed, 10 Apr 2024 06:53:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712757179; x=1713361979; h=in-reply-to: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=2+nHNpjc7nbxViZPMz2OFh3H9yMSlCGh2OFCJgFJuZo=; b=Z+VaWFsbPVq6dDJWUOb9pXZQRfcGKH+czXiR4CetyKNmrr1ZhWVE1QEZEqVHkUx5cx /QnBhUewDWTZC69ESUrpXjhSCfVcY6weUmiWR/V0Q2Ih+uSpwfMM6v/dvq9JksJlXBzf ObHxU3ICh/zL2FbqMk1TFlfVIW2diWpw+CWMJ+94WySYY4alFX3wVWfPkQTNVlQhOycd bQfWrg1SMxife+J894iHBq4EzP60I/urKIG/pZkbu5eqFuck9iuIjh4nZW6TSETiQLUw TgwJVT45/wiPzR/gAryhIENfjC3MXE8y3dsw2PSrGQDvOUYyMJMbVX+fzCf6zltjA5cG Aojw== X-Forwarded-Encrypted: i=1; AJvYcCWnFBsOoFGFYjBtda9voFAYrpPvnThjcyBn/zOaHrSPX9X26Ce6wYnd/vfKbIZWGtNAuLl2jgVf0ljdEPK4Crgqyy1yyA8NkEDLfwck8YenuJ8w77NBrToJZaDNAfHcM57F4J15 X-Gm-Message-State: AOJu0YyOqdZv0Dm/uJjmub/ue6vSCXoSm0wKpOEpIalSVULZls3GLFJA OAUl4kLxb2ZPSdJXZ7BA2Hb5FxriCiSM+Yw8KRd8GtR5Y9YA5S1fRSAyT437E94= X-Received: by 2002:a50:8a84:0:b0:56d:c722:93a3 with SMTP id j4-20020a508a84000000b0056dc72293a3mr2098616edj.21.1712757178778; Wed, 10 Apr 2024 06:52:58 -0700 (PDT) Received: from gmail.com (fwdproxy-lla-007.fbsv.net. [2a03:2880:30ff:7::face:b00c]) by smtp.gmail.com with ESMTPSA id t9-20020aa7d709000000b0056e785e6b46sm1520621edq.3.2024.04.10.06.52.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:52:58 -0700 (PDT) Date: Wed, 10 Apr 2024 06:52:56 -0700 From: Breno Leitao To: Jakub Kicinski Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net-next v2 4/4] net: dqs: make struct dql more cache efficient Message-ID: References: <20240408172605.635508-1-leitao@debian.org> <20240408172605.635508-5-leitao@debian.org> <20240409172149.6f285b68@kernel.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=us-ascii Content-Disposition: inline In-Reply-To: <20240409172149.6f285b68@kernel.org> On Tue, Apr 09, 2024 at 05:21:49PM -0700, Jakub Kicinski wrote: > On Mon, 8 Apr 2024 10:25:56 -0700 Breno Leitao wrote: > > With the previous change, struct dqs->stall_thrs will be in the hot path > > (at queue side), even if DQS is disabled. > > > > The other fields accessed in this function (last_obj_cnt and num_queued) > > are in the first cache line, let's move this field (stall_thrs) to the > > very first cache line, since there is a hole there. > > > > This does not change the structure size, since it moves an short (2 > > bytes) to 4-bytes whole in the first cache line. > > Doesn't this move the cache line bouncing problem to the other side? I think so. Looking at dql_check_stall(), it only uses fields in the second cache line, except now 'dql->stall_thrs' that is in the first cache line. > Eric said "copy" I read that as "have two fields with the same value". Sorry, I misunderstood it. I can create two fields, and update them together at the only place where they will be updated (bql_set_stall_thrs). > I think it's single digit number of alu instructions we'd be saving > here, not super convinced patch 3 is the right trade off... Right. I was more concerned about the write barriers (smp_wmb()) inside the loop which happen quite frequently. But, if you think that the this is not the right approach, I can drop this whole patchset. Do you think a profiler will us here? Thanks!