Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2090958rdb; Mon, 20 Nov 2023 01:22:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEYlpIb5O3SWXa2rpXnAAv/BCio133HNiUiSFOlI+ygnG2pmUpz5K9PHI/BOXHEBBmICNjA X-Received: by 2002:a05:6358:7f10:b0:16b:f6ba:a03a with SMTP id p16-20020a0563587f1000b0016bf6baa03amr7599700rwn.8.1700472148189; Mon, 20 Nov 2023 01:22:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700472148; cv=none; d=google.com; s=arc-20160816; b=I1zAR8fBIeq5OHOcZARIgp66H9X+XjxUmtmCinwOBhmD8eAiRV1TuZNKH02/7rG+q+ QWUL2sYFALucoZxrXp/Wv0cR2G4ddXD+4jTp1Kg5OfHnbs+tip0ntMsWeRxnM1TBi6VG xpN3b8I/gSf+LIsfp6zoze4ZPza3jMpw4iF5FUhvb0Qft738jEQ9Yp1ZJg8bwyhx+vQx ALvigb6fpJiZos81yaOtedQW6WKrB4gQQsyGS7+CpjpZoeFlKh3li3U9BKNo3eVeAb4B KZUUuBfv4Q1zqhupdPEUBZtOjYJhY0Is82v+st75phzmuakTJvo9Bs5oMOcLckrBPNTJ Kwqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0IyZUppRFC+kRXK+uWTlA6BA5d71MB5eJgI2v8JSo8g=; fh=A34WZXuXlgOsVJOH+CcTeMzf2Xi9lF0pvGJBT/24VpA=; b=KLelZuXxiripEi8X5ESuy2s3EwPzqz9wDoUlNC9wSsSJsA1UEyfvNbHr68sTeot3zd o1vw3Hy9ztI42bSw09kpikqMMjtXeoCew9gxvBdhOZEVrTUk6cZSVvHTahkP/Cui6nAx noxn0qK2srzkpi3p3Dbe7oPNBd1rbdrfuGsE5yaZXyPdpXji0FIinmBG3kdUNzTLpzrP JPWbf377d24NXIYqrihBB0Tvy24w7geNxlGEjdkjPDpV1xs7qPhshASIy0pR4lNtIduv fWUUXwH/oFYIoPUq+sjIKnCS0g14iqYdZobX4AeWjt+XVJp46Yd9WI20fNw3pqMxvkKN WXQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@me.com header.s=1a1hai header.b=ngGfutKl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z15-20020a634c0f000000b005bd9fc46b76si7702627pga.302.2023.11.20.01.22.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 01:22:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@me.com header.s=1a1hai header.b=ngGfutKl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=me.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id E834F8068962; Mon, 20 Nov 2023 01:20:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232578AbjKTJUi (ORCPT + 99 others); Mon, 20 Nov 2023 04:20:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232200AbjKTJUb (ORCPT ); Mon, 20 Nov 2023 04:20:31 -0500 Received: from pv50p00im-ztdg10011201.me.com (pv50p00im-ztdg10011201.me.com [17.58.6.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B52D2E5 for ; Mon, 20 Nov 2023 01:20:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1700471576; bh=0IyZUppRFC+kRXK+uWTlA6BA5d71MB5eJgI2v8JSo8g=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=ngGfutKlG4UMoqOY1w9qK0d3x1YrvjuZvo/ni40ibMWGkH/Lb4CELoCYuGc2BFF7a zcXHrXDcB/1MwknG30WASwWYOirtpC/kvUmvBMmXJjmaRD2CYpO8k7GXLdtlBloFhS rXWorM09Ix6kedh3weEOi6UKdHBwWp/9E0p9lA2l4oznrFu+QotAEzay8AeMxo5eoT 5Ha1YQpY1qw/USNShuXvCGcO/u3xXpR2+dXhrYNjI6+x961mu2M67GPyDLssxiE45h eUCRKTWgBk0CwfUKPnD/YQ7A/x0CsqQ+vp1APxR/yLihctQ+K+TiXDuttpo2RShfvv EmGXoZs3dXQYQ== Received: from xiongwei.. (pv50p00im-dlb-asmtp-mailmevip.me.com [17.56.9.10]) by pv50p00im-ztdg10011201.me.com (Postfix) with ESMTPSA id 90878680224; Mon, 20 Nov 2023 09:12:51 +0000 (UTC) From: sxwjean@me.com To: cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, vbabka@suse.cz, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com Cc: corbet@lwn.net, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] mm/slab: make calculate_alignment() public Date: Mon, 20 Nov 2023 17:12:13 +0800 Message-Id: <20231120091214.150502-4-sxwjean@me.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231120091214.150502-1-sxwjean@me.com> References: <20231120091214.150502-1-sxwjean@me.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-GUID: oX7Qs8WfInCPZ2wL3ryBnCYP_MfDMAaM X-Proofpoint-ORIG-GUID: oX7Qs8WfInCPZ2wL3ryBnCYP_MfDMAaM X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.517,18.0.883,17.0.605.474.0000000_definitions?= =?UTF-8?Q?=3D2022-06-21=5F08:2022-06-21=5F01,2022-06-21=5F08,2020-01-23?= =?UTF-8?Q?=5F02_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=833 suspectscore=0 bulkscore=0 clxscore=1015 adultscore=0 phishscore=0 mlxscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2311200061 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 01:20:54 -0800 (PST) From: Xiongwei Song We are going to move slab merge from slab_common.c to slub.c, there is a call with it in find_mergeable(), so make it public. Signed-off-by: Xiongwei Song --- mm/slab.h | 2 ++ mm/slab_common.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/slab.h b/mm/slab.h index eb04c8a5dbd1..8d20f8c6269d 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -427,6 +427,8 @@ extern void create_boot_cache(struct kmem_cache *, const char *name, unsigned int size, slab_flags_t flags, unsigned int useroffset, unsigned int usersize); +unsigned int calculate_alignment(slab_flags_t flags, + unsigned int align, unsigned int size); int slab_unmergeable(struct kmem_cache *s); struct kmem_cache *find_mergeable(unsigned size, unsigned align, slab_flags_t flags, const char *name, void (*ctor)(void *)); diff --git a/mm/slab_common.c b/mm/slab_common.c index d707abd31926..62eb77fdedf2 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -106,7 +106,7 @@ static inline int kmem_cache_sanity_check(const char *name, unsigned int size) * Figure out what the alignment of the objects will be given a set of * flags, a user specified alignment and the size of the objects. */ -static unsigned int calculate_alignment(slab_flags_t flags, +unsigned int calculate_alignment(slab_flags_t flags, unsigned int align, unsigned int size) { /* -- 2.34.1