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=-5.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 C5B3FC4740C for ; Mon, 9 Sep 2019 14:59:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A35DD206CD for ; Mon, 9 Sep 2019 14:59:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A35DD206CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3CA926B0005; Mon, 9 Sep 2019 10:59:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 354676B0006; Mon, 9 Sep 2019 10:59:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 243716B0007; Mon, 9 Sep 2019 10:59:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0106.hostedemail.com [216.40.44.106]) by kanga.kvack.org (Postfix) with ESMTP id 046726B0005 for ; Mon, 9 Sep 2019 10:59:05 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id A46998E6B for ; Mon, 9 Sep 2019 14:59:05 +0000 (UTC) X-FDA: 75915689850.27.color47_15215b48db143 X-HE-Tag: color47_15215b48db143 X-Filterd-Recvd-Size: 2283 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Mon, 9 Sep 2019 14:59:05 +0000 (UTC) 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 67546B65C; Mon, 9 Sep 2019 14:59:03 +0000 (UTC) Subject: Re: [PATCH 1/5] mm, slab: Make kmalloc_info[] contain all types of names To: Pengfei Li , akpm@linux-foundation.org Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20190903160430.1368-1-lpf.vector@gmail.com> <20190903160430.1368-2-lpf.vector@gmail.com> From: Vlastimil Babka Message-ID: <4e9a237f-2370-0f55-34d2-1fbb9334bf88@suse.cz> Date: Mon, 9 Sep 2019 16:59:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190903160430.1368-2-lpf.vector@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: On 9/3/19 6:04 PM, Pengfei Li wrote: > There are three types of kmalloc, KMALLOC_NORMAL, KMALLOC_RECLAIM > and KMALLOC_DMA. > > The name of KMALLOC_NORMAL is contained in kmalloc_info[].name, > but the names of KMALLOC_RECLAIM and KMALLOC_DMA are dynamically > generated by kmalloc_cache_name(). > > This patch predefines the names of all types of kmalloc to save > the time spent dynamically generating names. As I said, IMHO it's more useful that we don't need to allocate the names dynamically anymore, and it's simpler overall. > Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka > /* > * kmalloc_info[] is to make slub_debug=,kmalloc-xx option work at boot time. > * kmalloc_index() supports up to 2^26=64MB, so the final entry of the table is > * kmalloc-67108864. > */ > const struct kmalloc_info_struct kmalloc_info[] __initconst = { BTW should it really be an __initconst, when references to the names keep on living in kmem_cache structs? Isn't this for data that's discarded after init?