Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp872049ybx; Thu, 7 Nov 2019 04:00:02 -0800 (PST) X-Google-Smtp-Source: APXvYqx7eI4zI/wFrNptvgQ1tPd5LpMPftndqKWAUnsVhNYl4sCn43T/xaW9kw1K2H2qh6nJ7uii X-Received: by 2002:a05:6402:284:: with SMTP id l4mr3024829edv.19.1573128002292; Thu, 07 Nov 2019 04:00:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573128002; cv=none; d=google.com; s=arc-20160816; b=W2rArNR4ZOLYu8VUeDADC0bg3WKNCAfGQQP7L0pHsg2UOxUvm9dcIQ6FBFuqJ9kPsD ImarUBbXdonRGoUuyejU9GxzSJ56HhEoVjxv1X/b2HoC5ZtFLS7bPNrBG1YbOFc7uSdD wGyxEq8FzyCMVfEqHCfJJHzCRxIw71BYZwXi3mAdOg9egVTTUBUPEgeONHrFrpXEpa5n wz0jW5b4sa2+GAqvFTQxFshAS7rQH4mhlxxJFNtuf6T2egH5ey7ZPIpBYrBzhB4SI/qi GUxETdnBvxquXC/BN1lDR6dvJAYH6jSMqdCVw//5rcRs1DgBRgJ0R7W1ax0x9SXlEIvJ gx5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=EoZ11kwW6r4cTRkybOlZbxu0Dazj/jAjrbGlYsVjckI=; b=ObgSzze+ImeKIx2yL6wZki0D80f8LZy+WPvIk35ywjSIzztNmLOITnfH3Eqamx58rc yi45GPMUVqyRYOo1CYOQQKnfWiKrjhZmvzR7vxO3hAnqh9Vd4wvz9Q/3G76y9XB5sNtT DwnQxWETldx+du0iKNoYkHDgIqc8lKr1qm9TmjmFfncZdMxwCNq7BUdwLv2zOJaeviB4 11oz6SOunOjYlK7oDH/2zc2dSuYeXU9fxMUWPe1AdmgKGIdHyLp0kPxw66YIJQ4UJpG/ fG2DYv1FcWa+f3MyJOvRlOc20KXHhI0+emIeSnvwsJmUpAdcRYesZ1jAcXJKDuItUsSO Bljw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si1067606edr.318.2019.11.07.03.59.39; Thu, 07 Nov 2019 04:00:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388204AbfKGL6K (ORCPT + 99 others); Thu, 7 Nov 2019 06:58:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:57288 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727178AbfKGL6J (ORCPT ); Thu, 7 Nov 2019 06:58:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0039BADBF; Thu, 7 Nov 2019 11:58:07 +0000 (UTC) Date: Thu, 7 Nov 2019 12:58:06 +0100 From: Michal Hocko To: Knut Omang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton Subject: Re: [PATCH] mm: provide interface for retrieving kmem_cache name Message-ID: <20191107115806.GP8314@dhcp22.suse.cz> References: <20191107115404.3030723-1-knut.omang@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191107115404.3030723-1-knut.omang@oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 07-11-19 12:54:04, Knut Omang wrote: > 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. Who is going to use that symbol? It is preferred that a user is added in the same patch as the newly added symbol. > 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 flags, int node) > } > > 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); > > #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); > > +/* > + * 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) > { > -- > 2.20.1 -- Michal Hocko SUSE Labs