From patchwork Mon Oct 7 14:30:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13824794 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 62342CFB43F for ; Mon, 7 Oct 2024 14:31:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D88266B0085; Mon, 7 Oct 2024 10:30:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D38AC6B0095; Mon, 7 Oct 2024 10:30:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BFFFA6B0096; Mon, 7 Oct 2024 10:30:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A1E026B0085 for ; Mon, 7 Oct 2024 10:30:59 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 20F6214050C for ; Mon, 7 Oct 2024 14:30:59 +0000 (UTC) X-FDA: 82647043038.12.4BA9B36 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf12.hostedemail.com (Postfix) with ESMTP id 02BB740007 for ; Mon, 7 Oct 2024 14:30:55 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=q2Qh1Zb+; dkim=pass header.d=linutronix.de header.s=2020e header.b=2bxYD3yZ; spf=pass (imf12.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728311389; 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-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=jY6v3NFOB0Tg58gWX7tYEtj5Az55PSW4eq3YdwdtdQU=; b=IIMC8hq/djFcXfV+cU58qDD2S2QjyHEncRejILHOXiDHcSg9WRNzAHSfL70z2VSVhPE4sn fso0FafSttqjtMD3c6uhYgiCp63o8LGF3zUE5d99eV6SzM0NJfBQ721el8DhxM5zIHJOok f9T6bGgHHfxYO37l+R6dcNZ26H6RPKk= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=q2Qh1Zb+; dkim=pass header.d=linutronix.de header.s=2020e header.b=2bxYD3yZ; spf=pass (imf12.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728311389; a=rsa-sha256; cv=none; b=wZkalahkbjBX6OC4TIjUEVv0ogek+WtMXp+FtQtm7DSENsZ0anvSyq7rbSyfk2fxBzR8Vk 1b8qqpgQUTxL3EXJq4phj9v9GKUePayxyD2Q5TZuqzUKDQrYkIOBKlgyhOc/RET0VG+ZZ6 3RoLYKr8WcM2d4uRkLPxzNswSNk+fBs= Date: Mon, 7 Oct 2024 16:30:49 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1728311451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=jY6v3NFOB0Tg58gWX7tYEtj5Az55PSW4eq3YdwdtdQU=; b=q2Qh1Zb+aHdPm3AwU6cPqWV+tDU31Ywnb8vj1Dxt47hi2XLyXRL3/lBoUpaamw6cQ7piWW Awwf6GPh8nYZPN9uvVATj2NA9slxSbrr9IVbCaoa49SRup8+ouuft09uRnbbMd/ZwV0obE nLZh/AXwPHxlOxIzx0EkTzGAGd0BwgDWldoYlgfKESOoWzRlEXebhyQs8pc49Xb8rZzOk9 5LlgYFwYkY4KLKh2VKL24WaTAikQuI7XO2mYaJfoVK4ebqqWsXoZsxMnvLkGRRnZKUm46N +KR/8UftJ12m1ANw6DWv6yfhklfV3jqEqraP8uYG1iRzp/Jp0DOjiPzdAim2/w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1728311451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=jY6v3NFOB0Tg58gWX7tYEtj5Az55PSW4eq3YdwdtdQU=; b=2bxYD3yZXmlnprH4EVzHPAp96pTiRwM0GASB4RJUzheqFlUgfh4G6xhWsHMd6Epk0UVE7r iQVYzKDkJEkqUiCQ== From: Sebastian Andrzej Siewior To: linux-mm@kvack.org, Andrew Morton , Vlastimil Babka Cc: Arnd Bergmann , Christoph Lameter , David Rientjes , Dennis Zhou , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Joonsoo Kim , Pekka Enberg , Roman Gushchin , Tejun Heo , Thomas Gleixner Subject: [PATCH] mm: percpu: Increase PERCPU_DYNAMIC_SIZE_SHIFT on certain builds. Message-ID: <20241007143049.gyMpEu89@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 02BB740007 X-Stat-Signature: sjjoba17bysnkd9u78zo53fx75x8mz5j X-HE-Tag: 1728311455-437490 X-HE-Meta: U2FsdGVkX19keNTz7+VK/tX31hKBkRsZmfCK7i/3aHydc1x6xmxifxmNY7LsLdupP09hxBfsdfH1KJFkUPJ1IaG9BbJqaLBCtRXrRTprCwJx5X5ZxmJvsiW4NKfTWDpe+yPOu5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mhMoyHjZQfrdNCfY8fZ7T3lCIszVnw8gNlmIcuN8ViHB+F+nMZVwtDF5/53LQmmgA6Nz4x1hmd+iJcwcRX6 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: Arnd reported a build failure due to the BUILD_BUG_ON() statement in alloc_kmem_cache_cpus(). The test PERCPU_DYNAMIC_EARLY_SIZE < NR_KMALLOC_TYPES * KMALLOC_SHIFT_HIGH * sizeof(struct kmem_cache_cpu) The factors that increase the right side of the equation: - PAGE_SIZE > 4KiB increases KMALLOC_SHIFT_HIGH - For the local_lock_t in kmem_cache_cpu: - PREEMPT_RT adds an actual lock. - LOCKDEP increases the size of the lock. - LOCK_STAT adds additional bytes plus padding to the lockdep structure. The net difference with and without PREEMPT_RT is 88 bytes for the lock_lock_t, 96 bytes for kmem_cache_cpu due to additional padding. This is enough to exceed the 80KiB limit with 16KiB page size - the 8KiB page size is fine. Increase PERCPU_DYNAMIC_SIZE_SHIFT to 13 on configs with PAGE_SIZE larger than 4KiB and LOCKDEP enabled. 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/ Reported-by: Arnd Bergmann Closes: https://lore.kernel.org/20241004095702.637528-1-arnd@kernel.org Acked-by: Arnd Bergmann Signed-off-by: Sebastian Andrzej Siewior Acked-by: Vlastimil Babka Acked-by: David Rientjes --- include/linux/percpu.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/percpu.h b/include/linux/percpu.h index b6321fc491598..52b5ea663b9f0 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h @@ -41,7 +41,11 @@ PCPU_MIN_ALLOC_SHIFT) #ifdef CONFIG_RANDOM_KMALLOC_CACHES -#define PERCPU_DYNAMIC_SIZE_SHIFT 12 +# if defined(CONFIG_LOCKDEP) && !defined(CONFIG_PAGE_SIZE_4KB) +# define PERCPU_DYNAMIC_SIZE_SHIFT 13 +# else +# define PERCPU_DYNAMIC_SIZE_SHIFT 12 +#endif /* LOCKDEP and PAGE_SIZE > 4KiB */ #else #define PERCPU_DYNAMIC_SIZE_SHIFT 10 #endif