Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp553773lqb; Thu, 29 Feb 2024 08:20:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUe+1VShwew80oNizyZ6AyLNuYOcHpEge0O+BXLcs3crl5mFEDw526YgzHjnZxG3wOkoBKNmaDj8d1SN75qJ46EeIBlL8M/9jiWIK6XMA== X-Google-Smtp-Source: AGHT+IFWolXL9mmbbBgcDmjm12LEe/MDOz+j41EkWSgc1PpCuW3A/RGKcjAPS9rkKrUW5NqjRJ8f X-Received: by 2002:ac8:5e0d:0:b0:42e:aa01:5445 with SMTP id h13-20020ac85e0d000000b0042eaa015445mr4100336qtx.10.1709223613494; Thu, 29 Feb 2024 08:20:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709223613; cv=pass; d=google.com; s=arc-20160816; b=cW4DqNlCOp1r3hLfNBUDUeSviRfIPo9hLt3XzTwGVcTVJf9A42J1YtjqSwdvX6dbGm EHYTolwrSEeViyMsirKSEAqvbfm7Gbj1c3lRIjqIWIgAw8RJimHac4lxhsnBMhItrNua eCyQzsfDFjw9F9NhwULgEEt2k19wIgyKWhZlejGec67v+DyWoGA9yHwLImjgYMAgsbFF h3oMC6c8hOOz4L8QqP1amkqBW+34f8f7IQ3GZfkAj0OEVw4iGtPgSF2ro53fv2CyCqaa UIlHMAam1wCoHLEYZHgv8TbATqmLmEY87FRj2UuTIjFpiU/xFvcgnBdDVO3N3LxCuudk shlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XbP14kL1C5nifIPUj76gmmQgsw3xVKtG1vfmvDfcKVc=; fh=cqifnG8iZlZbgG7mdchxf6rrmGoBdVtGus7lw+vAOwQ=; b=rCPiBwZDIaiFhDJ+hjHiNMcrR0EExGP3PHSsT3dvPyRboS/FQ8ursyyLN7RpuuvTi0 TqE2nK2ocmSzvy6u/ih0s2mICB0gKMqma2DYFEJCzDJnXUhDjgK3XZVEChguRRK+F7eT 4JwvPUgBSQIfPyy8SbxoAx8MWmgXXz3eiojLhXJdZuj235gfwh2BcSYaLNNG1kCU9Oxt RpKw6HP58L0SxN74WUOZwfIOaH5IeZSVsd1evRSmZ+lcRuKWoUCNtFll1KrTAdV0UJwv jIsK3t1O38NGvNFvIsTi0GanFRGRXX59sNaXKv3LZlzsDBywy4OqrtBjOcSYtHP/DhmP YJmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RJgt7a/I"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87050-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id k17-20020ac84791000000b0042eb3a8f0fdsi1531264qtq.534.2024.02.29.08.20.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 08:20:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87050-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=@kernel.org header.s=k20201202 header.b="RJgt7a/I"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-87050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87050-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 3BC811C22509 for ; Thu, 29 Feb 2024 16:20:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A47913F423; Thu, 29 Feb 2024 16:00:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RJgt7a/I" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4DE65134430; Thu, 29 Feb 2024 16:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709222450; cv=none; b=Ffw5UOwkEk51Xu75UP6f5+tS24kp6Rkkh25qEjrjlZVUh7sFbWdnfOJlXcOI98xqxQE0IjZ+at1dx6FAu3O2PNbFdLFzJoJsF601Jz6h+f2j6IX2Bs13nBlDD+L+1/1GbvtJb89VKCNmkiUJ4kAClWCGX5TpkOOGtBmi8TErb2M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709222450; c=relaxed/simple; bh=lnjqrM8Lfog5fV1cL5NQmbG9UmOGAw+pkjMKhL6L9FI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y+0eTuqlReR66qiRXNGH+VMPctkdx0RKru58+0gEAanT4WSJoM/mP2mDvBbqLbAFYoR171+3uIA5rW+PkyfOjt6HZZmj7LMUMt7awk07Yah+wK0VJM7E00jbv/r/kxgo6wMGRv2N3OcAJewvWaig1q0rUQiPc0RjNRm5Qdv3HCw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RJgt7a/I; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A69F6C433F1; Thu, 29 Feb 2024 16:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709222449; bh=lnjqrM8Lfog5fV1cL5NQmbG9UmOGAw+pkjMKhL6L9FI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RJgt7a/I08xUFVWKGUQUt/CbnrRwSeuWuOVZB/GRli+J4DfxIBlU8I4rOQ8iTiOsv E104t5JtWqdIRhuavFMU2rVQoMQjnnkpulToS3t8V47AIInq31/SnL3CC4g8o3a0VD 1rumGN985aN5g2VIfW/FMygt4zS/00Li3OIULshxEyZz3fPc8gJXcu0vh0AjruHdzD zS6n9bsWeyH1KcnctMPBo6kLtaGy6d6XnD6E5CsE1zi/P/Bzcp8efTp/DTzbjpxzQV ygabbPCyn45uZ3XmdlLQzBlTYGnl72qMikVI/D8OYaperNbR0CT1TizT4tX5sFpQ80 3jRxkXx54nuuQ== Date: Thu, 29 Feb 2024 08:00:49 -0800 From: "Darrick J. Wong" To: kunwu.chan@linux.dev Cc: chandan.babu@oracle.com, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: Re: [PATCH] xfs: use KMEM_CACHE() to create xfs_defer_pending cache Message-ID: <20240229160049.GY1927156@frogsfrogsfrogs> References: <20240229083342.1128686-1-kunwu.chan@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240229083342.1128686-1-kunwu.chan@linux.dev> On Thu, Feb 29, 2024 at 04:33:42PM +0800, kunwu.chan@linux.dev wrote: > From: Kunwu Chan > > Use the KMEM_CACHE() macro instead of kmem_cache_create() to simplify > the creation of SLAB caches when the default values are used. > > Signed-off-by: Kunwu Chan Why bother? The vast majority of the kernel is still using kmem_cache_create(), not the weird, shouty macro that doesn't actually tell us what it is doing with said kmem_cache...... Up until now we've chosen not switch XFS to use it because many of the slab caches we use in XFS are not just "default" slab caches. IOWs, we still have to use kmem_cache_create() for a lot of the caches we create, so we may as well use kmem_cache_create() for all of them rather than have to go look up what KMEM_CACHE() translates to every time we are looking at how slab caches are created. Also, if you are going to change simple API stuff like this in XFS, please do all the conversions in a single patch. It takes much less time and resources to review and merge a single patch compared to a pile of dozen independent one line patches... --D > --- > fs/xfs/libxfs/xfs_defer.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c > index 66a17910d021..6d957fcc17f2 100644 > --- a/fs/xfs/libxfs/xfs_defer.c > +++ b/fs/xfs/libxfs/xfs_defer.c > @@ -1143,9 +1143,7 @@ xfs_defer_resources_rele( > static inline int __init > xfs_defer_init_cache(void) > { > - xfs_defer_pending_cache = kmem_cache_create("xfs_defer_pending", > - sizeof(struct xfs_defer_pending), > - 0, 0, NULL); > + xfs_defer_pending_cache = KMEM_CACHE(xfs_defer_pending, 0); > > return xfs_defer_pending_cache != NULL ? 0 : -ENOMEM; > } > -- > 2.39.2 > >