From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3562DC5DF61 for ; Thu, 7 Nov 2019 11:54:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C1D83218AE for ; Thu, 7 Nov 2019 11:54:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="k+BoMVv2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C1D83218AE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 35AD46B0003; Thu, 7 Nov 2019 06:54:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 30B6E6B0006; Thu, 7 Nov 2019 06:54:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FB0E6B0007; Thu, 7 Nov 2019 06:54:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id 06B586B0003 for ; Thu, 7 Nov 2019 06:54:36 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id A1D9F4404 for ; Thu, 7 Nov 2019 11:54:35 +0000 (UTC) X-FDA: 76129324110.05.elbow14_6239edb681640 X-HE-Tag: elbow14_6239edb681640 X-Filterd-Recvd-Size: 4890 Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 Nov 2019 11:54:34 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xA7BsGS5065558; Thu, 7 Nov 2019 11:54:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2019-08-05; bh=NfAYcg+x2BRWdeKjZp6DmQCHJxccvsCiuX38sXcbKfQ=; b=k+BoMVv2VPzauh3dpUT209wHIhNZmkCO2vmj17B5OqMefort5Sd3At75HW7qtM+lZZlL qj49U2nbMRZDil62piSCTleg1YicOicQWOdbFULnDQjpK/DB+hWbMScYDrmga/6qKl76 ww4tforsylneI+f8Ei1TN2GcgKxKxhrQ182DMnnkrNAt7ygfT2rEnpzjmpfCr4p7rTk0 ikDtQUccaCw6cqbVkleOfHCxpKEHqXYL3TH5h/tppeVflVc4tPna3wnVY/d9SFYwvKhi qr0H9stV8m3FQcBZ2A/70mVx6pGeOSVpKZ5Cf7WWi9lCPimrsqlucfXKKUO1SrrWf+Zh qA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2w41w0wj46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2019 11:54:29 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xA7Bs86B063177; Thu, 7 Nov 2019 11:54:28 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 2w41w9m8h5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2019 11:54:28 +0000 Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id xA7BsQfc014595; Thu, 7 Nov 2019 11:54:27 GMT Received: from abi.no.oracle.com (/10.172.144.123) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 07 Nov 2019 03:54:26 -0800 From: Knut Omang To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Knut Omang Subject: [PATCH] mm: provide interface for retrieving kmem_cache name Date: Thu, 7 Nov 2019 12:54:04 +0100 Message-Id: <20191107115404.3030723-1-knut.omang@oracle.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9433 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911070122 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9433 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911070122 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: With the restructuring done in commit 9adeaa226988 ("mm, slab: move memcg_cache_params structure to mm/slab.h") it is no longer possible for code external to mm to access the name of a kmem_cache as struct kmem_cache has effectively become opaque. Having access to the cache name is helpful to kernel testing infrastructure. Expose a new function kmem_cache_name to mitigate that. Signed-off-by: Knut Omang --- include/linux/slab.h | 1 + mm/slab_common.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/linux/slab.h b/include/linux/slab.h index 4d2a2fa55ed5..3298c9db6e46 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -702,6 +702,7 @@ static inline void *kzalloc_node(size_t size, gfp_t f= lags, int node) } =20 unsigned int kmem_cache_size(struct kmem_cache *s); +const char *kmem_cache_name(struct kmem_cache *s); void __init kmem_cache_init_late(void); =20 #if defined(CONFIG_SMP) && defined(CONFIG_SLAB) diff --git a/mm/slab_common.c b/mm/slab_common.c index f9fb27b4c843..269a99dc8214 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -82,6 +82,15 @@ unsigned int kmem_cache_size(struct kmem_cache *s) } EXPORT_SYMBOL(kmem_cache_size); =20 +/* + * Get the name of a slab object + */ +const char *kmem_cache_name(struct kmem_cache *s) +{ + return s->name; +} +EXPORT_SYMBOL(kmem_cache_name); + #ifdef CONFIG_DEBUG_VM static int kmem_cache_sanity_check(const char *name, unsigned int size) { --=20 2.20.1