Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp195512lqb; Tue, 4 Jun 2024 08:45:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWVlxY0CwR4sKRFFMxY8WWlFCbne7vchmUG+Qyotp1LSfmj2p3RtkgAw5LqXaXONp5c6WDXW+qTUP9h5P5cnhxk8oL6Dv0Q6SNC1TzduQ== X-Google-Smtp-Source: AGHT+IHt12XmW0EkWisF9O/ZECtvrGQdXpAMSbpGcg1uA+YHE+tyn0+VT+lEBHGsvKKKwEKv8dTo X-Received: by 2002:a05:622a:14c:b0:43d:f0e4:65ef with SMTP id d75a77b69052e-43ff525b01bmr152412441cf.4.1717515951972; Tue, 04 Jun 2024 08:45:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717515951; cv=pass; d=google.com; s=arc-20160816; b=Lb5N145dlAkosjpLetLf7RteiH4jEAAYlb9NgDxG1xamFrCQ3szpTRBTrGJxKbaRkQ SMejynvZu7fnu10lB0mVUdCFNKhJxxhvOTKKLGvRAmVWvSdXiaVIRLnMO/1/a/PwACBL 2RnSLp2C8Y+iuPHgKkv7wVbHgDu1JxNDV71a/yqOSAjM1lONtarHISm9u9/aRDjmagLh zFC/i1MHakUQbBqxxtQjEPshW2i3vvUs7vvrKbCl4KydjB8aUKgasDPIM/H3XdU58J5Z /i1Qe3h72q+npncyXn+LNT8zVD4QWOirKsD2mxnX5N4kVCKtfSO40DWoD4N5WQr9qVab DPlw== 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=jc9kVwpT1wazRgJL8VSyOnTf3zyLearQK1DZf1xb140=; fh=pdglhcY7hn43FRujNlflNhJmhVsdAI6S//OyMfKpxfg=; b=Jwd0H0FGyporyGKZ+NIvRdorjU3n4SVMfsJwA4T7LT7pmVzZ0WMOm6WiZA66XUC5tq vWBCKXNHF9Bj84M6Cm2nEfSZ+WEH9g1qeAw49IsZfkXyiX0+SMTluhg0UGXNbBv5FSLp YULn/6dxKeV2+kk7OVD2zUPqhPn8uS4G9J37l8a2raRmtW33iMer9q+4HMGgf1z+IG7R pbtSZQMjh5eI/CGyYXjSgQBCuNulDXdSAO1dSVmPV8BTGAczgfvpUxq2jYy9syh1MEOi bVHkkYovu40ssJa3c4sr57DhnBeRqL5WpWj5/BZlu6nC6Ou5avE0kTDF64xwVFjYd/94 p1Ow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=viC6lkgC; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lbgcgTVT; 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-200983-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200983-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43ff259d289si28781891cf.620.2024.06.04.08.45.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 08:45:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200983-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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=viC6lkgC; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=lbgcgTVT; 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-200983-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200983-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 54DF11C24FA1 for ; Tue, 4 Jun 2024 15:45:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C33CD1482E9; Tue, 4 Jun 2024 15:44:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="viC6lkgC"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="lbgcgTVT" 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 885EA144313; Tue, 4 Jun 2024 15:44:49 +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=1717515890; cv=none; b=nMb7AkzQcaML8fr/VIUn/imvi2c/c95NIKugl4AzBAU4uWR2eHcEUuEB3LTp0lKP/sueauMpTMEIiCXA675cDC4w3ufgJzvs9whL7zPF8jWGqTjmTLW4NpaEKqvkieTTab/GpyyXMnjb6xy3LVESjv12ykGvYC1wwTqVIclCgYQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717515890; c=relaxed/simple; bh=G+S7nMnQYP8Ub6wdwc/QdbVXpNg4qAepSUVQBtIndoo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OBuibUkGh198+0InCgl96yI3D3E+346GTv6/20BSiaylxMvbuTvkT3a9zPPVFmscDx2907baaRPh7h8niw3sRFmtToaG6VIT665NMh3lO4KZqhQZ+Nhua0CfForXDEBh8veuG8aBzyY3c3jLnrk3njta0Q4+sa/AjiMzXNzVTWA= 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=viC6lkgC; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=lbgcgTVT; 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=1717515887; 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=jc9kVwpT1wazRgJL8VSyOnTf3zyLearQK1DZf1xb140=; b=viC6lkgCUzfivwQLWjonYU9EOhxsxw9uKJQ4t/Kcs7Xzabb6+7eKrTs+37I+KGYAUqcqhc lrDIMHbXrkURGhjydBgxiMSSE5mWDvHBf4teXDZ5wRLO9n4g/YyOV4l975yPhKtLHEUtip yxAdUv+azl+AxDRECQhcDok+JJyp2KKClPI8A1XHtLX6Ca+q5z6FhWQ8wVtu+z7V6NB7xG gcgK1qXEuwT/dUVXRO5Wh8KyRRXBAfumD3U4jP+zyMfLmXny1DhCqqBeKH5EikkM46m/hq ChGZbCv7N3WFWpu5MLkRsLr7aChJlOJgjk3H/VGo2QvS4Km3JHSvSw8HaFdHLQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1717515887; 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=jc9kVwpT1wazRgJL8VSyOnTf3zyLearQK1DZf1xb140=; b=lbgcgTVTF1uYDTgw0nRUB8a20nSfMZ7QTl1+70n3F97TPtC4vUKLCFrzYJP8J67wlDrAMk 7vMkY6vO8Kfn6QCg== 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 v4 net-next 02/14] net: Use __napi_alloc_frag_align() instead of open coding it. Date: Tue, 4 Jun 2024 17:24:09 +0200 Message-ID: <20240604154425.878636-3-bigeasy@linutronix.de> In-Reply-To: <20240604154425.878636-1-bigeasy@linutronix.de> References: <20240604154425.878636-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 466999a7515e6..dda13fdffb697 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