Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp2184716ybe; Tue, 3 Sep 2019 09:07:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3ftsAW1DaiMKLOqCHfC9Ei05f12MOp3yshxJLbatZPAKgU+8muQlILSTa7HaYrUg/me5k X-Received: by 2002:a17:90a:37c9:: with SMTP id v67mr23340pjb.29.1567526868843; Tue, 03 Sep 2019 09:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567526868; cv=none; d=google.com; s=arc-20160816; b=AX/s198Q1/0bhwQZuV7TgtoLwxCbjr599HXEFfBYuCNK9r/WazRYC3CSv/jgPi/UOm bZyhdCvYJc5xeAXTvAMkQdQxq5US/0CLXp+IecQCuYnrtHZ1Y9PvQBYnAqtsd+or5v/I v+lJf1r6JzAvLo8qNMnlISlhcTf1z2g4OsMxWv4mzjx15BaL9/BeAT2L6lPnP/ru3psd deqVuUQG14Nlr9AJiON4k0XttpqSaKPrMBwF3P0tIgLzUJfYtGhqeY8Eix8gkmLVrulc aIOIjrQOUINZiKUDr/cIbEsbhgF2wHqwstRRfofP4Qq9VH68MRGrEWb0iaZabJycK9DG KJiw== 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=sCfAZ6FcWE/Ra7JeZeEWDGvzMRc1z2NIPSNI/z4SnG4=; b=fELTLVx0YBYcNvVfK2RlhNMufzCJwXEGkFIUNZB6kBIepxyQDtocAWaEjUsSxSF1TJ DVNpx3yu3Vw/aN+0kQW/sD8iHzPGdNeK1H6AK1W1ko5PI+RynHduhuwAAbPbLXyYJehr 4sf2jYoMnEfpZ51dggczABU1+pQk8YEXrO+mxoF4Z5L6VzcJrbhfalXXACMC3Ya2DSfu 7dS49XMnYl2U+VahBdVM1ARNFtkfoQfMM/slO++HTEQDDDiOPdTe1rABngVODVuNQF0S O5stLmgBGOMhT68b9C/Ria9zHJ0QmTBz5Nlx6NB80WlZkmPpJCyKI7dWgwydh5I8nik1 GUZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V3J24BLz; 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 z21si10905883pfj.69.2019.09.03.09.07.33; Tue, 03 Sep 2019 09:07:48 -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=V3J24BLz; 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 S1729964AbfICQGG (ORCPT + 99 others); Tue, 3 Sep 2019 12:06:06 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:45575 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729709AbfICQGF (ORCPT ); Tue, 3 Sep 2019 12:06:05 -0400 Received: by mail-pf1-f193.google.com with SMTP id y72so3479859pfb.12 for ; Tue, 03 Sep 2019 09:06:05 -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=sCfAZ6FcWE/Ra7JeZeEWDGvzMRc1z2NIPSNI/z4SnG4=; b=V3J24BLzylgKwKh6YH7jauZXbnITYVEVj7ZDmCfsKzdE98Rym6ITHptLSyHLk9j+qQ Eh7DX/9mRvIH1jMR4AsNEk7Hcu/EdM5OdA9NLcejVpEc22i+WxGtJt1klI+26KfPi8m6 vXpfw859zeEADTFrb7idJrVIX/n2Ib4Ds6uN0V9355TG55imO0lHfGIFAqh3SVJN8l7P DGaT3/zSOaeD4Hbih9tFpj19xrtTvONbee0eKHoyVIG+Ckfq8DywENu3xMmv9AXNuPId KOW0JUkZepbrcrLbJCaq3B/kxIU5hQ7xDkd4fme2mJd70Nk5SOkcLR5uT96cLlZ9J7RU aj5Q== 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=sCfAZ6FcWE/Ra7JeZeEWDGvzMRc1z2NIPSNI/z4SnG4=; b=kCmz90Dj9+qNWVcRW8Z0uhm9/jOBi+9eMGTLMIIPBlKp+W5pRVBKbbB7cVeBB6+qa4 eLApku7A2w+/mtclNRse9cMlSEY173BWIFTNEkPHGHEB5N9j+XTv0rEDTrtxpXONaDCk /1/To3e90+Ya/+CGnm/FW/9YTIDDle9iTGAge56yexlfh4XlhhvIaBVt8Qd0r3pRx7+Y /AUfkzFxNmuF05uRDIW7pvzy6T0JWds+QOmZt+nqebcF3fqyrXsGcHKUZ2XLp7Fh0ILJ cjL2AjDFH23UtbB/+lMldwCcPrI/QE8lyyNWj8YUmAMbnfkotpBmJvq3je7Qzm3Jmdcr xIJg== X-Gm-Message-State: APjAAAVsSFUfyVrP76qX5CJDZ4V9E4atLTz8zBzJcw0hAMemAK6G2U0p noTdMeemvojdWPUx9X38oek= X-Received: by 2002:a65:41c6:: with SMTP id b6mr30842525pgq.269.1567526765171; Tue, 03 Sep 2019 09:06:05 -0700 (PDT) Received: from localhost.localdomain.localdomain ([2408:823c:c11:160:b8c3:8577:bf2f:3]) by smtp.gmail.com with ESMTPSA id t11sm18501567pgb.33.2019.09.03.09.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:06:04 -0700 (PDT) From: Pengfei Li To: 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, Pengfei Li Subject: [PATCH 3/5] mm, slab: Remove unused kmalloc_size() Date: Wed, 4 Sep 2019 00:04:28 +0800 Message-Id: <20190903160430.1368-4-lpf.vector@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190903160430.1368-1-lpf.vector@gmail.com> References: <20190903160430.1368-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 --- 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