Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp697922lqs; Fri, 14 Jun 2024 03:05:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWJDSiOwOLSIHLJOdJfw//1n/6/6VEXEFw7s2ZKgd0dRAvlj1NV0tjDk0YXwVaDyZRYBTRISSqP5krl4Diw+bfnv9mIBdNrpsJWwQ/rsQ== X-Google-Smtp-Source: AGHT+IEkQ1prk6JY2+bQdR/FUhqcSV4tvpoXiL8FIX9k83mDFel3n0GsdmtAAhg9kBIF8hR7UCWC X-Received: by 2002:a05:6870:b61e:b0:24f:cddc:ccfe with SMTP id 586e51a60fabf-2584257ea5emr2402077fac.0.1718359541274; Fri, 14 Jun 2024 03:05:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718359541; cv=pass; d=google.com; s=arc-20160816; b=EEWGMiSUfJ6PvpH7a89wwpILbjgEXt0vQs/a6dhpuz+aayNfRMs8grkbs3lcykKnTf CYt+4DCVuYYU4PTLFpewI/7cUCMM2lJSYBUwq0MeS+YQG2jeqQvLwyjmq9V8UegyX5Au gOsd18qg6PDX+awEdkenPIod5K8WxHkYYIcqrN0F1rK1lVwWLPWJ9AXgpWd9JHOlpoIh PY3RW9QRtXCc4KjbFu0op6KFDGKB5NUYTwDYwIOZT7/AtnTSK69kungNZcDGJ9rmXctQ 5jRJqXaGCtN0haLf/j7PyPVNIEupaQl5rGm3q7sfx23wOHHO5y8oUBw6IduPfn7UuYzM fofQ== 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:dkim-signature :dkim-signature:date; bh=TlDxMWO87rdlhcTBOawUMW+iHXoaV9SzKYnYt4EAeLo=; fh=bLiDXzh9qIMcqmvPEnuHnBb7F5rXjDfovQFRdTx/7eg=; b=0Typ83Jtw6L+YqkW2+s+lFLCgkVyrgGy4GT0VnbPJQQK82QxEPDHvPBTKWfXa9u5vx WqiXAFX7OwbEpKivXfgFy5T77DqXwnNpTblHorg4+ct3M/GBdbnjmR8UK8mJbibghT64 ylB+L2vPoMgBCjHgRnv4m1/grFhOX9i3ZkazosrRzadI1TouR8nhouWxxTb7bW/zeZ0Z Wvp4RRxpeMwbd1TDtoaxKEf/rox3ZImI7Vm7IAbUUTmr4oJ8mOc/xWy3wRAi5+RVP8Tm HGZ+S5WtmN107bc5Y52+ujrWzeWSVyHBa6HqtMpdm0mvLZaSocwxvP4c16PavlOqljVU O6PA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GbypNhf0; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-214694-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214694-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-705ccf18b6asi3352511b3a.227.2024.06.14.03.05.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 03:05:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214694-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GbypNhf0; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-214694-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214694-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 6830828F883 for ; Fri, 14 Jun 2024 09:55:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 26171194AF5; Fri, 14 Jun 2024 09:48:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GbypNhf0"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="XP1qqB9z" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 8719A194A64; Fri, 14 Jun 2024 09:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718358495; cv=none; b=SxRHxeyDozLb/IlXhuVANqmikpwyzJR3VNe1L7mIf9AxDFF5qJiAMRd3zR4ZaNJepe01qKQvba2EiqhNUC4oDAg9gobRBdPkRyDXNwsk8A+s7weIbJlm8cgHc1YH5h/4almPP8h6Md1KvZD7QRoWh2jdbT7fgbApczN482sY2ck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718358495; c=relaxed/simple; bh=85C5AS+ZySgPD7husJ3KBKPehqUc5jvt/XoisWXFmBM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=puBqC2VaW7/NB50gzK64/OzvMD2fKHBzDSU6BbsYAHCTmC8aMXxVkJXr5Db6MtLzqUOxKd1lp8mKOh0w/3bvsyJJEeQQZH1yjF4oAZv/Z6JYcTAjJdrHQOICxtRzm+RIRe4CH6xwJUmdlumQFRu9zzSF8xLkZckKAAlO2WMQFF8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=GbypNhf0; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=XP1qqB9z; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Fri, 14 Jun 2024 11:48:09 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718358491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TlDxMWO87rdlhcTBOawUMW+iHXoaV9SzKYnYt4EAeLo=; b=GbypNhf0tm8Zlh7iSBTg8QZ/yY5tv9S2tg+jRkdLCZ5dGSdVfBcFYYrQ9gTf9tPp9bCau/ PzLqqDGPe1rLvWm6Vu5NhMOS2xzfyLouFdKyzEyfLEOSuGiuQp154H4oOS1pG3bHNytvUk E/a8D9LvjLfaymILvw8Vkx1B+IvpFc9kXDXTmOv8JwKo+ewm+ofR7GKml5GYc0W1lFGUWq FMoQkJY9tNAexcqozw1LeR7EI3xFfxEl0tWLXo+yMaYflT3AkkYyR6qTLsZ9MqhC9wV+Dn ENW7U0m7QyJKTqe+7Ky6gz1suuE/7CqQ6dya7ngl8nX3kixjhuJdt/hASMeENw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718358491; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TlDxMWO87rdlhcTBOawUMW+iHXoaV9SzKYnYt4EAeLo=; b=XP1qqB9z/GVDT2GavGHbytzUJCj5HAzBNfWCpSzxyeGQELRESvJhNkBby4SKKmOEqIo0oH 67SqKPcsoFTchQDg== From: Sebastian Andrzej Siewior To: Eric Dumazet Cc: Steven Rostedt , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Daniel Bristot de Oliveira , Boqun Feng , Daniel Borkmann , Frederic Weisbecker , Ingo Molnar , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Juri Lelli , Mel Gorman , Valentin Schneider , Vincent Guittot Subject: Re: [PATCH v6 net-next 08/15] net: softnet_data: Make xmit.recursion per task. Message-ID: <20240614094809.gvOugqZT@linutronix.de> References: <20240612170303.3896084-1-bigeasy@linutronix.de> <20240612170303.3896084-9-bigeasy@linutronix.de> <20240612131829.2e33ca71@rorschach.local.home> <20240614082758.6pSMV3aq@linutronix.de> 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: quoted-printable In-Reply-To: On 2024-06-14 10:38:15 [+0200], Eric Dumazet wrote: > > I think it should work fine. netdev folks, you want me to remove that > > ifdef and use a per-Task counter unconditionally? >=20 > It depends if this adds another cache line miss/dirtying or not. >=20 > What about other fields from softnet_data.xmit ? duh. Looking at the `more' member I realise that this needs to move to task_struct on RT, too. Therefore I would move the whole xmit struct. The xmit cacheline starts within the previous member (xfrm_backlog) and ends before the following member starts. So it kind of has its own cacheline. With defconfig, if we move it to the front of task struct then we go from | struct task_struct { | struct thread_info thread_info; /* 0 24 */ | unsigned int __state; /* 24 4 */ | unsigned int saved_state; /* 28 4 */ | void * stack; /* 32 8 */ | refcount_t usage; /* 40 4 */ | unsigned int flags; /* 44 4 */ | unsigned int ptrace; /* 48 4 */ | int on_cpu; /* 52 4 */ | struct __call_single_node wake_entry; /* 56 16 */ | /* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */ | unsigned int wakee_flips; /* 72 4 */ |=20 | /* XXX 4 bytes hole, try to pack */ |=20 | long unsigned int wakee_flip_decay_ts; /* 80 8 */ to | struct task_struct { | struct thread_info thread_info; /* 0 24 */ | unsigned int __state; /* 24 4 */ | unsigned int saved_state; /* 28 4 */ | void * stack; /* 32 8 */ | refcount_t usage; /* 40 4 */ | unsigned int flags; /* 44 4 */ | unsigned int ptrace; /* 48 4 */ | struct { | u16 recursion; /* 52 2 */ | u8 more; /* 54 1 */ | u8 skip_txqueue; /* 55 1 */ | } xmit; /* 52 4 */ | struct __call_single_node wake_entry; /* 56 16 */ | /* --- cacheline 1 boundary (64 bytes) was 8 bytes ago --- */ | int on_cpu; /* 72 4 */ | unsigned int wakee_flips; /* 76 4 */ | long unsigned int wakee_flip_decay_ts; /* 80 8 */ stuffed a hole due to adding `xmit' and moving `on_cpu'. In the end the total size of task_struct remained the same. The cache line should be hot due to `flags' usage in | static void handle_softirqs(bool ksirqd) | { | unsigned long old_flags =3D current->flags; =E2=80=A6 | current->flags &=3D ~PF_MEMALLOC; Then there is a bit of code before net_XX_action() and the usage of either of the members so not sure if it is gone by then=E2=80=A6 Is this what we want or not? Sebastian