From patchwork Thu Sep 23 17:01:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 12513319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1446C433F5 for ; Thu, 23 Sep 2021 17:01:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 57D4F60F43 for ; Thu, 23 Sep 2021 17:01:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 57D4F60F43 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C8B316B006C; Thu, 23 Sep 2021 13:01:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C39A56B0071; Thu, 23 Sep 2021 13:01:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B512C900002; Thu, 23 Sep 2021 13:01:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id A386D6B006C for ; Thu, 23 Sep 2021 13:01:28 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 66E7630B4F for ; Thu, 23 Sep 2021 17:01:28 +0000 (UTC) X-FDA: 78619454256.36.6E4498D Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf14.hostedemail.com (Postfix) with ESMTP id 0E547600199A for ; Thu, 23 Sep 2021 17:01:27 +0000 (UTC) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1632416486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=iOgL3Y9/ALr8LEOOM+dNy/TjTogSvE0DbkBMMEO0YNM=; b=FQ6JPHaQyZtSL77gNvZy5htVlfeDxvCqN23WMMOGwSFnNgJFcFX0bOaB/gCUJ4Z3lMunHa z3Sf6DWwC7imOYXYRSIr3eISbW6MpHHV1SbG5wR7PglQtLp7sDdn0oputi4/viM5KqMojV MJZlMBBuY6MrL6ws+u97Ph4tqyJmpVglkKjxgxby3PYI/M8KosOH1fZQdm8WERI86KzexS orvcAzVdXooPT0LDpKuQQuZFSyMbsqztjxBD07zqcCecDjT4gYxPUiUIVWbt2nRMkef1s0 x9uwSOCVDQtcOSS0Kbz+KTzY5SiN/CUmWo1+TsKXNnnl0FWiiZBgGoPQ7ILUPw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1632416486; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=iOgL3Y9/ALr8LEOOM+dNy/TjTogSvE0DbkBMMEO0YNM=; b=a/oBlQzneTw5EsyoFzZo1KDgE7ns7kUTDtSk9JAkgNUZVopcrh9xyxA4GKMYIcdhQ+4k1J TXm5sY1MAy+zEKBg== To: linux-mm@kvack.org Cc: Andrew Morton , Thomas Gleixner , Sebastian Andrzej Siewior Subject: [PATCH] mm: Disable zsmalloc on PREEMPT_RT Date: Thu, 23 Sep 2021 19:01:21 +0200 Message-Id: <20210923170121.1860133-1-bigeasy@linutronix.de> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0E547600199A X-Stat-Signature: 8zjq1946ezea9cznf9q6hgyr7oj9f5wd Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=FQ6JPHaQ; dkim=pass header.d=linutronix.de header.s=2020e header.b="a/oBlQzn"; spf=pass (imf14.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 X-HE-Tag: 1632416487-804664 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: For efficiency reasons, zsmalloc is using a slim `handle'. The value is the address of a memory allocation of 4 or 8 bytes depending on the size of the long data type. The lowest bit in that allocated memory is used as a bit spin lock. The usage of the bit spin lock is problematic because with the bit spin lock held zsmalloc acquires a rwlock_t and spinlock_t which are both sleeping locks on PREEMPT_RT and therefore must not be acquired with disabled preemption. There is a patch which extends the handle on PREEMPT_RT so that a full spinlock_t fits (even with lockdep enabled) and then eliminates the bit spin lock. I'm not sure how sensible zsmalloc on PREEMPT_RT is given that it is used to store compressed user memory. Disable ZSMALLOC on PREEMPT_RT. If there is need for it, we can try to get it to work. Signed-off-by: Sebastian Andrzej Siewior --- mm/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/Kconfig b/mm/Kconfig index 9f1e0098522c2..541371e64c477 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -640,6 +640,7 @@ config ZSWAP_ZPOOL_DEFAULT_Z3FOLD config ZSWAP_ZPOOL_DEFAULT_ZSMALLOC bool "zsmalloc" + depends on !PREEMPT_RT select ZSMALLOC help Use the zsmalloc allocator as the default allocator. @@ -690,7 +691,7 @@ config Z3FOLD config ZSMALLOC tristate "Memory allocator for compressed pages" - depends on MMU + depends on MMU && !PREEMPT_RT help zsmalloc is a slab-based memory allocator designed to store compressed RAM pages. zsmalloc uses virtual memory mapping