Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5975340ybe; Tue, 10 Sep 2019 11:35:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzSLrfSQHGXCG3LkmdxLKsfgkv2emWitEwSvdy8Yz+o/c/F356YDvaVvwqidUF7UEMRUIMo X-Received: by 2002:a17:906:af8c:: with SMTP id mj12mr27101913ejb.58.1568140531267; Tue, 10 Sep 2019 11:35:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568140531; cv=none; d=google.com; s=arc-20160816; b=sRKShQeRj9QpBbD2gvl8MkP1p6TfDWFK73UdqAyn5qaNL21f2WW8ptFK/aDcwyeq6n prOLjM79OV9b7kvGQaUPPBmV3LmM+glhbt29lQ0Aa6AC23izntGA0qzmrAQ2Zmc/H6BP o6M1tSJpVoPz6yatJC6lCJj+EEuUxWcUImQ19IEP2PJeyUwOcPT5wTDEC/jXQ6xyJDSq aOjPNqX5nlGeyWNmLPz+0xzPqFcdpBQ09wl+9OqQy7JIcMtRd9MSybXl9q4sMkRXmz7Q XmgEwWhnoK4QvEbWE8yBiScBN11QvL7yDN3KGaN6GKAhR6soMkjtJ3v6m8ftqGU9XXos 0lnQ== 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=IAG1VLKBZpRTEI8L4+2XUQIRSxmDIwmG8l7u8lqUj7s=; b=vajTT1Ox4p30Ak9SNhCciozB3++9AlCBqLXi6sa+h783loBxgjdFaONjveW9XgPF6W A4aM156Px2rxlJ17Sbji9ftVv6xyW8c9RnDrfPF2EVhzUFJGSnx2ttbYrsuF3IPN0Xl/ etAVVtfCKkV+kAu7VDCcLqhv0HgXnx+LSllXKdqrgAkngEOfyjYzdcUAUHNuzDVlZnW6 dMFbNQcYxYo4pplytOHPMf8zY0Ho/53sFcS6L0HKRl0YoW8c6uXvaqvC4jM7S3/NJwar eUMxwa0M3SH1kMKjIxXu+IPr3zTr2gd6O6L8e1Iz0uKt77WOkP0z5sM0ro2rfjiad+Ns aOng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UuVcZXvR; 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 a9si11073828edv.158.2019.09.10.11.35.07; Tue, 10 Sep 2019 11:35:31 -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=UuVcZXvR; 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 S2405372AbfIIRIO (ORCPT + 99 others); Mon, 9 Sep 2019 13:08:14 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45838 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726671AbfIIRIN (ORCPT ); Mon, 9 Sep 2019 13:08:13 -0400 Received: by mail-pf1-f195.google.com with SMTP id y72so9515209pfb.12 for ; Mon, 09 Sep 2019 10:08:13 -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=IAG1VLKBZpRTEI8L4+2XUQIRSxmDIwmG8l7u8lqUj7s=; b=UuVcZXvRYiGsCOXoX7QtHfrnf25gH30tm3Jr+MLFXtA0xo/UN3oUbJHtk5i1n0Ilb3 IZL9SiXjwDj+bm3AtV9wLg3n6Jswk30v2yH6HpLhfbrVl6pTWflcxilGtD/kV1H0aJ36 dB8Pr7vF+PX/NrDC4T6C40H5DtyEHkOJNskSEX+bN2SScynCsurEyZj2XeCPs2wRUr4g HXNJk6SrR5OgR+WzJaTTuH0fMzZgKMpJr1BmKVQg6/zn1jE7cWhxg4MlOklK1NkWr0Wn b8OpbRs1OD0DzyZNmS10ql7vR4FEOEGP+a/u8M9idhR2f52v15FWTrlXEQyJC8TprYCl IaNA== 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=IAG1VLKBZpRTEI8L4+2XUQIRSxmDIwmG8l7u8lqUj7s=; b=DyZJpXWqM0mn2Pr4L3UDZqeWPaWUkUFzBHKQ1DOFrGeaoQcYwofOZ9/tKKLZ6Y1gXY TBxLx7nt5jac6XtUxwNza4Ex/n4zbLslPUYRc4PEMXexs+T79wQvUc+QxajNfy8M/lze 4f2/sWx00EhSItcpE+Jxv/EXgimNw0dcn1Gu+2DuZY3X9Lrx4L7dNXUBry80+27XzmQ7 y792sQSLS9FPo1LjTnA11K+U4oKb6mvobuyFPH5QdjSWTPzwMirW3kc2RHOyBGeDoJSo 27qiIaLn1fAWM8qHXNet1/sWzl20DE37btdPlp1Tp9v5W2FyTRmUmuxKFYIGwD5QMs6d bnGQ== X-Gm-Message-State: APjAAAUaZASmEqJ8F8YWlHmdG0IBr330bmwRjyhflqq0oXuVhhQVHUFK 1vEMnk7A48+a+qF/aDaXihs= X-Received: by 2002:a63:5823:: with SMTP id m35mr23177084pgb.329.1568048892858; Mon, 09 Sep 2019 10:08:12 -0700 (PDT) Received: from localhost.localdomain.localdomain ([2408:823c:c11:160:b8c3:8577:bf2f:3]) by smtp.gmail.com with ESMTPSA id b18sm107015pju.16.2019.09.09.10.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2019 10:08:12 -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, Pengfei Li Subject: [PATCH v2 2/4] mm, slab: Remove unused kmalloc_size() Date: Tue, 10 Sep 2019 01:07:13 +0800 Message-Id: <20190909170715.32545-3-lpf.vector@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190909170715.32545-1-lpf.vector@gmail.com> References: <20190909170715.32545-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 --- 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 61c1e2e54263..cae27210e4c3 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