Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp877432ybe; Thu, 5 Sep 2019 07:15:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcWMfDCTFZDqtWRehju2IEUvBfTuC+BsGMfvxPWQS3MzX7S6AEBdrACAr3H5Z4wiu78JoO X-Received: by 2002:a17:902:e60d:: with SMTP id cm13mr3589508plb.178.1567692946755; Thu, 05 Sep 2019 07:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567692946; cv=none; d=google.com; s=arc-20160816; b=HJUjm/IfV3e/QggqYwRMfFUPxaF7UBWYb30yr1vr9fh5jG9xtzRjI+UWbp0dYM/4/M Fu+/sloiDkK4pxcnT3t8NMoGU5EDQRtszJYbWSD+7vg6v2V0i4Uc0NVsYg/zZikJ4JKU tIJAn8OmGtfuLbufWUwrVI9Km2FGjtK0/5eiN5qr3FG7UTaJjC+jiiWWzxc0eQ/vAIhL /BeeaJn3OOGODZZWo6YIec7kLhYroLIqrtjGOTsAKIS8xJp+xEAZLqzYV2VMUOBBXomI 5/NhExiFKgjIO1EVb/vPQ26vXLiroTVvDQPILR4bMuqzOv2LVeXQK/XXTYfCw7l7VMD5 WqTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+MsBWp8H3Xsdsta9B4+xQJSg6DayANUO7A/PQ7k+1B8=; b=W/DdkH38OmrUA4kWhCf/umuul1EMVOfQsYM0SiQh2p5nRzEK4wtqOI3gWrh5hvHG9q 8BMBUTHgJD88QCq6Y3coq050znaTnAoZ5XcpFXUk4vYmKHQIOdWahTCG3sJdEhtVGnUu XQM3kYsv7pihOyu+cFULSCkXppxJkVeKd4PRrzp2EUPkLmuS4owRJiG+rkL3+o8T8Qdy LR7SyYQE1hNbkUzbzYBGraZpUdzT5/90LHs8G/DjtQHgm7R4JTzTCx/MNXc2kSE8dFi8 kqkpSV8HmzOaLf3W0CAilPZ94cFXkm/nEuxeeaJuJFRrdDpdQG5iGIBTEybXb5Y/Na3L pYsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g+eUEH8K; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o18si2124959pll.302.2019.09.05.07.15.29; Thu, 05 Sep 2019 07:15:46 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=g+eUEH8K; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732433AbfIENv0 (ORCPT + 99 others); Thu, 5 Sep 2019 09:51:26 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:38704 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727735AbfIENv0 (ORCPT ); Thu, 5 Sep 2019 09:51:26 -0400 Received: by mail-oi1-f194.google.com with SMTP id 7so1869243oip.5 for ; Thu, 05 Sep 2019 06:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+MsBWp8H3Xsdsta9B4+xQJSg6DayANUO7A/PQ7k+1B8=; b=g+eUEH8KK/ZuogbCziIvbxFHTFdEu/3p51nvNXJl5SnYiqtlJEiK2f2furmO5spfJ0 amnFRbVduwCMWbv0veUNrs3SDibOliL9Op976n+nfcc1LAXTlvYIE2zrNRFPuAUV75HY exdGGVlo5JyO2Kj/pWzkwTmlIyXIpz3XV9+5o2wdySnEcwWaWPnR4pkCDEgIGda3M8UA HlXb5GjziX3TaWvc/uOaQyHsJsEuPAiDybwI/StC3wPuWx+XyqZf569lvomLwWzyGptx KsoOMtQ6xh4EUMvGy8HHXr4OnLP2KDdMmv1Yin/f85STVk6yU+pp7+OkRpu0xhfWYUGm FbAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+MsBWp8H3Xsdsta9B4+xQJSg6DayANUO7A/PQ7k+1B8=; b=BWU1zwwXZpNUqi9HLvLNn3+c5PY6m337cg9BWaDFPYV2c0UctdySWRjjLHRYRfiHG3 1NOsDWdj9Uul/ps43dYkUPW00l4onU+4ubc9MCrx3JKmz7tcRQJ4J5lEqnYW31Ub4YKJ BErx4ln3DUNCTOtmlybQt5AVDht1cbmv9oFX1Zcfnd/RF1PbVpAwtOwy9PGcH7BNJI31 xFabB5k7/qR3Uzxx9+EVka0gUNCNadd2nDIdJHKsp4BdlAFx+ZNddulJgTIO0yImIOXg RfyMP2bua/5IcOR0yKDFsL1aQtTdDICqGA8Arq3LCKZC+NKwebp8jw2DN9BCEm5X8kxD yvdg== X-Gm-Message-State: APjAAAVENqvylc+kHUk7zyx5xD94/77f5m0FGWazDPPaG8imRuO0WxiO SOjT2IBUZH7h24K+0jZ5lXf0/57Cy96ECOddcwY= X-Received: by 2002:aca:d683:: with SMTP id n125mr2672295oig.21.1567691485294; Thu, 05 Sep 2019 06:51:25 -0700 (PDT) MIME-Version: 1.0 References: <20190903160430.1368-1-lpf.vector@gmail.com> <8641aeba-ab8c-f5a1-a6ad-cf8c0f86baa7@suse.cz> In-Reply-To: <8641aeba-ab8c-f5a1-a6ad-cf8c0f86baa7@suse.cz> From: Pengfei Li Date: Thu, 5 Sep 2019 21:51:14 +0800 Message-ID: Subject: Re: [PATCH 0/5] mm, slab: Make kmalloc_info[] contain all types of names To: Vlastimil Babka Cc: Andrew Morton , Christopher Lameter , penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 5, 2019 at 8:25 PM Vlastimil Babka wrote: > > 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(). > > > > Patch1 predefines the names of all types of kmalloc to save > > the time spent dynamically generating names. > > > > The other 4 patches did some cleanup work. > > > > These changes make sense, and the time spent by new_kmalloc_cache() > > has been reduced by approximately 36.3%. > > > > Time spent by > > new_kmalloc_cache() > > 5.3-rc7 66264 > > 5.3-rc7+patch 42188 > > Note that the caches are created only once upon boot, so I doubt that Thank you for your comments. Yes, kmalloc-xxx are only created at boot time. > these time savings (is it in CPU cycles?) will be noticeable at all. Yes, it is CPU cycles. > But diffstat looks ok, and it avoids using kmalloc() (via kasprintf()) to > allocate names for kmalloc(), so in that sense I think it's worthwhile > to consider. Thanks. > Thanks. > > Pengfei Li (5): > > mm, slab: Make kmalloc_info[] contain all types of names > > mm, slab_common: Remove unused kmalloc_cache_name() > > mm, slab: Remove unused kmalloc_size() > > mm, slab_common: Make 'type' is enum kmalloc_cache_type > > mm, slab_common: Make initializing KMALLOC_DMA start from 1 > > > > include/linux/slab.h | 20 --------- > > mm/slab.c | 7 +-- > > mm/slab.h | 2 +- > > mm/slab_common.c | 101 +++++++++++++++++++++++-------------------- > > 4 files changed, 59 insertions(+), 71 deletions(-) > > >