Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp823675ybn; Tue, 24 Sep 2019 10:03:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6niyx7kxCHrZLQePXnXHu8SiZ1L1nf2+ZYT8bvFRQF4osJdzH7FzALNkPAoO1HAECyjx6 X-Received: by 2002:a5d:42cb:: with SMTP id t11mr3249908wrr.99.1569344605436; Tue, 24 Sep 2019 10:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569344605; cv=none; d=google.com; s=arc-20160816; b=qLqAImISL0WmdtvNBMINSlFejTRR9AwWe3bu+0xgITgomPFxAeiX0NE/FKW/f+yw/R g8Tql+2VbCdyUKMDgCOtWq+EKFQmuTaXRCnOfzvOu8OzypikoN/qaJwC7RTIjw5FN81n 54ox2kJqheJJeZnapuC7mMsjJK5kutl/9ergY0eg/4Sll6/ESMXCkwpD0VnV3Hjfja6R 9epD3ayTCE3269xMlrZuY24KR2mxdM6qEtg3lP7rg5E2KHz2bnq66NpCGz5NH/6nxi+C BaZpCDRGD6kvGSFJk/uazWn3/pqnBalkTUhZ+C3fOwta366pUCzluOODB7lsvKKZIY6W FLCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=auNuXMeMyMe+nvucDBj+uIoi22EYZzDpjbiwmbcP0hY=; b=CNIX7jFGdTcU3v/LX/iTvOcc3BdAf7vqlizbkAkr55l5Y5vdXK5PyqWX/0KhqnNTgp jBjV4di2NEtbL/2FQ2NOrhCmaH+yDmzpWuVmCE0uRI641en4TJCbhotv6Mo89yJlRoud +QZhCL65erw/b3s9lkUyrQ2abDjFIT5eIat1h0UKIoqEym4mZXLKlDGeuyCwQbepfYyN ZdGbd4EyiDT0nex5HtyVE75VX4FQZ87mUOzannqS5e9qVDSPCMxfQ3kBg5+aE9+fIiI2 +y5HbJkYl7jW2180mIQSUyWGQ+FJ8SCzc0FTjVw3JeUL2BDEQKqY+y1cc2NwJPeRv31z it4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dwi8Rwhp; 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 g32si1509520eda.330.2019.09.24.10.03.01; Tue, 24 Sep 2019 10:03:25 -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=Dwi8Rwhp; 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 S2439437AbfIWM1q (ORCPT + 99 others); Mon, 23 Sep 2019 08:27:46 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:38074 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439375AbfIWM1o (ORCPT ); Mon, 23 Sep 2019 08:27:44 -0400 Received: by mail-pl1-f194.google.com with SMTP id w10so6461152plq.5 for ; Mon, 23 Sep 2019 05:27:44 -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=hn64gjMKcpWPlP56KTt50Az8I4i6piVAr1qQR7nDyDhn0oyWGOv4/uv6aW9brzsikA bxDYcSjhclKISyr85nLqFjwmjm+pJHvWQj1BkyXilp3zfIbEbwrEPUvxIea9GYM5z7Zy +7g/rlDoVav+jYgJHfEpqm9M9rawBQeqiALwQS+Qk29u8bRQddaONhU4HIg5I1avmo2V +yYbtcSU8601qGR4uo8BwKR+B31vSaYP5McGjZzLCqJ6pv2/o6g7mnq7SNFI7dS9dah6 Grh6m9/EhsBS16GT76DhOqeon4qa5peCU6mmq4LBAS99NSV+H9yvm/tDTB/6h0hbQ73h xDtg== X-Gm-Message-State: APjAAAWkLAO/d5cWrmLS8PvxchYrbAFiF3M+cXz5iAI87og8ZNDg0A0t WGd1NBtur+TSPgSCrkTRuvI= 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4