Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp859388lqt; Fri, 7 Jun 2024 00:06:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQiAPqVU2mHN4tXEifi2myBPFfo9TOj7WKn/kwWgitwcAaeCDaDA9hURTOfKQwNwLAXwUFwcZAnXXgCpSynycuM0rk1xIoUNiazAVyDw== X-Google-Smtp-Source: AGHT+IHQRFVW1lIvTzALKAt4YW3mdP8QGurRUo3RGk+wZhU2Mp46WCB983lnjWlPI1pm2cLAE44v X-Received: by 2002:a05:620a:b98:b0:795:2354:9824 with SMTP id af79cd13be357-7953c320351mr145947485a.18.1717743998290; Fri, 07 Jun 2024 00:06:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717743998; cv=pass; d=google.com; s=arc-20160816; b=fSWxEL1DS4jZPXX/bXyilHjE3uZ2Y+StKorI922UJioSTCV697WCPTGemZBAa5T/Cx UZ+6UPrW5P265RAnAEVrBUuqjBKzG7P98bMC7lkvSx2QSf0kjh6gLZcTf5XxAwiK4ab/ laYdE9srJTHrBJTKrI/ywRurpqZIlGnRYKL7r8nmb4GAE4/gE8/AnlB1+yB0pd7iDhze SAaKXODm+e4rCOvqX7prNJFslxFw5MF4mPsDn25UXZnL4Cf1VWx4X0AGYmcuR5PkbQ/q AL6H/tTrm4BfRtgR1xoMkVuXfssLp3sKgsYNTkUSgLEBds3l1Du64Nseyp6K7fdqohnj G5wQ== 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=LULv6I/HqknI6ZFQODVfTHUDosyEFE+QXZQARnQXa+s9jkMnWB7N3JUYfI508Qig6R ZcPhEWBDRcj43AVzciFMPA/2UNRhpTl77W5WxmN8Vp3sjFZlMGiy1J0LVzmbbCjlfQn5 KyZNKgFHnbh8/4f/zfb62my8KOTzYx2NYjrHHzzvfTt20gPILKyBQPjGh+eVGIvJZd0A oeCHORBkX7mQYpbwzUTmZZki18iTHqSejd1GcIUnlSCxNLYOwRV+o8k2EWDqOhFvBkPN 6YrWLDdCt/E5+Pa/1J8oihOhUTV+jlx2mn0cGe/Vyz/fWdLw6/iSlcbSFT+wm7tReFcX Q08w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GxLmm8pM; 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-205475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205475-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 af79cd13be357-795332e9a91si310163285a.397.2024.06.07.00.06.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 00:06:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205475-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=GxLmm8pM; 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-205475-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205475-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 EC1021C27FDB for ; Fri, 7 Jun 2024 07:04:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D99F3154BE4; Fri, 7 Jun 2024 07:04:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="GxLmm8pM"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5Yav37B/" 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 980491514DB; Fri, 7 Jun 2024 07:04:33 +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=1717743875; cv=none; b=Zjns3PoRPVrr6eXZEwFLzB1/v1cC64f/4HR6kz4Ge8llAf9Ko5WtI8Sc9Oat13z9LpGg/VARnrNTurTVZAK3YkBH34vsdhcyx75tSQhQqDR4pXT/hZdF3lMUfgxl9LsXdoUNh+DeEcHgewpdiJEtigwsnpEHDrhjwGJP1u60rCM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717743875; c=relaxed/simple; bh=bghL6tgmgkRzlloyIs229ULAO8wmcKFlVMxXqGEhuGQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Szq6W7TInXnWkxEB6N4RxkFmk3Ftddl+svBeT8qmQp+rIP11Mrg3V7vzIstx7nvzRG0tB2QBlNr3PGTqnP1SUWL9l70jr6lCbuNDqw80WePgby6h2+MOWe9eE/PhImpi6yI2ZU6wa0rFfUqgX6wTWwKCG5yXDlXJ6V8BJqwwW0M= 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=GxLmm8pM; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=5Yav37B/; 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=1717743871; 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=GxLmm8pMqT04ERbIr7QYyPWYHWkaN+Ps8YD+X5map6/iWF63LNrJaiHPCYiBPGWqxdO/ST aORsRoHWEU/KMc9LURfe5jKHAZsGbYceYkUlS6PQguC91URSRc6/TVB1Yo96EKT4/FKgLk 2Urnlu1gxTcLEx5LZddxTBdto4ZzJa5VXsEFzuo53I3OXOLXfdoqoDe3f/aGWvGX9t+5hK zl2RagcWCiKGkFzIRMWEidrTqsolNhJ18FWLeWJXx8wNfmrrJQZ2JsEFA5g4DqstXwPiK7 T0y/Y2AdTBK6ZnaNXkcv79EjxvaKJ+iZJpIDAoS2hxV2zgDMEHlJeaa+Lyuv4Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1717743871; 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=5Yav37B/hUrqo058W69ZgD++27hYvtYBBGNCMmo2XnLj9LMopcubS8xbc51s8JmELVx9cE BT3ofKjE3pJx4AAw== 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 v5 net-next 03/15] net: Use __napi_alloc_frag_align() instead of open coding it. Date: Fri, 7 Jun 2024 08:53:06 +0200 Message-ID: <20240607070427.1379327-4-bigeasy@linutronix.de> In-Reply-To: <20240607070427.1379327-1-bigeasy@linutronix.de> References: <20240607070427.1379327-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