Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp3209601ybe; Sun, 15 Sep 2019 09:58:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzw9feHHmv0nVaIAYnaIYAADX9Edri3ySDKZcx5pUUotO3LN9ddIwDQPFs56zhhesgiN08a X-Received: by 2002:a50:884c:: with SMTP id c12mr57600212edc.134.1568566700027; Sun, 15 Sep 2019 09:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568566700; cv=none; d=google.com; s=arc-20160816; b=rNLH4LnJ0uIL1/QEq3EO/aXr7TkVcHxarKKdHrlTCamMsOLdz6kRBjdDC7U2/BzQhn /dVB/v9vMVQ6h5AcDv1qFxONwSeltUrfaIyGx2NOaZ43wM7z4285aME9CUIoJ+eN6rsl eYP3oM5rGePJdVamfuDFO7E0Z68tvwvhq9CDZyuvOsMLnE1VSJrKEP80lwpjwLlQFjcH U8yn0TnG+qdvINWWkdzoDCKSj9y73IMU6zh2E0OUrVKVatz0OETScSmYpuAwbFsYzp0L XSXovo3keYstYj0P7zBW3Hby96nrzwwQabeXKoRKi2c5zb87uCA8nlH8LlZvsrMZek+n p8cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zr0c07NjDmSH5Cw3kJRhGheNFiNUbd4oIPE+u9OeCKU=; b=I11FiSJQtNAINX0OASGYVmwPw+IDA4P0Be4TVNug6kmZ4OnsajfBZF8aJYxogR38B/ z9UhRoV8GGttFX0kLtoBLK8lPe1+Ayn6SzjY1uyvLB5YJluKCZ8RchPTDo1B0kFMUDwW H92C7Xo/CSJWW3qcXymV4Q9JFf3O4QNpULjpNJfFw0+yG3AhF8Y9DbTyAO2nKE1YlkzA rEVqxUCQuUnsMklud9/YnbKxc483dOL2ShTtXKygV4P/nABba1uxXQ5rUTVtct99TbEU Tu1W/3D0JhBp2jJxxflFUrz2lit+MLg4ltJYba+fdsZDiH4coXbWUPAfacA4DhK7rKCn 0zDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mddTC6Sg; 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 z20si14738518edq.250.2019.09.15.09.57.56; Sun, 15 Sep 2019 09:58:20 -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=mddTC6Sg; 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 S1726206AbfIOQwM (ORCPT + 99 others); Sun, 15 Sep 2019 12:52:12 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:43830 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725904AbfIOQwL (ORCPT ); Sun, 15 Sep 2019 12:52:11 -0400 Received: by mail-pg1-f193.google.com with SMTP id u72so18012748pgb.10 for ; Sun, 15 Sep 2019 09:52:11 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=zr0c07NjDmSH5Cw3kJRhGheNFiNUbd4oIPE+u9OeCKU=; b=mddTC6SgYO2Ab78FK7UUhuQd1kwETldDpr5BXxpYb+fc8mge2xlIGeYMxpVaUY7nvR uOTQyCbJmz0EEvUKAWI/cQrJjSTlpzkpPRdJKMKc7X1W7v2JE4nGXDqTFvy/O/ovzm97 lXhRGG1iv1ixHyBj1NEDWSxrw+enMNU4S8QHT60tz59ACuf4xK2fN9cwytHTUk9m9Trc A9N9+gwU962IUT+ELhMevHDxVxIR6Fwy8cEdahUQyI1PY8mFjHUEEp2gnuqyC/RkuiCQ z5PuGS651NaGM7xzH6WRd5AYpNubAX4kYNWeYgqGN7SAVL1BR0L1gDaUq+6gmu3kwFN4 1qfQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=zr0c07NjDmSH5Cw3kJRhGheNFiNUbd4oIPE+u9OeCKU=; b=q6DAvRoSpy+/cZ1wObZRmNXzyLCB1ZaUV5ysmvxRU+XUismFR3ZxQehEZdqdm0eGRK 8eLq0w/Px3g2kFtEn3xGHWL8jdQsXf1QiSMwaI9/0MrCGnjbXobNo9F4aOOcmdputgZX rB2np/pKYBuQq0pOgsj/h3dx1mkixuniVrTtrefE6D0OpgTvgg5YDVTMmx3Nk3fpF8/V 3H3TqNivQGeDV0T7dUBT4fC1BPsoODBPrHwmsuIwu+PBYA2rXiPAZEXT46Dhfo2BK/h8 CnHeewIHBl/cCuE4g7gw6tY/L5WZIx5bV94p/Alg3viDyvKQwmyhvm85cP/R0kJUzHO7 sYIQ== X-Gm-Message-State: APjAAAVs37zKnLO5mxtiRBgoCblAt1IRaD2VgxUuLmr+Qk3w7gohVmDP Gqmzohpz3rvBzEjEn9P9rKA= X-Received: by 2002:a62:2d3:: with SMTP id 202mr69461597pfc.141.1568566331261; Sun, 15 Sep 2019 09:52:11 -0700 (PDT) Received: from localhost.localdomain.localdomain ([2408:823c:c11:160:b8c3:8577:bf2f:3]) by smtp.gmail.com with ESMTPSA id a4sm4383259pgq.6.2019.09.15.09.52.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Sep 2019 09:52:10 -0700 (PDT) From: Pengfei Li To: akpm@linux-foundation.org Cc: vbabka@suse.cz, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, guro@fb.com, Pengfei Li Subject: [PATCH v4 2/7] mm, slab: Remove unused kmalloc_size() Date: Mon, 16 Sep 2019 00:51:11 +0800 Message-Id: <20190915165121.7237-3-lpf.vector@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190915165121.7237-1-lpf.vector@gmail.com> References: <20190915165121.7237-1-lpf.vector@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The size of kmalloc can be obtained from kmalloc_info[], so remove kmalloc_size() that will not be used anymore. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka Acked-by: Roman Gushchin --- include/linux/slab.h | 20 -------------------- mm/slab.c | 5 +++-- mm/slab_common.c | 5 ++--- 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 56c9c7eed34e..e773e5764b7b 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -557,26 +557,6 @@ static __always_inline void *kmalloc(size_t size, gfp_t flags) return __kmalloc(size, flags); } -/* - * Determine size used for the nth kmalloc cache. - * return size or 0 if a kmalloc cache for that - * size does not exist - */ -static __always_inline unsigned int kmalloc_size(unsigned int n) -{ -#ifndef CONFIG_SLOB - if (n > 2) - return 1U << n; - - if (n == 1 && KMALLOC_MIN_SIZE <= 32) - return 96; - - if (n == 2 && KMALLOC_MIN_SIZE <= 64) - return 192; -#endif - return 0; -} - static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node) { #ifndef CONFIG_SLOB diff --git a/mm/slab.c b/mm/slab.c index c42b6211f42e..7bc4e90e1147 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1248,8 +1248,9 @@ void __init kmem_cache_init(void) */ kmalloc_caches[KMALLOC_NORMAL][INDEX_NODE] = create_kmalloc_cache( kmalloc_info[INDEX_NODE].name[KMALLOC_NORMAL], - kmalloc_size(INDEX_NODE), ARCH_KMALLOC_FLAGS, - 0, kmalloc_size(INDEX_NODE)); + kmalloc_info[INDEX_NODE].size, + ARCH_KMALLOC_FLAGS, 0, + kmalloc_info[INDEX_NODE].size); slab_state = PARTIAL_NODE; setup_kmalloc_cache_index_table(); diff --git a/mm/slab_common.c b/mm/slab_common.c index 002e16673581..8b542cfcc4f2 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1239,11 +1239,10 @@ void __init create_kmalloc_caches(slab_flags_t flags) struct kmem_cache *s = kmalloc_caches[KMALLOC_NORMAL][i]; if (s) { - unsigned int size = kmalloc_size(i); - kmalloc_caches[KMALLOC_DMA][i] = create_kmalloc_cache( kmalloc_info[i].name[KMALLOC_DMA], - size, SLAB_CACHE_DMA | flags, 0, 0); + kmalloc_info[i].size, + SLAB_CACHE_DMA | flags, 0, 0); } } #endif -- 2.21.0