Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4558552ybe; Mon, 16 Sep 2019 14:26:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyT1zRdD6s3UL6BolwIAvnK5LHf9bZMdCBSSpZpNmhnnQnAQjOuvnIRPzfk+Z2ki+d8kpiX X-Received: by 2002:a50:e005:: with SMTP id e5mr1365460edl.279.1568669186426; Mon, 16 Sep 2019 14:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568669186; cv=none; d=google.com; s=arc-20160816; b=mKAN2RhFgt9sFMqp9BGs6dPxUlfrmb6wHQ/rQypgxDh1W9li3zgTU1vJ+GBgPH+cSJ 7tQWL4mKLmsAKnVC0vhPg/UVyY4Zyp17QRyHIF5sGwjJY2+NU3NkqUGoabT6m9UZw4Fs 54Pi0kBIxT8Zov2cOq6yXh9ciDntX4T8qUXZcE7bMCSsguYWz45PUi2A/jGMjD//d96h EAaW5PB6+ht+iU3KTCnjwXkiuTrpH0jOJlTvQrzQzGUUcjnhZM9H3ldy03Wrj8+4KMW6 dtMpJCL1dayVznHVdHMJ8CE5xrA7lGNOa8TM53NyZ5HkIH/hpxt/zl/TPP8sFGo6zswS 2jBw== 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=d7Q0z2EasZ8/1ldA12KLzNbebPjqFp3ShlnBdaO1amY=; b=Wjzk0owDrc25nMt+HuF6zKhP8opUPtUxTwFRjeXAUkLXue/pZF0P4JodOYNyg2UXFO IBTM0R/+DTUiqhIKPbVqCGEiQOhxZMzE+atBGT8XJqYXsGb6MF8pUZT87wvd3kWXet8D duMZ/KZy9UGy6dOy3B3D/691L9aBA7dBlFQp5n2wbiAf9GAuiFAc43kwl0GPLnpaK0/N OXoCouNcYWviv3HDw3BItFr4eQuEFZ2CpE5Uhr0Xqh5Kb2xihPuo9aFVMbj2HJcBi74h pISZCenSvN201sHeVPjHqArIGMmyxa0zGcUobqfmeL7dd2GuJvdJaTO6xaXxOKT8/PzR +RFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BmJ5hx5b; 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 c20si180259edv.246.2019.09.16.14.26.01; Mon, 16 Sep 2019 14:26:26 -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=BmJ5hx5b; 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 S1731989AbfIPOqp (ORCPT + 99 others); Mon, 16 Sep 2019 10:46:45 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40864 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbfIPOqp (ORCPT ); Mon, 16 Sep 2019 10:46:45 -0400 Received: by mail-pg1-f194.google.com with SMTP id w10so130603pgj.7 for ; Mon, 16 Sep 2019 07:46:43 -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=d7Q0z2EasZ8/1ldA12KLzNbebPjqFp3ShlnBdaO1amY=; b=BmJ5hx5bZeYzBaMASNSBw7TKgI8T7IVDzo+AXUN2oSUIlaTP7YJxGtSd0pJWV1Vs9r 6ZAn7Ja08Yrd3PP4tJ/j03GSLhLfjub1yp/1hMNM4ZACT89L7mS3gWZFe5Y4AS6WuCxv Uq1eECAtwGOmRZoCKIImWTnydyaGZJxL77AvGPnUo2bJKH3h9uZZVN9OJ69WldsdCLVb BzX/FLRAMZL75nm5ozBNb1RWKrf15wKqnqlVPi60uhPqI5xLdNwDf2yy9htLeVZ5wiNz 4PqAS9SV/5Huxe9n45jQMKxeLK4Bi9thYUvQiw+3v22lZevqW7D78kaCUJVhKh7bHfsc /c6g== 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=d7Q0z2EasZ8/1ldA12KLzNbebPjqFp3ShlnBdaO1amY=; b=LJbX3xq4rs9BCnYGV2Mx2vP4yGW9YCQIU5eqCfMatID47veLHXKGgq5vDcvdWP4rkZ KVw/TSypDD09RsBOkV+WNeOUZf66vgxIrzRVj3/Q9q8iCxu3PUWvnt2zpxU7bZZDKJwY 0d+kPJLB3M9m/ErNgkix5GEpGJJCjj6TmxKuFdLOAQsytL3REGfFR1ZJJ4huadAcOGC4 HvvV7XqiR66WKKyxw2DT5GVxG5Mpgknq0aTN2ux4PIai9D+wxHambY0oI68y847zv2ap 0Th8/COWrppLYh1XXcJNMqrZTjmcYKhoXwClVm0goUthU2Y/A+k7LauNfMiN9lrXctBb KxKw== X-Gm-Message-State: APjAAAUH+3VQbor0aDt1LkAvdrp+sumL7h/B1qJgCInGUV3TzfGNGYXa 9JHZEf49cRzd14DtcUGZ34g= X-Received: by 2002:a62:75d2:: with SMTP id q201mr71101005pfc.43.1568645203635; Mon, 16 Sep 2019 07:46:43 -0700 (PDT) Received: from localhost.localdomain.localdomain ([2408:823c:c11:160:b8c3:8577:bf2f:3]) by smtp.gmail.com with ESMTPSA id d190sm15036004pgc.25.2019.09.16.07.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Sep 2019 07:46:42 -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 v5 2/7] mm, slab: Remove unused kmalloc_size() Date: Mon, 16 Sep 2019 22:45:53 +0800 Message-Id: <20190916144558.27282-3-lpf.vector@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190916144558.27282-1-lpf.vector@gmail.com> References: <20190916144558.27282-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 Acked-by: David Rientjes --- 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 4e78490292df..df030cf9f44f 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