From patchwork Mon Sep 23 12:27:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Li X-Patchwork-Id: 11156701 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9656F13B1 for ; Mon, 23 Sep 2019 12:27:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F02D214DA for ; Mon, 23 Sep 2019 12:27:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Dwi8Rwhp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F02D214DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 809096B000A; Mon, 23 Sep 2019 08:27:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 793B06B000C; Mon, 23 Sep 2019 08:27:46 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 632406B000D; Mon, 23 Sep 2019 08:27:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0031.hostedemail.com [216.40.44.31]) by kanga.kvack.org (Postfix) with ESMTP id 3B1416B000A for ; Mon, 23 Sep 2019 08:27:46 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id D397C824378B for ; Mon, 23 Sep 2019 12:27:45 +0000 (UTC) X-FDA: 75966111690.10.quilt54_60d2203b75b62 X-Spam-Summary: 2,0,0,d63f456fd8fb3f62,d41d8cd98f00b204,lpf.vector@gmail.com,:akpm@linux-foundation.org:cl@linux.com:penberg@kernel.org:rientjes@google.com:iamjoonsoo.kim@lge.com:vbabka@suse.cz:guro@fb.com::linux-kernel@vger.kernel.org:lpf.vector@gmail.com,RULES_HIT:41:69:355:379:541:968:973:981:988:989:1260:1345:1437:1535:1542:1711:1730:1747:1777:1792:1801:2198:2199:2393:2559:2562:2731:2892:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3870:3871:3874:4605:5007:6261:6653:7875:7903:8603:9121:9413:10004:11026:11233:11473:11658:11914:12043:12291:12296:12297:12517:12519:12555:12683:12895:13161:13229:13548:14095:14394:14687:14721:21080:21433:21444:21451:21627:21666:30029:30030:30054:30069:30075,0,RBL:209.85.214.195:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: quilt54_60d2203b75b62 X-Filterd-Recvd-Size: 5160 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Sep 2019 12:27:45 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id s17so4983188plp.6 for ; Mon, 23 Sep 2019 05:27:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=auNuXMeMyMe+nvucDBj+uIoi22EYZzDpjbiwmbcP0hY=; b=Dwi8Rwhpumd5m1szOxbaiwVHT5innrszEicWzrrUjwjiwKU9vH8idiORVVxfc3YaBF MmN6wUtjKZRzAPiGc5ccWNEHYjxjBfZeFx/u1KXE2OBnvqvLR+iplp9IwpJtNZGnZcVk FU0zEgJkE+dWYPwzRyQuxNV/PLJFq0gyOkzhRxIJHmz5IxYaiZ3lg3gPETxYrjN1D09f +NjCxIQJ1p0GxAfnpt1TWgLUa9OG3CJDuvvFHpYv+cufV+rXJ6aw4UNxeyPU7vbjojlk uoc2VakbM/0u28AYPAw8U0FizeD1Le14QM5P5vJ3UyHjM1kIFu9UdZSN8rvgRwNe/Q2C Aq8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=auNuXMeMyMe+nvucDBj+uIoi22EYZzDpjbiwmbcP0hY=; b=bnnK2NvzFZy4m92yHwORoNtTuD/SgZE4Wc+GW1SIA/iTY9XL20riydbkRYI3EXIHTD BHU64iz+uDGOiaEDeJ2N+L06yqBvMymOsn108WoEIIuDR27uCIG8jwkcK9ZosMQ6DIZN kfqx/aVIx5QKHu7cVYIc4bmyfuKYtdsV5YZiAdiDahx5HYFSdbcZErpm8bHtasIEdIO4 osLe8hvaKpE6NMPosz5FlEKdnCKhtWNz+sHmMFWNV/sUv5Dp+pKzbDmZfiwNesN/Mh9x OY/5Xzk1nT0LOznSnq84s5oxv5b4Fg5GxePsHpkgkICx8NeEFVG6wH7OwuAKL8UmL/sr Ef7Q== X-Gm-Message-State: APjAAAVStO/ePkhyUPLHjZZDafEr56Ym9iPdAU2Ztm8xe2E4LmMyf9Qu FYXof8wzobY5rcLy2WVoUZI= X-Google-Smtp-Source: APXvYqx292SWALRo+kG8973EYAzY7HhL1QO4p/t7Sznp4vgFroRNUkc3Vk/6TcRGXm/I4os3PGwoKQ== X-Received: by 2002:a17:902:7008:: with SMTP id y8mr31550908plk.176.1569241664061; Mon, 23 Sep 2019 05:27:44 -0700 (PDT) Received: from mi-OptiPlex-7050.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 202sm9692016pfu.161.2019.09.23.05.27.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Sep 2019 05:27:43 -0700 (PDT) From: Pengfei Li To: akpm@linux-foundation.org Cc: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz, guro@fb.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Pengfei Li Subject: [PATCH v6 0/3] mm, slab: Make kmalloc_info[] contain all types of names Date: Mon, 23 Sep 2019 20:27:25 +0800 Message-Id: <1569241648-26908-1-git-send-email-lpf.vector@gmail.com> X-Mailer: git-send-email 2.7.4 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Changes in v6 --- 1. abandon patch 4-7 (Because there is not enough reason to explain that they are beneficial) Changes in v5 -- 1. patch 1/7: - rename SET_KMALLOC_SIZE to INIT_KMALLOC_INFO 2. patch 5/7: - fix build errors (Reported-by: kbuild test robot) - make all_kmalloc_info[] static (Reported-by: kbuild test robot) 3. patch 6/7: - for robustness, determine kmalloc_cache is !NULL in new_kmalloc_cache() 4. add ack tag from David Rientjes Changes in v4 -- 1. [old] abandon patch 4/4 2. [new] patch 4/7: - return ZERO_SIZE_ALLOC instead 0 for zero sized requests 3. [new] patch 5/7: - reorder kmalloc_info[], kmalloc_caches[] (in order of size) - hard to split, so slightly larger 4. [new] patch 6/7: - initialize kmalloc_cache[] with the same size but different types 5. [new] patch 7/7: - modify kmalloc_caches[type][idx] to kmalloc_caches[idx][type] Patch 4-7 are newly added, more information can be obtained from commit messages. Changes in v3 -- 1. restore __initconst (patch 1/4) 2. rename patch 3/4 3. add more clarification for patch 4/4 4. add ack tag from Roman Gushchin Changes in v2 -- 1. remove __initconst (patch 1/5) 2. squash patch 2/5 3. add ack tag from Vlastimil Babka 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. 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() (CPU cycles) 5.3-rc7 66264 5.3-rc7+patch 42188 Pengfei Li (3): mm, slab: Make kmalloc_info[] contain all types of names mm, slab: Remove unused kmalloc_size() mm, slab_common: Use enum kmalloc_cache_type to iterate over kmalloc caches include/linux/slab.h | 20 ----------- mm/slab.c | 7 ++-- mm/slab.h | 2 +- mm/slab_common.c | 99 ++++++++++++++++++++++++++++------------------------ 4 files changed, 58 insertions(+), 70 deletions(-)