Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1798296rbb; Tue, 27 Feb 2024 01:08:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVEHybzLMsDsvMK2hLvoNYSbbgyneR6rgcNWB/1O5POalYB/nrasfwkA83isIKXISBigJg9Sbxz5D8GOzHMni2LsF3pr96myoq2Fe8rkA== X-Google-Smtp-Source: AGHT+IEUxJpd0A6yOWtBOjbKiGfPrghg5PMOJJfHgN4fhSMb3H9kHKGcnFbMrI5pIAi6/XgMZv3e X-Received: by 2002:a81:4853:0:b0:608:c1d0:efcf with SMTP id v80-20020a814853000000b00608c1d0efcfmr1550213ywa.1.1709024916718; Tue, 27 Feb 2024 01:08:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709024916; cv=pass; d=google.com; s=arc-20160816; b=BRvshjpvu1jvpxpaBeE0b2uyhsS+STz7XXOwfFogDYiuyuiywxQMFtcZfCPzThC7dC jYBzxVRN0pLCnkCnC0B6JM9me29iD8LVFt9velSnY/eR8TVwRUlG4+OeetmbWJ+8zw8o Zyiy1nihujcj7MMpLQcE2tniGJMFbVH5kHRbFMyA9UQgZbRe18TUl2mLON74qLy57WgF bUnBbu6J0JMEg/GzwnI+zp7wDHhW4IHhwUdcI+CBMh1c7ezjwW/MS3mtPHIQY3EWW/QK 3aZWhau1Nmtlz+Wy0A54YY23nCJuNSDoDGUL0QEr66gIp/3RwQ0ug1JZ0XzGz3F8H3+H BboQ== 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:message-id:date:subject:cc:to :from; bh=BuNglDzzt2XkRn3ngDQMfE2UhdGYNGCqOqBeMph4MAk=; fh=OqZgK4mwjOrxKXc4KPO2qoAcGIDP3eQFyLE9unQtshE=; b=pXf9H1W67AGpw4WcsnJr/0bXAUHP1dOc6UqAQyZalna7A5bZFhrOJwvSoWbJatZ5K8 jfXqGGRLWO44l9o/wh/5aBPbngI3a+vGtl4+Axhq3GH6D34n9Ww1eh24r2HHpO9g/mRo QW8Yw6RpbQs5eKckniOUS0WkHq+/lyCE9cqRcVvmNTlRSLYxlass0zUscqbM//Xs0FKU JhBL2DN7+pB93y4BhFBmQUV1m8/cpVWegajqejEFgdTh6G8rDjHe4GC+88MhF3zGgtO9 9vMT6il8F2yEPBmQqQpaYSSGe3OYe68y5A7Vkc9czap4Vm6dMIDLtGpB9Cfup1l2+z+/ ev4w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-82913-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82913-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a4-20020a05620a16c400b00787a87b5741si6812471qkn.555.2024.02.27.01.08.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 01:08:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82913-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=kylinos.cn); spf=pass (google.com: domain of linux-kernel+bounces-82913-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82913-linux.lists.archive=gmail.com@vger.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 78C601C21C8F for ; Tue, 27 Feb 2024 09:08:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 68A2813540A; Tue, 27 Feb 2024 09:08:21 +0000 (UTC) Received: from mailgw.kylinos.cn (mailgw.kylinos.cn [124.126.103.232]) (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 D26E4130E36 for ; Tue, 27 Feb 2024 09:08:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=124.126.103.232 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709024900; cv=none; b=i9DN6b6RPKI+Xc6rhjnjZUY5xY+fJGUuBdvc1Z8kZIAxRVYo5IUoUtoHdyd+ibgkn3aRvpICkuld8zWo8TcWrdbpQji/r73cP+SmCRUPAKFD/412e9nwojQSvplzBEb/vM2rRJmTDoT9NG4bqY4ddd8sGHE0kDyv8A0ruCcJzpE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709024900; c=relaxed/simple; bh=kUucMWcN1gzSD3nuVGZ8AdNn9SZk4BXKz5H2jbJ3fzE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZyTx+3IVI6fcvvvckw48j6YeR0lHqJqngyp9sW3/QGkc/i/kknsa7I+o501KvQz1u6E6tYy6xBM84mDEnIyohcMiFPMyeuWm0YZS3EyYDeFR2fERnSwBDsdiUX4XSg141H0aLs96eCZu3rJoXL4O2otE507Uu0YXO1ST291qUJc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn; spf=pass smtp.mailfrom=kylinos.cn; arc=none smtp.client-ip=124.126.103.232 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kylinos.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kylinos.cn X-UUID: 7308ab9104af48c9bb1a1d486dbe15f8-20240227 X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:467c87d6-4014-47bb-9be2-ec11e3300fb7,IP:15, URL:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:0 X-CID-INFO: VERSION:1.1.37,REQID:467c87d6-4014-47bb-9be2-ec11e3300fb7,IP:15,UR L:0,TC:0,Content:0,EDM:0,RT:0,SF:-15,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:0 X-CID-META: VersionHash:6f543d0,CLOUDID:f98a5e84-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:2402271708129XE05GC6,BulkQuantity:0,Recheck:0,SF:17|19|44|66|38|24|1 02,TC:nil,Content:0,EDM:-3,IP:-2,URL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC :nil,COL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0,NGT X-CID-BAS: 0,NGT,0,_ X-CID-FACTOR: TF_CID_SPAM_FSI,TF_CID_SPAM_SNR,TF_CID_SPAM_FAS,TF_CID_SPAM_FSD X-UUID: 7308ab9104af48c9bb1a1d486dbe15f8-20240227 X-User: liucong2@kylinos.cn Received: from localhost.localdomain [(116.128.244.171)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1570390208; Tue, 27 Feb 2024 17:08:10 +0800 From: Cong Liu To: Robin Murphy , Joerg Roedel , Will Deacon Cc: Cong Liu , iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] iommu/iova: Simplify IOVA cache allocation with KMEM_CACHE() Date: Tue, 27 Feb 2024 17:08:07 +0800 Message-Id: <20240227090807.82318-1-liucong2@kylinos.cn> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use the new KMEM_CACHE() macro instead of direct kmem_cache_create to simplify the creation of SLAB caches. Signed-off-by: Cong Liu --- drivers/iommu/iova.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c index d59d0ea2fd21..9134acae76f5 100644 --- a/drivers/iommu/iova.c +++ b/drivers/iommu/iova.c @@ -950,14 +950,11 @@ int iova_cache_get(void) mutex_lock(&iova_cache_mutex); if (!iova_cache_users) { - iova_cache = kmem_cache_create("iommu_iova", sizeof(struct iova), 0, - SLAB_HWCACHE_ALIGN, NULL); + iova_cache = KMEM_CACHE(iova, SLAB_HWCACHE_ALIGN); if (!iova_cache) goto out_err; - iova_magazine_cache = kmem_cache_create("iommu_iova_magazine", - sizeof(struct iova_magazine), - 0, SLAB_HWCACHE_ALIGN, NULL); + iova_magazine_cache = KMEM_CACHE(iova_magazine, SLAB_HWCACHE_ALIGN); if (!iova_magazine_cache) goto out_err; -- 2.34.1