From patchwork Tue Sep 3 16:04:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Li X-Patchwork-Id: 11128327 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 872E3112C for ; Tue, 3 Sep 2019 16:05:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5306D22CF8 for ; Tue, 3 Sep 2019 16:05:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eyiGd1Fn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5306D22CF8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6CACD6B0008; Tue, 3 Sep 2019 12:05:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 69F406B000C; Tue, 3 Sep 2019 12:05:40 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B5386B000D; Tue, 3 Sep 2019 12:05:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0079.hostedemail.com [216.40.44.79]) by kanga.kvack.org (Postfix) with ESMTP id 3850E6B0008 for ; Tue, 3 Sep 2019 12:05:40 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 59C7B180AD802 for ; Tue, 3 Sep 2019 16:05:39 +0000 (UTC) X-FDA: 75894084798.11.toes11_6b766ee120520 X-Spam-Summary: 2,0,0,944dc1c48f814a9b,d41d8cd98f00b204,lpf.vector@gmail.com,:akpm@linux-foundation.org:cl@linux.com:penberg@kernel.org:rientjes@google.com:iamjoonsoo.kim@lge.com::linux-kernel@vger.kernel.org:lpf.vector@gmail.com,RULES_HIT:2:41:69:355:379:421:541:800:960:973:981:988:989:1260:1311:1314:1345:1359:1437:1500:1515:1535:1605:1606:1730:1747:1777:1792:1801:2393:2559:2562:2693:3138:3139:3140:3141:3142:3865:3866:3867:3868:3870:3871:4119:4321:4605:5007:6238:6261:6653:7514:7903:8603:9413:9592:10004:11026:11232:11473:11658:11914:12043:12291:12296:12297:12438:12517:12519:12555:12683:12895:12986:13161:13229:13894:14394:14687:21080:21444:21450:21451:21627:21666:21740:30029:30030:30054,0,RBL:209.85.215.196:@gmail.com:.lbl8.mailshell.net-62.50.175.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: toes11_6b766ee120520 X-Filterd-Recvd-Size: 8500 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Sep 2019 16:05:37 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id 4so5843605pgm.12 for ; Tue, 03 Sep 2019 09:05:37 -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=3R6GNQTCXgbRrWxJjxATxmqs/IqC5x2/MNJljUE6Ja0=; b=eyiGd1FnhuKFyvbOO6BoNVfiXcD4NdBKXsJ498SGEjZtnAiwBGPVRuPrU/84gSjRPU n/4iGhuTTI7Vv2EVUI2RqCCfy+agbFBHgVPpCQJwNsxXguQxZl3062cKMnaw88bzpBh7 lEh4tuA5YnUhbgZrwSjRftcxoykuDDx8EM0YNpssc/WWGKU3LX2YlxqDG741IaV7BKh5 qt1t64ckrcjrYM7iVAdt7awrVCUG7i5zCW1+tbM2wsqiQWl2oUoXZCsS48gkBpwH+bFV 3ocp/+PA81nIXkreCYiLe56l9AstYLE5nm4nhG8VRts+MBSrlNf6Y6seFKPlX4IIBTrC TTiQ== 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=3R6GNQTCXgbRrWxJjxATxmqs/IqC5x2/MNJljUE6Ja0=; b=LPBKRZ6vcLgaF+wDAaOOX+cXQ3kSI3szhk4ITBTONffki5fyuk/NXsNVIpmFmapEnC eX3Bp4zQmif69rtr6AV3pYhxDGjUk1LE6nzF1O3mo1kmhPXx/gddZ/iUE2lDSinggsLE 1KXkMRhDeyItv0BdOTu6y/9ZTKJPBSa8gWKE63DO1pMf1hbVf7dle0mzHIjIa8DObbeN 2iz3f4jnDEIQc5q2fqmFO3UT0qn5GI6bQMt+sZeRlk37R3uj8BNwtkE9XHltL41T20MC vBix7CxKMWvgzRa+5boCE0PBUbpG/SUO3uIYEIzhjj/xbTwQ4SNHXOlIiC8Hh433f2Ee r16g== X-Gm-Message-State: APjAAAVgFqmRiHtKE2f1MVM9jSeximBdO07P4wtFfiWIkXrUgSYkrM2D 7aVS81hwOyKIMl9noUuZEMU= X-Google-Smtp-Source: APXvYqw7NXxIGPON+s2yb/sK0y+666y8zIxbQ5qMX9j49XhjvvY3OVT8qKJPrXo8/tUrFVETOpVaXQ== X-Received: by 2002:a17:90a:33a9:: with SMTP id n38mr58186pjb.18.1567526736536; Tue, 03 Sep 2019 09:05:36 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:05:36 -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 1/5] mm, slab: Make kmalloc_info[] contain all types of names Date: Wed, 4 Sep 2019 00:04:26 +0800 Message-Id: <20190903160430.1368-2-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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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(). This patch predefines the names of all types of kmalloc to save the time spent dynamically generating names. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka --- mm/slab.c | 2 +- mm/slab.h | 2 +- mm/slab_common.c | 76 +++++++++++++++++++++++++++++++----------------- 3 files changed, 51 insertions(+), 29 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index 9df370558e5d..c42b6211f42e 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1247,7 +1247,7 @@ void __init kmem_cache_init(void) * structures first. Without this, further allocations will bug. */ kmalloc_caches[KMALLOC_NORMAL][INDEX_NODE] = create_kmalloc_cache( - kmalloc_info[INDEX_NODE].name, + kmalloc_info[INDEX_NODE].name[KMALLOC_NORMAL], kmalloc_size(INDEX_NODE), ARCH_KMALLOC_FLAGS, 0, kmalloc_size(INDEX_NODE)); slab_state = PARTIAL_NODE; diff --git a/mm/slab.h b/mm/slab.h index 9057b8056b07..2fc8f956906a 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -76,7 +76,7 @@ extern struct kmem_cache *kmem_cache; /* A table of kmalloc cache names and sizes */ extern const struct kmalloc_info_struct { - const char *name; + const char *name[NR_KMALLOC_TYPES]; unsigned int size; } kmalloc_info[]; diff --git a/mm/slab_common.c b/mm/slab_common.c index 807490fe217a..7bd88cc09987 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1092,26 +1092,56 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags) return kmalloc_caches[kmalloc_type(flags)][index]; } +#ifdef CONFIG_ZONE_DMA +#define SET_KMALLOC_SIZE(__size, __short_size) \ +{ \ + .name[KMALLOC_NORMAL] = "kmalloc-" #__short_size, \ + .name[KMALLOC_RECLAIM] = "kmalloc-rcl-" #__short_size, \ + .name[KMALLOC_DMA] = "dma-kmalloc-" #__short_size, \ + .size = __size, \ +} +#else +#define SET_KMALLOC_SIZE(__size, __short_size) \ +{ \ + .name[KMALLOC_NORMAL] = "kmalloc-" #__short_size, \ + .name[KMALLOC_RECLAIM] = "kmalloc-rcl-" #__short_size, \ + .size = __size, \ +} +#endif + /* * kmalloc_info[] is to make slub_debug=,kmalloc-xx option work at boot time. * kmalloc_index() supports up to 2^26=64MB, so the final entry of the table is * kmalloc-67108864. */ const struct kmalloc_info_struct kmalloc_info[] __initconst = { - {NULL, 0}, {"kmalloc-96", 96}, - {"kmalloc-192", 192}, {"kmalloc-8", 8}, - {"kmalloc-16", 16}, {"kmalloc-32", 32}, - {"kmalloc-64", 64}, {"kmalloc-128", 128}, - {"kmalloc-256", 256}, {"kmalloc-512", 512}, - {"kmalloc-1k", 1024}, {"kmalloc-2k", 2048}, - {"kmalloc-4k", 4096}, {"kmalloc-8k", 8192}, - {"kmalloc-16k", 16384}, {"kmalloc-32k", 32768}, - {"kmalloc-64k", 65536}, {"kmalloc-128k", 131072}, - {"kmalloc-256k", 262144}, {"kmalloc-512k", 524288}, - {"kmalloc-1M", 1048576}, {"kmalloc-2M", 2097152}, - {"kmalloc-4M", 4194304}, {"kmalloc-8M", 8388608}, - {"kmalloc-16M", 16777216}, {"kmalloc-32M", 33554432}, - {"kmalloc-64M", 67108864} + SET_KMALLOC_SIZE(0, 0), + SET_KMALLOC_SIZE(96, 96), + SET_KMALLOC_SIZE(192, 192), + SET_KMALLOC_SIZE(8, 8), + SET_KMALLOC_SIZE(16, 16), + SET_KMALLOC_SIZE(32, 32), + SET_KMALLOC_SIZE(64, 64), + SET_KMALLOC_SIZE(128, 128), + SET_KMALLOC_SIZE(256, 256), + SET_KMALLOC_SIZE(512, 512), + SET_KMALLOC_SIZE(1024, 1k), + SET_KMALLOC_SIZE(2048, 2k), + SET_KMALLOC_SIZE(4096, 4k), + SET_KMALLOC_SIZE(8192, 8k), + SET_KMALLOC_SIZE(16384, 16k), + SET_KMALLOC_SIZE(32768, 32k), + SET_KMALLOC_SIZE(65536, 64k), + SET_KMALLOC_SIZE(131072, 128k), + SET_KMALLOC_SIZE(262144, 256k), + SET_KMALLOC_SIZE(524288, 512k), + SET_KMALLOC_SIZE(1048576, 1M), + SET_KMALLOC_SIZE(2097152, 2M), + SET_KMALLOC_SIZE(4194304, 4M), + SET_KMALLOC_SIZE(8388608, 8M), + SET_KMALLOC_SIZE(16777216, 16M), + SET_KMALLOC_SIZE(33554432, 32M), + SET_KMALLOC_SIZE(67108864, 64M) }; /* @@ -1179,18 +1209,11 @@ kmalloc_cache_name(const char *prefix, unsigned int size) static void __init new_kmalloc_cache(int idx, int type, slab_flags_t flags) { - const char *name; - - if (type == KMALLOC_RECLAIM) { + if (type == KMALLOC_RECLAIM) flags |= SLAB_RECLAIM_ACCOUNT; - name = kmalloc_cache_name("kmalloc-rcl", - kmalloc_info[idx].size); - BUG_ON(!name); - } else { - name = kmalloc_info[idx].name; - } - kmalloc_caches[type][idx] = create_kmalloc_cache(name, + kmalloc_caches[type][idx] = create_kmalloc_cache( + kmalloc_info[idx].name[type], kmalloc_info[idx].size, flags, 0, kmalloc_info[idx].size); } @@ -1232,11 +1255,10 @@ void __init create_kmalloc_caches(slab_flags_t flags) if (s) { unsigned int size = kmalloc_size(i); - const char *n = kmalloc_cache_name("dma-kmalloc", size); - BUG_ON(!n); kmalloc_caches[KMALLOC_DMA][i] = create_kmalloc_cache( - n, size, SLAB_CACHE_DMA | flags, 0, 0); + kmalloc_info[i].name[KMALLOC_DMA], + size, SLAB_CACHE_DMA | flags, 0, 0); } } #endif From patchwork Tue Sep 3 16:04:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Li X-Patchwork-Id: 11128329 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2AC0814F7 for ; Tue, 3 Sep 2019 16:05:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E188023711 for ; Tue, 3 Sep 2019 16:05:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GsrgTbga" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E188023711 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1E5EC6B000C; Tue, 3 Sep 2019 12:05:52 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 197176B000D; Tue, 3 Sep 2019 12:05:52 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0AD0B6B000E; Tue, 3 Sep 2019 12:05:52 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id DF5116B000C for ; Tue, 3 Sep 2019 12:05:51 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 7294A181AC9B6 for ; Tue, 3 Sep 2019 16:05:51 +0000 (UTC) X-FDA: 75894085302.07.roll41_6d4af0cdc6829 X-Spam-Summary: 2,0,0,ae00fdaf90e25fae,d41d8cd98f00b204,lpf.vector@gmail.com,:akpm@linux-foundation.org:cl@linux.com:penberg@kernel.org:rientjes@google.com:iamjoonsoo.kim@lge.com::linux-kernel@vger.kernel.org:lpf.vector@gmail.com,RULES_HIT:41:69:355:379:541:800:960:968:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1540:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3871:3874:4321:4419:5007:6261:6653:7514:8603:9413:9592:10004:11026:11658:11914:12043:12114:12297:12438:12517:12519:12555:12895:12986:13069:13311:13357:13894:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:30029:30054,0,RBL:209.85.210.194:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: roll41_6d4af0cdc6829 X-Filterd-Recvd-Size: 3917 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Sep 2019 16:05:50 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id w16so11066089pfn.7 for ; Tue, 03 Sep 2019 09:05:50 -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=oDjYh1SsltbOsBEB420dFALj+pbpv/F7VefYy840/EY=; b=GsrgTbgaFBhQFrgMq1YXV4RcR8zjQ92lvCgtyccS3iRm7gcJ5k1MEg9O6oXgHMo1uw GjDU6QjiPGgWmOnRQawMZ0TDo+gQ4THlJHPVk9GT/RLACj4Q7n+i6nIKI3WTzBlmBorM Oaeizkzy5iXh5H/4je9rGcysSeMPbIY76OHNUfmoPxnj8ypctXVBadQ7ZvKK5cb6uFgL UBAr3eR8Ub+H5/3P+4O/KzsjzvkQwLTTYI7uocFkQ6ZEUiVLYY00fYEK2pcRNZHkflf6 cH2mY/iB0eqUuBnGejO+Urv3EfLgYnwLRot8i4xUkb3sG5+yRbVpbDH1W4O+gFwQ0ML/ GCQw== 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=oDjYh1SsltbOsBEB420dFALj+pbpv/F7VefYy840/EY=; b=SIjRsTZNeNgqHnnnxi+4zCBvMF6tOQDxnLXNnJ2YpuVqJl2e44XgrNQdZR50ADv8Ev fmNllmy9XmnTjRyM26C6XISywtsWYNqks1YKRGmsObKFx6DU7djgXocgRcaXl4TAdrDf /KdGN7me/ILEsv0X9wfMXzITQOCyYgbl8lYuy034BWtCMxvGFqlqv3E8do+HB80dIp9G 6UHZ9dp4bIy7ysszelrjEXm4b1yoMPUM/6EH9W4rkVjIt2Xg0jRLSBQLTFC5bT7uDeqA S9KZcxJuALRaPs3SsSBfUwyHenxEkIc/qQK2xDfXy0s7+4eY4GrK8RkEyPxxPHN9Tq7z tECA== X-Gm-Message-State: APjAAAXZN0RZpsRjdE9biJOjrGX4oqvf52pn9H7Za5L7kRrKxo1BSgbX RNgm8fIJzI0ARFMPZpog1WE7I4catF4oLA== X-Google-Smtp-Source: APXvYqw+wcwd1Q5ELGsyNrHdLhIs738zYiU66KGwfojkb+IX0BJdf35/4VhaGx1L9wzKEkW3Xtki6A== X-Received: by 2002:a63:4c5a:: with SMTP id m26mr30382871pgl.270.1567526750106; Tue, 03 Sep 2019 09:05:50 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:05:49 -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 2/5] mm, slab_common: Remove unused kmalloc_cache_name() Date: Wed, 4 Sep 2019 00:04:27 +0800 Message-Id: <20190903160430.1368-3-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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Since the name of kmalloc can be obtained from kmalloc_info[], remove the kmalloc_cache_name() that is no longer used. Signed-off-by: Pengfei Li --- mm/slab_common.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 7bd88cc09987..002e16673581 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1191,21 +1191,6 @@ void __init setup_kmalloc_cache_index_table(void) } } -static const char * -kmalloc_cache_name(const char *prefix, unsigned int size) -{ - - static const char units[3] = "\0kM"; - int idx = 0; - - while (size >= 1024 && (size % 1024 == 0)) { - size /= 1024; - idx++; - } - - return kasprintf(GFP_NOWAIT, "%s-%u%c", prefix, size, units[idx]); -} - static void __init new_kmalloc_cache(int idx, int type, slab_flags_t flags) { From patchwork Tue Sep 3 16:04:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Li X-Patchwork-Id: 11128331 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C47314F7 for ; Tue, 3 Sep 2019 16:06:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 27BAF22CF8 for ; Tue, 3 Sep 2019 16:06:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V3J24BLz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27BAF22CF8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6A05A6B000D; Tue, 3 Sep 2019 12:06:07 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 677DE6B000E; Tue, 3 Sep 2019 12:06:07 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58E246B0010; Tue, 3 Sep 2019 12:06:07 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0122.hostedemail.com [216.40.44.122]) by kanga.kvack.org (Postfix) with ESMTP id 393A66B000D for ; Tue, 3 Sep 2019 12:06:07 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id CE1F5181AC9B6 for ; Tue, 3 Sep 2019 16:06:06 +0000 (UTC) X-FDA: 75894085932.09.bat90_6f772ddd8c12c X-Spam-Summary: 2,0,0,971b17b7f20128b6,d41d8cd98f00b204,lpf.vector@gmail.com,:akpm@linux-foundation.org:cl@linux.com:penberg@kernel.org:rientjes@google.com:iamjoonsoo.kim@lge.com::linux-kernel@vger.kernel.org:lpf.vector@gmail.com,RULES_HIT:41:69:355:379:541:800:960:968:973:988:989:1260:1311:1314:1345:1359:1437:1515:1535:1542:1711:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3353:3865:3866:3874:4321:4605:5007:6119:6261:6653:7514:7903:8603:9413:9592:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13161:13229:13894:14181:14394:14687:14721:21080:21444:21451:21627:21666:30029:30054,0,RBL:209.85.210.193:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:28,LUA_SUMMARY:none X-HE-Tag: bat90_6f772ddd8c12c X-Filterd-Recvd-Size: 5291 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Sep 2019 16:06:05 +0000 (UTC) Received: by mail-pf1-f193.google.com with SMTP id y22so5429079pfr.3 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=n8TIh0UicZPuaER2fp4OgOgW4rMDy6HnJa8vPw1KUxRre7cxnGhKesIV8ZfXLVZ8pj K+phXcBtvXTbPiODZV0q+c/rWxpUxhNnqrVGmG04SI5q5g59lgun6stU/UaAf9Mzprtl W1mtpl0CRKpDrB+KvTb6e5RFqqh9FvxvIL2/CCqgcctNwuXzLo4WeitBqPF9xpVAaPZ4 5lGDuayvWta2e3tESO5CeEJ5xbxY+zSmcT3JkvKioLZw3CiAErhpjShZvOU5LSbV6P1B OACls6iLq64gu4/MdsEtD9eKwF2z19nB0TiOZoZZCyMvCunOHcfuL1k/JXBs3Me/gXGa s6RA== X-Gm-Message-State: APjAAAWisvqeM5lTfH0y1XC0B2YxEiY1J6i+fnfQVxKqrFgF+EtmH0vx L6enz2+H/ssf76e1d8QQJtA= X-Google-Smtp-Source: APXvYqwgdPLWgf9CQVGxcsYwYCpR2opRVq4DieDZTvtrFChqcqgCZ//VbQIXYX/vaYyIZE3HgbQqNg== 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 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 From patchwork Tue Sep 3 16:04:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Li X-Patchwork-Id: 11128333 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6B2E9112C for ; Tue, 3 Sep 2019 16:06:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2DE7C23711 for ; Tue, 3 Sep 2019 16:06:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P4H3OZmR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DE7C23711 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 58F886B000E; Tue, 3 Sep 2019 12:06:27 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 53EC86B0010; Tue, 3 Sep 2019 12:06:27 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 455D06B0269; Tue, 3 Sep 2019 12:06:27 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id 277896B000E for ; Tue, 3 Sep 2019 12:06:27 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 85538180AD7C3 for ; Tue, 3 Sep 2019 16:06:26 +0000 (UTC) X-FDA: 75894086772.09.drop90_725a91eeabe30 X-Spam-Summary: 2,0,0,11184ea47ad6f5e7,d41d8cd98f00b204,lpf.vector@gmail.com,:akpm@linux-foundation.org:cl@linux.com:penberg@kernel.org:rientjes@google.com:iamjoonsoo.kim@lge.com::linux-kernel@vger.kernel.org:lpf.vector@gmail.com,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1515:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3865:3866:3872:5007:6261:6653:7514:9413:10004:11026:11473:11658:11914:12043:12297:12438:12517:12519:12555:12895:13069:13161:13229:13311:13357:13894:14096:14181:14384:14394:14687:14721:21080:21444:21450:21451:21627:21666:30054,0,RBL:209.85.214.195:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: drop90_725a91eeabe30 X-Filterd-Recvd-Size: 4074 Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Sep 2019 16:06:25 +0000 (UTC) Received: by mail-pl1-f195.google.com with SMTP id m9so8088357pls.8 for ; Tue, 03 Sep 2019 09:06:25 -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=LViEBVo5/xlaUjZ5GSZNj0pM5S7KZYGyGn2HDxokJJk=; b=P4H3OZmR9QVZgWZ2D/glNq5HSvTTrtqxFVkVeg/WZmiL9dTUo7HLjSs+UAauaHV7mt OmdGS37DH/UzzuxUriBbekvJtFfsZe4KNE++J97KcSHSY4zyUhWS44PKjvV53bG9d7Ow PpUs5C4moOLJL93jkoHpnAfyp4JoJ6d3dTTbCvi5lyfx/clI0zfp2Tpi5Ji7WwXp33Cv p7GCekESrk91miSi5xR5uSRp/dx2JHTaBLVp2x+t9peORo7Ett6DiFWSNaqQGa6W9rqY gOjY65Jb7D1y+WBAPwK7xtAOF2yavrCA41nuC3aJW27orC+W9Dn78nO5R9CUG9SDFRpL U6oQ== 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=LViEBVo5/xlaUjZ5GSZNj0pM5S7KZYGyGn2HDxokJJk=; b=rkKE6DSzpAOpdXDTjjC+ZfZxo+TXn+HvgAKCu4jdcKU/t9LpjPP6EnpvSfL2lSa/aj C0Jv3THrpiwUha5Ho6bnXabiI+iSd0g1/Abxo7mpC6P8RUfI1Khm7ImI4qO6Kq/23ksJ r4iEoQcXUn2g5CnFkRm9N2dAJ4vC1S1iNd2YigZRmP8Jb5n42h0cUNMRYVz7Dc18pB+d YyO62WQRII9JGvdmDD0JSpBsoWsnlcLCwI7c/iXw2aE7ajPNq7r3IL7QBaqQ+0aRmDWB XQzdXdg/bACH/V3fIjjDS+g4d34NzAh1So9006kRP1N33aP13K46s/oF34DTLVaj4vXi fBjw== X-Gm-Message-State: APjAAAWtqYWuvjDsE71LL/N6dUw/9qKkfiiSycVHdzzgVwtSx/m1w9eR fUlR2fd0a3QHSacTqhz2KS0= X-Google-Smtp-Source: APXvYqyIZTD5K2Wd0BFFfQVmj87nH+2U+ramZbS8wjnzfUW+IK1TUWiksx4/P3FvlglaZ1/zVdGvvQ== X-Received: by 2002:a17:902:7588:: with SMTP id j8mr18739799pll.280.1567526784988; Tue, 03 Sep 2019 09:06:24 -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.06.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:06:24 -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 4/5] mm, slab_common: Make 'type' is enum kmalloc_cache_type Date: Wed, 4 Sep 2019 00:04:29 +0800 Message-Id: <20190903160430.1368-5-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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The 'type' of the function new_kmalloc_cache should be enum kmalloc_cache_type instead of int, so correct it. Signed-off-by: Pengfei Li Acked-by: Vlastimil Babka --- mm/slab_common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index 8b542cfcc4f2..af45b5278fdc 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1192,7 +1192,7 @@ void __init setup_kmalloc_cache_index_table(void) } static void __init -new_kmalloc_cache(int idx, int type, slab_flags_t flags) +new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) { if (type == KMALLOC_RECLAIM) flags |= SLAB_RECLAIM_ACCOUNT; @@ -1210,7 +1210,8 @@ new_kmalloc_cache(int idx, int type, slab_flags_t flags) */ void __init create_kmalloc_caches(slab_flags_t flags) { - int i, type; + int i; + enum kmalloc_cache_type type; for (type = KMALLOC_NORMAL; type <= KMALLOC_RECLAIM; type++) { for (i = KMALLOC_SHIFT_LOW; i <= KMALLOC_SHIFT_HIGH; i++) { From patchwork Tue Sep 3 16:04:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pengfei Li X-Patchwork-Id: 11128335 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C376C112C for ; Tue, 3 Sep 2019 16:06:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8E0BA23774 for ; Tue, 3 Sep 2019 16:06:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e3t1McXM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E0BA23774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C6DD16B0010; Tue, 3 Sep 2019 12:06:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C44C06B0269; Tue, 3 Sep 2019 12:06:41 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B59F06B026A; Tue, 3 Sep 2019 12:06:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id 92FD56B0010 for ; Tue, 3 Sep 2019 12:06:41 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 376491EFD for ; Tue, 3 Sep 2019 16:06:41 +0000 (UTC) X-FDA: 75894087402.15.crook52_748577d51cf4f X-Spam-Summary: 2,0,0,f243600c2658e3a7,d41d8cd98f00b204,lpf.vector@gmail.com,:akpm@linux-foundation.org:cl@linux.com:penberg@kernel.org:rientjes@google.com:iamjoonsoo.kim@lge.com::linux-kernel@vger.kernel.org:lpf.vector@gmail.com,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1539:1711:1714:1730:1747:1777:1792:2393:2559:2562:2693:3138:3139:3140:3141:3142:3350:3865:3866:4321:5007:6261:6653:7514:9413:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:12986:13069:13311:13357:13894:14181:14384:14394:14687:14721:21080:21444:21451:21627:21666:30054,0,RBL:209.85.210.194:@gmail.com:.lbl8.mailshell.net-62.50.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: crook52_748577d51cf4f X-Filterd-Recvd-Size: 3713 Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Sep 2019 16:06:40 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id y9so11069661pfl.4 for ; Tue, 03 Sep 2019 09:06:40 -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=tqiMeM8TceesmPz2bTRikxBBQDBEs3u6ayncNAD+gSk=; b=e3t1McXM+B7+qPx+6xlw63jz2BIyLqfLkwAuPUpZ/KBlMqhABGIuIsh/P2+qg4fL3G e68oPxPeHi8vjpPuXdOVgYVl7iyc9re3mqNsfOKETT5TLTMCJariudPc5aEYUvdJIMIr 8GsII5RUZLQEHyo9d62A4LFpgd69nti5zrZ7Fp+W993mrs8mrA6NQAypayAo89Qeh692 oYxKPcTw6O0k6WJPPZjWHpbXrBkjaz6giJxa+GF34nICobYKGyS0s0tAEw8F6vxQbAFt t6J97R9xlt3Cwo1btDvuXlruov3D0WO6G2ERLjOiOc9McIhcixZ4rT8uvKQxri0cBUNW EbcQ== 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=tqiMeM8TceesmPz2bTRikxBBQDBEs3u6ayncNAD+gSk=; b=ttudkTzcSNutQhj8Il0QavRUSCrnZD2ysDzeGmU+Ay1oFsLJg5hwnj2h+tK3A5x3z0 qzvOL9O+4apg+Bjh08WuVTnnt7HOm1O4o0lUiLMvmUNwc5r48j9xJgB4MX0/RU5A5SY1 RZZdODnDPCjRQvnkz8N9nZj4PfMSYY2yf0YfNkemc/KgHpkF5P8YiCP3/KO2sj5rlPyC tDVzkuoP9db+u6FDAtdDauOasC7loRB4JNPXXpAYrZ43YAm7jGDqqR5kqgpp+EvVhCVD 3CRsOIUSOqf7JF1vo9saamYJUA0Bz4EhxpzmlawTiNavOdNINVq2oIOelRybFm0vDZWg 1lqA== X-Gm-Message-State: APjAAAVQBXJfRRt94VYmsCTCCJLWJwj1tjdHcYYZMfqfENfE8b/dHfpi iLOVRlEpUhif1luE6UFKjOE= X-Google-Smtp-Source: APXvYqylZr4jbswujqwYAo39xphsMw3eAgJhDESJUjXAsNJEvXeRyMT0McdB5r6QPlWEFyI3l5Gd5g== X-Received: by 2002:a63:2903:: with SMTP id p3mr16265577pgp.306.1567526799745; Tue, 03 Sep 2019 09:06:39 -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.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 09:06:39 -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 5/5] mm, slab_common: Make initializing KMALLOC_DMA start from 1 Date: Wed, 4 Sep 2019 00:04:30 +0800 Message-Id: <20190903160430.1368-6-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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: kmalloc_caches[KMALLOC_NORMAL][0] will never be initialized, so the loop should start at 1 instead of 0 Signed-off-by: Pengfei Li --- mm/slab_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index af45b5278fdc..c81fc7dc2946 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1236,7 +1236,7 @@ void __init create_kmalloc_caches(slab_flags_t flags) slab_state = UP; #ifdef CONFIG_ZONE_DMA - for (i = 0; i <= KMALLOC_SHIFT_HIGH; i++) { + for (i = 1; i <= KMALLOC_SHIFT_HIGH; i++) { struct kmem_cache *s = kmalloc_caches[KMALLOC_NORMAL][i]; if (s) {