Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp587461lqp; Wed, 12 Jun 2024 10:03:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUO5Ng28LY6cPQIm2jRGn18w8hmEL+QQ14WHj5M2LsiDIMty0e/C7MAjl/ibD5XzJIEje4WxLGPfBJUXmCuGPJazIzzqCkmJhVa79MWig== X-Google-Smtp-Source: AGHT+IGvDhUUKCCH0F9gxvDs+jDqg0lcmhCYCkgYnyQ6dGlXobUSf8CtMJ6Ctv8XHVj/ZpJju3FG X-Received: by 2002:a05:620a:24d2:b0:795:5e1d:4c with SMTP id af79cd13be357-797f6112ec8mr273447285a.64.1718211828766; Wed, 12 Jun 2024 10:03:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718211828; cv=pass; d=google.com; s=arc-20160816; b=j9oiuptnLRF5jpYbZ7OUXLojWBvMCS9ufHm3T3vZKkeMOGyuX6lpoxJ8GlaAag31Rm f+zidnj4XldrFj6ww0/XydG57AI7W0ZsH1wQAbMOIpBg311VQk3vNg4MauQshEiDZ9Ck riCSgd3EBeqBJMnHSTT2Eja0qGjDaC//iXxUqETWjkHqUcEWyQm5ywz8sFZPAyTBQATq 5JgTqDxhtDL0ZqbtGAfEZ+boto/fgv5TBmPy1OnrxNiNs9LXqdxIHghJAnqGuAV/yMYU yPP6KrjVTomKHG/9OJpd76mB+wW8BeHBX+lS2BLK1kfRRJTLQJY09kfg2/eAtn6rvBYm s7CA== 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:dkim-signature:dkim-signature:from; bh=MjDH1aZopl/PB/1qPdF+A5rutVmzd0668ZVYnzeXpm0=; fh=pdglhcY7hn43FRujNlflNhJmhVsdAI6S//OyMfKpxfg=; b=rm01Tw5f0mBc4GWP1cvBelzzOsqs21D5PJnhdd4UdvNqhri6SLwLAFizMd3Imiq1Vw lvsUi4I2AtJeZPdBqKqPPscKoYcDubrJBtVnR+CMkfbxEMETwe7VOU0uoj4jB6hXHRaF oew3qG4KNCqWxgxnYPII1vLUY6J1+zmPPCyseorTxOiExVf3ufiygeinAdmAdyL28VRi ZuadFcZNAz8JnHLTTP/GYMwHhN6A+Y65AoUZxh8hry83YkXVtA9PG0henq1KImHpK3JY PZSm94WmBoTQtGyn+/RdJrrad5pIEBJ/lwD3a5HvkOrgEufxwjeQr+Bh5tebMKW/6owK zQng==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dIY7CBjL; 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-211961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211961-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-797b3267464si595431385a.287.2024.06.12.10.03.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 10:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=dIY7CBjL; 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-211961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211961-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A353B1C21106 for ; Wed, 12 Jun 2024 17:03:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B15C1822C8; Wed, 12 Jun 2024 17:03:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="dIY7CBjL"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="rVrWllcR" 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 2A02B16C84F; Wed, 12 Jun 2024 17:03:20 +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=1718211802; cv=none; b=SawT4knOUGs4LoxRI4PLhv9I9oW4RFCLfmIKxi5QHgJPolGs3UCkRlCPZiOHEgqJxELpX5VccV4wN/2qyZISPuAQTd+dg9d/N1ipNoRITTym1s39C9j5umRtbKH1b6+zDl6fSyVmXz9mExJtQBH8G06WYQSj1UAoXjdpi6kQwL8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718211802; c=relaxed/simple; bh=bghL6tgmgkRzlloyIs229ULAO8wmcKFlVMxXqGEhuGQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GLk3mfY7rnfCFAIjMrDVt7sawk86pabvVfMlmgfTd+8hDcrqKw++gGaYiiEHkZjXIkHyNwcQf+t4jrqKdj1RPXBG/sSdecclq+37kKlYP7Dwt91YGoxnp7lwXo+hZAQ9bXpv764VIeoWU7BclGih2OT+z5yEXCyFCZyww4R16VA= 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=dIY7CBjL; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=rVrWllcR; 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 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718211794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjDH1aZopl/PB/1qPdF+A5rutVmzd0668ZVYnzeXpm0=; b=dIY7CBjLk6lEhwKYIH+U2MenkAgha0dy6pZP+cRjxE3Xn/9CcnlPgy++vEQI0wc/5SM3SX VMWdnICH7K2d9C+JRyCS3cHShlgN5mxrCnfATbWuf/6NyahyS2rHZNpnwVZ1LwZG/S58J0 Ey2hXaAQ6IMAStd1zYEHSGScpPDROWGJZVNtYiwUcyZHvzNw6ZLXk6e9vayMuEG7Ri5xbV PvmhbWF2ILy2aByiveOMwSyj+dJ2YsXsrPY/quFaeuXoenAkipCjBQdfVKjwAOvAgIWiQS tnUyH8kyRD1Du4M3uqKqNJccTy+tm+ti7MagsFuIM0rHrO53Rp+i2Y1jRVU79A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718211794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MjDH1aZopl/PB/1qPdF+A5rutVmzd0668ZVYnzeXpm0=; b=rVrWllcRSY9RQ9TOfCnjukYn/Sr+gMr6QuQwyvcRHuMvJvGq00qrfSHQmg0xKlx6eiAf7N m2mDL/zTnzrXEKDw== To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: "David S. Miller" , Daniel Bristot de Oliveira , Boqun Feng , Daniel Borkmann , Eric Dumazet , Frederic Weisbecker , Ingo Molnar , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon , Sebastian Andrzej Siewior Subject: [PATCH v6 net-next 03/15] net: Use __napi_alloc_frag_align() instead of open coding it. Date: Wed, 12 Jun 2024 18:44:29 +0200 Message-ID: <20240612170303.3896084-4-bigeasy@linutronix.de> In-Reply-To: <20240612170303.3896084-1-bigeasy@linutronix.de> References: <20240612170303.3896084-1-bigeasy@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable The else condition within __netdev_alloc_frag_align() is an open coded __napi_alloc_frag_align(). Use __napi_alloc_frag_align() instead of open coding it. Move fragsz assignment before page_frag_alloc_align() invocation because __napi_alloc_frag_align() also contains this statement. Signed-off-by: Sebastian Andrzej Siewior --- net/core/skbuff.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c8ac79851cd67..656b298255c5f 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -318,19 +318,15 @@ void *__netdev_alloc_frag_align(unsigned int fragsz, = unsigned int align_mask) { void *data; =20 - fragsz =3D SKB_DATA_ALIGN(fragsz); if (in_hardirq() || irqs_disabled()) { struct page_frag_cache *nc =3D this_cpu_ptr(&netdev_alloc_cache); =20 + fragsz =3D SKB_DATA_ALIGN(fragsz); data =3D __page_frag_alloc_align(nc, fragsz, GFP_ATOMIC, align_mask); } else { - struct napi_alloc_cache *nc; - local_bh_disable(); - nc =3D this_cpu_ptr(&napi_alloc_cache); - data =3D __page_frag_alloc_align(&nc->page, fragsz, GFP_ATOMIC, - align_mask); + data =3D __napi_alloc_frag_align(fragsz, align_mask); local_bh_enable(); } return data; --=20 2.45.1