From nobody Tue Jun 23 07:08:22 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D11AC433EF for ; Wed, 9 Mar 2022 09:21:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232004AbiCIJW1 (ORCPT ); Wed, 9 Mar 2022 04:22:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231996AbiCIJW0 (ORCPT ); Wed, 9 Mar 2022 04:22:26 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADA381662E8 for ; Wed, 9 Mar 2022 01:21:27 -0800 (PST) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4KD65J6dCKz1GCJ4; Wed, 9 Mar 2022 17:16:36 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 9 Mar 2022 17:21:25 +0800 From: Miaohe Lin To: , , , , , CC: , , , Subject: [PATCH] mm/slub: remove forced_order parameter in calculate_sizes Date: Wed, 9 Mar 2022 17:20:36 +0800 Message-ID: <20220309092036.50844-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Since commit 32a6f409b693 ("mm, slub: remove runtime allocation order changes"), forced_order is always -1. Remove this unneeded parameter to simplify the code. Signed-off-by: Miaohe Lin Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/slub.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mm/slub.c b/mm/slub.c index 180354d7e741..7f09901ae6b2 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4038,7 +4038,7 @@ static void set_cpu_partial(struct kmem_cache *s) * calculate_sizes() determines the order and the distribution of data wit= hin * a slab object. */ -static int calculate_sizes(struct kmem_cache *s, int forced_order) +static int calculate_sizes(struct kmem_cache *s) { slab_flags_t flags =3D s->flags; unsigned int size =3D s->object_size; @@ -4142,10 +4142,7 @@ static int calculate_sizes(struct kmem_cache *s, int= forced_order) size =3D ALIGN(size, s->align); s->size =3D size; s->reciprocal_size =3D reciprocal_value(size); - if (forced_order >=3D 0) - order =3D forced_order; - else - order =3D calculate_order(size); + order =3D calculate_order(size); =20 if ((int)order < 0) return 0; @@ -4181,7 +4178,7 @@ static int kmem_cache_open(struct kmem_cache *s, slab= _flags_t flags) s->random =3D get_random_long(); #endif =20 - if (!calculate_sizes(s, -1)) + if (!calculate_sizes(s)) goto error; if (disable_higher_order_debug) { /* @@ -4191,7 +4188,7 @@ static int kmem_cache_open(struct kmem_cache *s, slab= _flags_t flags) if (get_order(s->size) > get_order(s->object_size)) { s->flags &=3D ~DEBUG_METADATA_FLAGS; s->offset =3D 0; - if (!calculate_sizes(s, -1)) + if (!calculate_sizes(s)) goto error; } } --=20 2.23.0