From patchwork Thu Jun 20 13:21:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13705502 X-Patchwork-Delegate: kuba@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 48F631AD4B2; Thu, 20 Jun 2024 13:27: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=1718890054; cv=none; b=jXOW72iwuqSFPIR9I3CZZUAbCXa6fL/gsWGmbZy9bHAMUt4sBZB5Z4BRwdC8NIdc1Fjn7TRZDJjowA4KAfflO8b54LmL7bssFREKPKa9KJ+o7Fv/dp8evAmvD6m8oa7BiqnURPE9l9ctVFS2YPhX40Rxaz/uPuG8SHH3BHBYzCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718890054; c=relaxed/simple; bh=QtDo2HGf/L9ZrehLlTcmQLPQAAZesi1sG/KKDX+fAmQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NQH2yhNPXmowGRAb6kcnpfp+vx9c6SionuOcf6FvyQVfllgKfBnEpCcQ9gp4nWsWSrwDl7aRrV+HLzZ++zdY02K6lUczpA7DN3KfzxIb4XWqNrQa5C8hxO+HB+XrG6JACNV+AfscEdh4hig/h0z4Lf9beznDf1oiyxrSSjlExzA= 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=Iu+BhHR+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=viOBfUUz; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Iu+BhHR+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="viOBfUUz" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718890050; 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=tfO9IgURCOa8OwNF0E1ITtjXLEOyfn4YupkCPqbnlWQ=; b=Iu+BhHR+exSVGuq/KMmF/Dbbc1HOfqaV3pDO2MeW2207Uxwq9mOl5qRJH/eEQmnz5fsMEO ouIJENjS5V2JTMx2s0wx6veaJ4+2qBZM84OnCsDzf0Mts+kAoiwxGvN//Sl4oLEq3oixPg CCVV4uKLfL2pRylXYub4EfAgGTsFVD5DwEI26eVrHeyqvU5B3S+zpCYhK7qz3SA9wXj879 6Uii07zAGZM5tUbkshq3ENk8WJTKhRHdPkHdFliEZ7p24GmVWzj6+zauDbP6eddkC3bs3o 7EnWVwZFr1EAMR27na7OIWMACflekUZKzGOdOdUl6abICPgj86ZEPxxrXEa7Gw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718890050; 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=tfO9IgURCOa8OwNF0E1ITtjXLEOyfn4YupkCPqbnlWQ=; b=viOBfUUz6Inq0vWV+pee4amjwEtJKZexqFS3ZUkr6dzWCjfn3aT1WRHBLAb9z+osGuz2n6 s9A+l5gF0jJ4+ADw== 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 v9 net-next 03/15] net: Use __napi_alloc_frag_align() instead of open coding it. Date: Thu, 20 Jun 2024 15:21:53 +0200 Message-ID: <20240620132727.660738-4-bigeasy@linutronix.de> In-Reply-To: <20240620132727.660738-1-bigeasy@linutronix.de> References: <20240620132727.660738-1-bigeasy@linutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org 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 2315c088e91d0..1b52f69ad05e2 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; - fragsz = SKB_DATA_ALIGN(fragsz); if (in_hardirq() || irqs_disabled()) { struct page_frag_cache *nc = this_cpu_ptr(&netdev_alloc_cache); + fragsz = SKB_DATA_ALIGN(fragsz); 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;