From patchwork Thu Nov 11 04:32:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12614135 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02EF2C433F5 for ; Thu, 11 Nov 2021 04:32:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9F34C61179 for ; Thu, 11 Nov 2021 04:32:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9F34C61179 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3ECF56B00B4; Wed, 10 Nov 2021 23:32:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 39DE66B00CB; Wed, 10 Nov 2021 23:32:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 23E336B00CC; Wed, 10 Nov 2021 23:32:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id 0B8416B00B4 for ; Wed, 10 Nov 2021 23:32:36 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BF2B318523422 for ; Thu, 11 Nov 2021 04:32:35 +0000 (UTC) X-FDA: 78795378270.31.57BDBF2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf15.hostedemail.com (Postfix) with ESMTP id 06F94D0000A9 for ; Thu, 11 Nov 2021 04:32:21 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 61317610A5; Thu, 11 Nov 2021 04:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1636605154; bh=cOh6I4SwX9XQzbaMEbNLzKn6WGDfDjkAHtcRvOR2yFM=; h=Date:From:To:Subject:In-Reply-To:From; b=O0EIbzU17ANXmxu0eI0A9gCKCyVjT8xGU52xhWaiznBe8/rcZ7BZl38y8Wj4Sw2/C Hu8rI4Xn6AvoBXqx/8xEfNgqKmoLTkaRCcg4+B6AW43kex7x723GpVWytIwAiY4kvI QPkD8elA/BWY728eG3Fg1N7TQ/DvSLec3dQdoJCo= Date: Wed, 10 Nov 2021 20:32:33 -0800 From: Andrew Morton To: akpm@linux-foundation.org, bigeasy@linutronix.de, cl@linux.com, iamjoonsoo.kim@lge.com, linux-mm@kvack.org, mingo@kernel.org, mm-commits@vger.kernel.org, penberg@kernel.org, rientjes@google.com, tglx@linutronix.de, torvalds@linux-foundation.org, vbabka@suse.cz Subject: [patch 2/7] mm: allow only SLUB on PREEMPT_RT Message-ID: <20211111043233.isiAxdgu6%akpm@linux-foundation.org> In-Reply-To: <20211110203204.37de96048c3279ab2da758a5@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 06F94D0000A9 X-Stat-Signature: xud1jfhyqwehxgws9ni9msh99r5qng1e Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=O0EIbzU1; dmarc=none; spf=pass (imf15.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1636605141-722989 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: From: Ingo Molnar Subject: mm: allow only SLUB on PREEMPT_RT Memory allocators may disable interrupts or preemption as part of the allocation and freeing process. For PREEMPT_RT it is important that these sections remain deterministic and short and therefore don't depend on the size of the memory to allocate/ free or the inner state of the algorithm. Until v3.12-RT the SLAB allocator was an option but involved several changes to meet all the requirements. The SLUB design fits better with PREEMPT_RT model and so the SLAB patches were dropped in the 3.12-RT patchset. Comparing the two allocator, SLUB outperformed SLAB in both throughput (time needed to allocate and free memory) and the maximal latency of the system measured with cyclictest during hackbench. SLOB was never evaluated since it was unlikely that it preforms better than SLAB. During a quick test, the kernel crashed with SLOB enabled during boot. Disable SLAB and SLOB on PREEMPT_RT. [bigeasy@linutronix.de: commit description] Link: https://lkml.kernel.org/r/20211015210336.gen3tib33ig5q2md@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner Signed-off-by: Sebastian Andrzej Siewior Acked-by: Vlastimil Babka Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Signed-off-by: Andrew Morton --- init/Kconfig | 2 ++ 1 file changed, 2 insertions(+) --- a/init/Kconfig~mm-allow-only-slub-on-preempt_rt +++ a/init/Kconfig @@ -1896,6 +1896,7 @@ choice config SLAB bool "SLAB" + depends on !PREEMPT_RT select HAVE_HARDENED_USERCOPY_ALLOCATOR help The regular slab allocator that is established and known to work @@ -1916,6 +1917,7 @@ config SLUB config SLOB depends on EXPERT bool "SLOB (Simple Allocator)" + depends on !PREEMPT_RT help SLOB replaces the stock allocator with a drastically simpler allocator. SLOB is generally more space efficient but