From patchwork Sat May 8 22:13:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 12246279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8D67C433ED for ; Sat, 8 May 2021 22:13:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 56C116140E for ; Sat, 8 May 2021 22:13:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56C116140E 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 6882C6B0071; Sat, 8 May 2021 18:13:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 636DF6B0073; Sat, 8 May 2021 18:13:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D7AA6B0074; Sat, 8 May 2021 18:13:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 2D4956B0071 for ; Sat, 8 May 2021 18:13:38 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D0F408249980 for ; Sat, 8 May 2021 22:13:37 +0000 (UTC) X-FDA: 78119466474.09.896E2DE Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by imf06.hostedemail.com (Postfix) with ESMTP id 72DCDC0007C8 for ; Sat, 8 May 2021 22:13:38 +0000 (UTC) Received: by mail-pg1-f178.google.com with SMTP id i14so10628249pgk.5 for ; Sat, 08 May 2021 15:13: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:mime-version :content-transfer-encoding; bh=qGCed4gUBN513MLlFTQfnZ++HePkXg12kWCkIjUGDr8=; b=ushxYnpoe8orY5ZKdkAudx/MBL/PPVsYM/L9Bfug3g+tTyy3bJKdiVr+BgXJBl1KiM Oa18GbopI31rmulhYJpF0mStOSwJbn2BcWCxQ6a2bNtBXRFDAX7TeH+gnOTsBXJInGLw 4DQaFNRtj0aOforUt0qKboIEndTM96mW/iPYwkGPgQ8cdeg0pcPxth3Sley0Gs+C24+j 9RdrkBH2x6vJ3GcJbnsLRyrWOsQ//fliezAPivWQQ1D8oiW8KxoENvte7kY2U8hQBYAw YFVaUBPwYlxo3uGBoIO8YqsifD6qeeuDAF0EL29fjjNp6Uz0Q0Hki5NVLa3nJg+7KIyv 8GzA== 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:mime-version :content-transfer-encoding; bh=qGCed4gUBN513MLlFTQfnZ++HePkXg12kWCkIjUGDr8=; b=VWA+lEIK78oL/YVoKhqS26uEsPAV7jmkkrXMuDbiw2cn/Vq0VFd3ebc+7NHuqhqXkC giGyNg99JjaS+YnLGwb50ffHFDWoaDpbHGAoTBY7XYEomZfHYltRHyM1MGZfvQowbbH/ nJdwF/FEB+ZKkbCHWVtdswdAE9f0obboVvaHf0LAIDtTsnjywTvhI0xYUXo6N7GBt1bj pJsS+rIRoM5RR+juWIyLahEchr+Q+nprakXHDpMjs0FY/j3x1eTziRoF95Wgz5hevo7c SmA559pQVTpgAZkuzVHiEHS0W4AfuGQwxtHFUfqVOoyKDAfCHXN/Yj2GY0ie9LE8SFMZ zvIQ== X-Gm-Message-State: AOAM5333OGMEj77kpXjBebXxYDou6zsOb7FCAjTAyU+oBAxyD5dWv62y od6InM8McGULp6ogHdREntA= X-Google-Smtp-Source: ABdhPJzFVPJC9sdqVYbiNZjxJE38MxaAI0xXpBZiGJvG5gNM1NU2qQjIho2g8xGXHSVSKx2R3JJM4w== X-Received: by 2002:a63:f242:: with SMTP id d2mr17272437pgk.167.1620512016514; Sat, 08 May 2021 15:13:36 -0700 (PDT) Received: from hyeyoo.42seoul.kr ([121.135.181.35]) by smtp.gmail.com with ESMTPSA id r18sm15295303pjo.30.2021.05.08.15.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 May 2021 15:13:36 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [PATCH] mm: kmalloc_index: remove case when size is more than 32MB Date: Sun, 9 May 2021 07:13:28 +0900 Message-Id: <20210508221328.7338-1-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Rspamd-Server: rspam01 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=ushxYnpo; spf=pass (imf06.hostedemail.com: domain of 42hyeyoo@gmail.com designates 209.85.215.178 as permitted sender) smtp.mailfrom=42hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: 7tb3en5fjnmq7n9m87m7isay3xdj3qu7 X-Rspamd-Queue-Id: 72DCDC0007C8 Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf06; identity=mailfrom; envelope-from="<42.hyeyoo@gmail.com>"; helo=mail-pg1-f178.google.com; client-ip=209.85.215.178 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620512018-247168 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 return value of kmalloc_index is used as index of kmalloc_caches, which is defined as: struct kmem_cache * kmalloc_caches[NR_KMALLOC_TYPES][KMALLOC_SHIFT_HIGH + 1] and KMALLOC_SHIFT_HIGH is defined as: #define KMALLOC_SHIFT_HIGH ((MAX_ORDER + PAGE_SHIFT - 1) <= 25 ? \ (MAX_ORDER + PAGE_SHIFT - 1) : 25) KMALLOC_SHIFT_HIGH is maximum 25 by its definition. thus index of kmalloc_caches cannot be 26. so this case should be removed. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- include/linux/slab.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 0c97d788762c..4694b1db4cb2 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -382,7 +382,6 @@ static __always_inline unsigned int kmalloc_index(size_t size) if (size <= 8 * 1024 * 1024) return 23; if (size <= 16 * 1024 * 1024) return 24; if (size <= 32 * 1024 * 1024) return 25; - if (size <= 64 * 1024 * 1024) return 26; BUG(); /* Will never be reached. Needed because the compiler may complain */