From patchwork Fri Oct 4 09:56:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13822033 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1F0FCFA753 for ; Fri, 4 Oct 2024 09:57:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89FF56B040B; Fri, 4 Oct 2024 05:57:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84F636B040C; Fri, 4 Oct 2024 05:57:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73F116B040D; Fri, 4 Oct 2024 05:57:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5650D6B040B for ; Fri, 4 Oct 2024 05:57:12 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A6EC81A1371 for ; Fri, 4 Oct 2024 09:57:11 +0000 (UTC) X-FDA: 82635466662.13.1184FF0 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf16.hostedemail.com (Postfix) with ESMTP id 2C763180009 for ; Fri, 4 Oct 2024 09:57:10 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HAqVMtgs; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of arnd@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=arnd@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728035789; a=rsa-sha256; cv=none; b=TR/1OO+7p00AzIeWuZu5JFyBbgMG6ZnmWOtuq+4ONOuV8vvHVey3CKk8D8fNw52HMuN93L PFO9dpYzZr7DrttzQKjrTfLi5QEioc6WCj8W70xmk3o6hN6ugSJUXgXvfwprMGn69+njyC F5zKlBryu3J4wcnS4PdTtmqN0XADzqU= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=HAqVMtgs; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of arnd@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=arnd@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728035789; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=yVtXJtBndX/aAdm/X3MXIxnzFy9P/184iWeV64BIFFg=; b=FQ36VnRXz6QEYr2n/FflCFeMmfDAxBG3ugJQpdC0vUfusg0X4MO+/Hxlq5wY5Hk6y+5WAt jPeSGcOoDFjro21Y3UABOwDouL/ULi2x1zKcg9SMimEjZ2vkAHe1pxPnniNzv5/1sQGuso GGwzrM6rbuu6IcH1pVZz5U6TV3RLcsI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id E59E6A447D7; Fri, 4 Oct 2024 09:57:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 739CAC4CEC6; Fri, 4 Oct 2024 09:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728035829; bh=QmFYoC1IHM+OAIDny2KkOyA6l3NAUFs34jQGh53m32c=; h=From:To:Cc:Subject:Date:From; b=HAqVMtgsJZBGRupdDGNIvb4ax1Y65X5H1hZWJN8hd+0n5FGfbttmR+l9CtlqL67+V HSF2L6AHj+Ta5h7NdrbAUFRUw7jPuBhsqL4cKdogNxJaJP4uXa1tbgWfXeeIvAKq4Z ZUF995SGitiFacEpv7XrOdu8S5y72gIlK+r0HTUhaEBlaHj8bPxUf58sdN7oTp5B7r R4FfjUT56ka6DsibNk7oZTePB+dJoAp2ccQwBjn0yJBVr5zG++IEs+exiZpjHCcjMP zSvHRGL44IRDhdwttEiuETCGZe9gvk1Jb2RMo13AQ9SJZft8PXkzQWKtSRRxfjQCpO fj8/MV+6Kgr7g== From: Arnd Bergmann To: Dennis Zhou , Tejun Heo , Christoph Lameter , Sebastian Andrzej Siewior , Thomas Gleixner , Will Deacon Cc: Arnd Bergmann , kernel test robot , Andrew Morton , Suren Baghdasaryan , Kent Overstreet , Hou Tao , Jan Kara , Jianhui Zhou <912460177@qq.com>, Yury Norov , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] preempt_rt: increase PERCPU_DYNAMIC_SIZE_SHIFT for slab randomization Date: Fri, 4 Oct 2024 09:56:56 +0000 Message-Id: <20241004095702.637528-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 2C763180009 X-Rspamd-Server: rspam01 X-Stat-Signature: 1m77g5oq6egyeqgndz3rq8b1jzmrbzu3 X-HE-Tag: 1728035830-65028 X-HE-Meta: U2FsdGVkX1++zenJVWYCxFI1OSkOsutSRpZEYRKeLTXJeTSc08JXCxbUuDFlmUpiJG0vTky+OfOGDjf9hei2J2iwmt3fBxG2Tiylros4mdV9PoCjY1t7ABWTMLaztBfhTX2LdfNXM8hczLJ6yQlmdcScTDp4+jnPDupcorOon66l8RyooQ4Fnuy09mnutMT14lAw7DLdhojrlix2KniW1AbwnNkVYSx8JzUrDVv4KjcgHqZrmacGP63xHfiN/DGL9URl8FnkJ8v710BEPWAl46klAZyYjhyeThtJ4CNaU+QAvHs4K58oBAJIg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2jhP4KZRE3xQ== 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: List-Subscribe: List-Unsubscribe: From: Arnd Bergmann When both PREEMPT_RT and RANDOM_KMALLOC_CACHES are enabled, the slub allocator runs into a build time failure: In file included from : In function 'alloc_kmem_cache_cpus', inlined from 'do_kmem_cache_create' at mm/slub.c:6041:7: include/linux/compiler_types.h:517:45: error: call to '__compiletime_assert_598' declared with attribute error: BUILD_BUG_ON failed: PERCPU_DYNAMIC_EARLY_SIZE < NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu) 517 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ include/linux/compiler_types.h:498:25: note: in definition of macro '__compiletime_assert' 498 | prefix ## suffix(); \ | ^~~~~~ include/linux/compiler_types.h:517:9: note: in expansion of macro '_compiletime_assert' 517 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition) | ^~~~~~~~~~~~~~~~ mm/slub.c:5133:9: note: in expansion of macro 'BUILD_BUG_ON' 5133 | BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE < | ^~~~~~~~~~~~ The problem is the additional size overhead from local_lock in struct kmem_cache_cpu. Avoid this by preallocating a larger area. Fixes: d8fccd9ca5f9 ("arm64: Allow to enable PREEMPT_RT.") Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202410020326.iaZIteIx-lkp@intel.com/ Signed-off-by: Arnd Bergmann Acked-by: Arnd Bergmann Reported-by: Arnd Bergmann --- There is a good chance that there is a better way to address this, this version was the first I came up with and I verified that it fixes all of the broken configs. See https://pastebin.com/raw/tuPgfPzu for a .config from a failing randconfig build on 6.12-rc1. --- include/linux/percpu.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/percpu.h b/include/linux/percpu.h index b6321fc49159..4083295da27f 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -41,7 +41,11 @@ PCPU_MIN_ALLOC_SHIFT) #ifdef CONFIG_RANDOM_KMALLOC_CACHES +#ifdef CONFIG_PREEMPT_RT +#define PERCPU_DYNAMIC_SIZE_SHIFT 13 +#else #define PERCPU_DYNAMIC_SIZE_SHIFT 12 +#endif #else #define PERCPU_DYNAMIC_SIZE_SHIFT 10 #endif