Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2363059rdb; Mon, 5 Feb 2024 04:30:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/AgZ4w8YpS3Ht0ghhBrgOPN1fa/RwD21PTq4okTPzUhDurzDnI2v7FWOJwV6tdl+WB5Nd X-Received: by 2002:a17:90a:ce03:b0:296:67b:1892 with SMTP id f3-20020a17090ace0300b00296067b1892mr10305674pju.41.1707136202351; Mon, 05 Feb 2024 04:30:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707136202; cv=pass; d=google.com; s=arc-20160816; b=uG9cZcsxJG0IvHeY0FKbhhYVN4yY+ky/1QwzuhZISqnQt9NIrvzcSmbLhAuAAfLq/O hyPv4uEd7+XnLJ4u0VPmnGjq+0q1GW6z4EdxtHCCdrwkZ08rwp7r+qkjAGVcv7BsfZk5 g795lFYSOD+VQKZOtN+hEBQH0DARUFLLdAE6a8nwbJ3TznMOg7ih7/Et+prNwTKGf/TU 2Ze9z2OZIO07ZoXS9+WT6YzIb/doJEClPvh9ks/R1JoWXi4zvQV9nmf3Py7O7NDP2nnC F7fgxQJW2SPmgC5kOpphDKRCHqZB2Asi+rJoUrkFxYN1or70+lm5TDx9rLgCjcVJ6iGf zWgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=k24Uyhl1+vZMArgijwhf2EF1yCtOJQ6dhObCgbS2exo=; fh=uSbYs6Px4dTTBKLuhP80e6FXLffL8HTTb2HZidiWFCM=; b=RAGwCELZYJ57M8fcWQjdvj+EejzHsjWPqiCDE14IbXQiNzrIs2i6yIgv8v8uJJp1HY noBAlgrss8T9QlGVsb7xbuByR2V7wXEITb15HP9qK+6loQP92QMcoXvnMLA0GkWr6pGr lOD8tQOP5k+DTvbN13SyosDZthfpO15ADCP2Vc5x4GpO5UUycoKXeTSARTaBLsBnhqLZ PAMwj8x4upyxFtbTVr/7axOWOu+kWa8OITdcht1R1ppc3ppET1KyQSrSO8PXSKCG/VWW Qwd7PeL6WXXf6AO0WcacT135qE65x7Y79j0r+5+QoiCYCRnhxVSOPnyXaQIJwVmEbcDw oxRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="wqNl0Y/I"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-52597-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCW/W72CMDSeCNOJ4vH4BH+nUd8/yU2oOA6/XF6q0S6lBl9eifx/rtTq2CJHR5+9vMkRtHmIR+vOXmhNSNn4s0PSyDoM/aXYZIxqCS6a0g== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id gz19-20020a17090b0ed300b00290c6b287a6si4464124pjb.56.2024.02.05.04.30.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 04:30:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52597-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="wqNl0Y/I"; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-52597-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 06D52281ADD for ; Mon, 5 Feb 2024 12:30:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91C911BF2A; Mon, 5 Feb 2024 12:29:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="wqNl0Y/I" Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D33F81B978 for ; Mon, 5 Feb 2024 12:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707136175; cv=none; b=nnCYEMUbQGwSwfiTUpXJO9qABfjPlVeCBVvjNhm8XqeUbdpnX+8V+UazINx+c3iGwoah+ypO5x0paRFP4dclCpF1vhVPHlhkj8v1fP4LkrWynKp2GY44ALUuQVGc0WFtAAdsbbNtgR0LkgmGWRR2nEs6dPYMk2LHg6MdWqqhx7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707136175; c=relaxed/simple; bh=p8w5ORQN85keSs4iHtLF0hAGuD3vblI//NXG+Z81rLI=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=pNRHpCjy8A49/QkWxOi9w0rn4XUodAvx5KyMYJgYh1Z2l0PfFV9Yb4MOHJGfcjtTSdgUJrhHg1sfqGI0+2Zp7KJmz5b8Ja2SmantTfwOwLKrLVpqcACtv8lGq18tMgWJsKRjGe9X/HtMCbardooa122uDSO4G6CCfsR3nqHUySY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=wqNl0Y/I; arc=none smtp.client-ip=209.85.208.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-56012eeb755so15655a12.0 for ; Mon, 05 Feb 2024 04:29:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707136172; x=1707740972; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=k24Uyhl1+vZMArgijwhf2EF1yCtOJQ6dhObCgbS2exo=; b=wqNl0Y/IleO1SJfGRzcCA4KjzTEUKCF+akmHWdzBDl+JWg/c4xNfpN9/wvRLPB1R6x /Raq89Df4qqPf8x87MfUMHMlgODHO608vMumBFD7iPW7IHA6n7LNfxF/pA8tjCFre5wR 7dUrlBStos62GxDEj4e7VGnqy0Mv+pOy6c8476QIXCd4bkRAu0cShOieIabSb6V/ttts CePiPKEybBU3zGVgDiVQSS7EelULFo8Hx65Te1wPwxZmsaPZTmNl/w9SI2RPAKBr4pOT 75TtLioSMOm/BGVN9hKue3+hlyuBenFFKUTZbcnhUUFT7gpSB3QGfdCxdyg8L12e3bkl A2wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707136172; x=1707740972; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k24Uyhl1+vZMArgijwhf2EF1yCtOJQ6dhObCgbS2exo=; b=GrXGScc7ROsPoMa5g8JFFw0XnZ5MKgkLMW/kOSSLWN+ZbjEaaNFzHFtCeErmlguzir d9sNF/AQXyt0wAHoTIa8pSSMd3oCnOtrpJ5l5+FWhslp7rNj5a+9rUXhG/7uG8kLlZo4 FFgdIDbIuJreYP30yA4oKNKEz7E+jSMUaa8efwq/XiFJJuX+TEiRTvOp51HRnY3FRuWT nO6nTQgiYIwLevFxROVOgsj+8yHlZ17ZC0ZZhYU3HEQyUBzhZYBoiFI2hSoVHA2kBJW3 aboCSb9zNkB246sT1GoP+UwArM7saQitfYdaFitLVc7QjTu6ShrUzqjY3fEMzjabLIT1 7TFg== X-Gm-Message-State: AOJu0YwAythwfC8hnAbtebdoOeZ9PfVeCRhpg/3gsyUJxCko3rEhC9uh ZFTfP2NyU5twxI9rx17pHgZltI7k4LZ8FglmfoCCytI+i1VqfCCu2bm30otYwjSvlrJP6IsSkrA DpxEQU9so6CEDmdZh+XCplJLRcP/e2QADD9r+ X-Received: by 2002:a50:8750:0:b0:55f:88de:bb03 with SMTP id 16-20020a508750000000b0055f88debb03mr249754edv.4.1707136171790; Mon, 05 Feb 2024 04:29:31 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240205072013.427639-1-chentao@kylinos.cn> <20240205072013.427639-6-chentao@kylinos.cn> In-Reply-To: <20240205072013.427639-6-chentao@kylinos.cn> From: Eric Dumazet Date: Mon, 5 Feb 2024 13:29:18 +0100 Message-ID: Subject: Re: [PATCH net-next 5/6] tcp: Simplify the allocation of slab caches To: Kunwu Chan Cc: davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, jiri@resnulli.us, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Feb 5, 2024 at 8:23=E2=80=AFAM Kunwu Chan wrot= e: > > Use the new KMEM_CACHE() macro instead of direct kmem_cache_create > to simplify the creation of SLAB caches. > And change cache name from 'tcp_bind_bucket' to 'inet_bind_bucket', > 'tcp_bind2_bucket' to 'inet_bind2_bucket'. > > Signed-off-by: Kunwu Chan > --- > net/ipv4/tcp.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c > index a1c6de385cce..2dc3dd4323c2 100644 > --- a/net/ipv4/tcp.c > +++ b/net/ipv4/tcp.c > @@ -4697,17 +4697,11 @@ void __init tcp_init(void) > thash_entries, 21, /* one slot per 2 MB*/ > 0, 64 * 1024); > tcp_hashinfo.bind_bucket_cachep =3D > - kmem_cache_create("tcp_bind_bucket", > - sizeof(struct inet_bind_bucket), 0, > - SLAB_HWCACHE_ALIGN | SLAB_PANIC | > - SLAB_ACCOUNT, > - NULL); > + KMEM_CACHE(inet_bind_bucket, > + SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT= ); I would prefer we do not do this. dccp is also using a kmem_cache_create() of "struct inet_bind_bucket" We want different caches for TCP and DCCP. > tcp_hashinfo.bind2_bucket_cachep =3D > - kmem_cache_create("tcp_bind2_bucket", > - sizeof(struct inet_bind2_bucket), 0, > - SLAB_HWCACHE_ALIGN | SLAB_PANIC | > - SLAB_ACCOUNT, > - NULL); > + KMEM_CACHE(inet_bind2_bucket, > + SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT= ); Same here. > > /* Size and allocate the main established and bind bucket > * hash tables. > -- > 2.39.2 >