Message ID | 20231215171020.687342-4-bigeasy@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-1364-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9432810dys; Fri, 15 Dec 2023 09:12:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IE0SXBrnGlfC4Ql9pHq7LvmYf+r0RIsVBLQiRTKSOOPG6Y/9BJSME2rHHSeTe5qoN/ZswWY X-Received: by 2002:a2e:701:0:b0:2cb:30f4:a342 with SMTP id 1-20020a2e0701000000b002cb30f4a342mr4596501ljh.23.1702660347750; Fri, 15 Dec 2023 09:12:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702660347; cv=none; d=google.com; s=arc-20160816; b=QLHJVhHEjRSZ5UWJOcknRqYllOpXkpxzSj06tpzgqyS4QYP01BEQ7jYUi040t+FVIb e9lnSBKtDzt9IDBp70KlKRU+elMwadi/o5oaFTluITjWS8uDoUj8g7UFAEAwb7NpMKHr vO5qfOXirUY1IS/77LKtwfijL5xJy6OPgIUYlJQ9M3BSYbdDXxa4jATAbwH2bHQuKr0p PQOwZKlFmf4NBVjQTSYP8ebIECPqBUtd3cu05X2llEcclN3Eabw76xeYnfbBdxxkCfZx CDXwWQFMFQPxQnSo3WN8J6Ge41YJ1n9v3Pi1F4R6HtGFYZrXJeTTmUVfomlYLVfIdolC 2KbA== ARC-Message-Signature: i=1; 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=XdH3/zFhbfYvyMpVZfiOEfwuE0dIUmNZkBQapN7l63I=; fh=mRMHo6FEBd+e0N/0wwmt9BaEcwCnNTE8npQn9DDRWX4=; b=Ha/xEdimEULsb4gei08sZRP6qzbxS1TsW2Ws/83GKbNWhbb5MFuyGVVUIErsjy8aIj jvB0YZEbzTDrWQJmsoA153RzzVPZdOGe7PMOHRZylu7BypgwJvokp7C5nF3VJxeMYuVu 4wnM3rvmcK08rU85yhVdToJmNWGeaArFu2szMrtA1PL6KEFRpmgaKdgn37RhVsqYE5W8 FeF+TSj7ilQ2GddhEc8SKAXQ5r83CYDfefSxwac8cwhKKmqse6xoCJI9kff1F511jwod 9fwsDwNH00Y7YXEKTz2GqmZHaz+LZzPLWQY9jqPnQa3HsSlQjA6ROe6jlJSVeHJZIxU4 KWog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0PCupFfe; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-1364-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1364-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d2-20020a50cd42000000b0054c6f3c1f00si7999248edj.435.2023.12.15.09.12.27 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 09:12:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1364-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=0PCupFfe; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-1364-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1364-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 5798C1F247E7 for <ouuuleilei@gmail.com>; Fri, 15 Dec 2023 17:12:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CC0147776; Fri, 15 Dec 2023 17:10:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0PCupFfe"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OxnZOC1B" X-Original-To: linux-kernel@vger.kernel.org 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 B27503FE2C; Fri, 15 Dec 2023 17:10:34 +0000 (UTC) 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 <bigeasy@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1702660232; 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=XdH3/zFhbfYvyMpVZfiOEfwuE0dIUmNZkBQapN7l63I=; b=0PCupFfe+/uFey6s8CR4f9MUqgcVNN73B+mT4AjbMmEuUYcfy0bqw87xJkVjLHDvpgVcJ4 d0UMEOxIhSmbQ17Hs0rwZgbWhFGU6wk8ubGb1b1Y4yd3WgdpCpe5ZimbEewJ39BgXCtG99 7Q6ZTf1166uzWAaJ5O/hBXDn2gj1CT0VUBFFeLTNUl+xVZ39K7Dkb+KT6YaxHkpEyFPK9j ioVD6mk99L00DHhoJbOBDHg23kTJFT2vlbVJ7JJBKnU6NSx4X45BRjh8mhO/obj9qYfdpL biNNMp4wsnCRpvPPuKQk4npx92qh4VOztO4PZ5cC2KMjwFZdQWUrhcPJRYyuUg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1702660232; 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=XdH3/zFhbfYvyMpVZfiOEfwuE0dIUmNZkBQapN7l63I=; b=OxnZOC1BtcPQMgoNzblfsAnPzGRwme2vpzY8QeTyU8THH57SzRl5iNlkGb9sQtRgOLfwyR pvjgxZFCIEjwmSAQ== To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: "David S. Miller" <davem@davemloft.net>, Boqun Feng <boqun.feng@gmail.com>, Daniel Borkmann <daniel@iogearbox.net>, Eric Dumazet <edumazet@google.com>, Frederic Weisbecker <frederic@kernel.org>, Ingo Molnar <mingo@redhat.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Thomas Gleixner <tglx@linutronix.de>, Waiman Long <longman@redhat.com>, Will Deacon <will@kernel.org>, Sebastian Andrzej Siewior <bigeasy@linutronix.de> Subject: [PATCH net-next 03/24] net: Use __napi_alloc_frag_align() instead of open coding it. Date: Fri, 15 Dec 2023 18:07:22 +0100 Message-ID: <20231215171020.687342-4-bigeasy@linutronix.de> In-Reply-To: <20231215171020.687342-1-bigeasy@linutronix.de> References: <20231215171020.687342-1-bigeasy@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785368776587505872 X-GMAIL-MSGID: 1785368776587505872 |
Series |
locking: Introduce nested-BH locking.
|
|
Commit Message
Sebastian Andrzej Siewior
Dec. 15, 2023, 5:07 p.m. UTC
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.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
net/core/skbuff.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
Comments
On Fri, 2023-12-15 at 18:07 +0100, Sebastian Andrzej Siewior wrote: > 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. > > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > --- > net/core/skbuff.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/net/core/skbuff.c b/net/core/skbuff.c > index b157efea5dea8..de9397e45718a 100644 > --- a/net/core/skbuff.c > +++ b/net/core/skbuff.c > @@ -311,11 +311,8 @@ void *__netdev_alloc_frag_align(unsigned int fragsz, unsigned int align_mask) > > data = page_frag_alloc_align(nc, fragsz, GFP_ATOMIC, align_mask); > } else { > - struct napi_alloc_cache *nc; > - > local_bh_disable(); > - nc = this_cpu_ptr(&napi_alloc_cache); > - data = page_frag_alloc_align(&nc->page, fragsz, GFP_ATOMIC, align_mask); There is a: fragsz = SKB_DATA_ALIGN(fragsz); statement just before the enclosing 'if'. I would consider moving such assignment inside the 'then' branch - since __napi_alloc_frag_align() already include that. /P
On 2023-12-18 08:48:56 [+0100], Paolo Abeni wrote: > > diff --git a/net/core/skbuff.c b/net/core/skbuff.c > > index b157efea5dea8..de9397e45718a 100644 > > --- a/net/core/skbuff.c > > +++ b/net/core/skbuff.c > > @@ -311,11 +311,8 @@ void *__netdev_alloc_frag_align(unsigned int fragsz, unsigned int align_mask) > > > > data = page_frag_alloc_align(nc, fragsz, GFP_ATOMIC, align_mask); > > } else { > > - struct napi_alloc_cache *nc; > > - > > local_bh_disable(); > > - nc = this_cpu_ptr(&napi_alloc_cache); > > - data = page_frag_alloc_align(&nc->page, fragsz, GFP_ATOMIC, align_mask); > > There is a: > > fragsz = SKB_DATA_ALIGN(fragsz); > > statement just before the enclosing 'if'. I would consider moving such > assignment inside the 'then' branch - since __napi_alloc_frag_align() > already include that. Okay, moved. > /P Sebastian
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b157efea5dea8..de9397e45718a 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -311,11 +311,8 @@ void *__netdev_alloc_frag_align(unsigned int fragsz, unsigned int align_mask) data = page_frag_alloc_align(nc, fragsz, GFP_ATOMIC, align_mask); } else { - struct napi_alloc_cache *nc; - local_bh_disable(); - nc = this_cpu_ptr(&napi_alloc_cache); - data = page_frag_alloc_align(&nc->page, fragsz, GFP_ATOMIC, align_mask); + data = __napi_alloc_frag_align(fragsz, align_mask); local_bh_enable(); } return data;