From mboxrd@z Thu Jan 1 00:00:00 1970 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 47805C433F5 for ; Wed, 29 Sep 2021 07:24:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DF8D1613C8 for ; Wed, 29 Sep 2021 07:24:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DF8D1613C8 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 496B4940009; Wed, 29 Sep 2021 03:24:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 446EA6B007B; Wed, 29 Sep 2021 03:24:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33563940009; Wed, 29 Sep 2021 03:24:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0027.hostedemail.com [216.40.44.27]) by kanga.kvack.org (Postfix) with ESMTP id 2120A6B0078 for ; Wed, 29 Sep 2021 03:24:04 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BCC1B181AEF0B for ; Wed, 29 Sep 2021 07:24:03 +0000 (UTC) X-FDA: 78639771966.12.DF50A26 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf07.hostedemail.com (Postfix) with ESMTP id 43E4310000AA for ; Wed, 29 Sep 2021 07:24:03 +0000 (UTC) Date: Wed, 29 Sep 2021 09:23:59 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1632900240; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gEaOYqOG/VNIf5aQbz7aP9xx3KfCxIFtGQsJvLVNsPA=; b=RPYN3L4R9h2Q+ChuT0Dt0vFFnGc5MjQixzFQnRErNsyjcPx1WSCKICi/+CcEeT4m/oZN1H u/uho+3LpWw7hkjmc1hKsXsC6Umfv3ty1qUXZ8s2Yup33oGN43uxH0cuzN/yVVciExVi03 seQ3xzeVVU9ZSVOyWXzjncn04AOfvyMK5c99UnRnexkWuPKV6IzZxKaDNHnO2BGB8Z5dJQ 45NHHvnGGBaQ//eA5GgmC2u7eF4hiY/VGEsmCpxiPtDhFrmai7+nRUqHoVngiyt/lSiGkP jJzJt0W0QTcvssa7/RW2L0CK7P4n+3FE0NJWAqyeGeJRrcj8eS9wxzOiUX0bNg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1632900240; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gEaOYqOG/VNIf5aQbz7aP9xx3KfCxIFtGQsJvLVNsPA=; b=D52lzsfy/Y7d+PYQyCVlBBBcaGuHHwwS6gq+IWJRkPhPJ7V30UWOZyeha/cr4+Hb8Q+8mL 4wF8eSTZmX8nlQCg== From: Sebastian Andrzej Siewior To: Andrew Morton Cc: Minchan Kim , linux-mm@kvack.org, Thomas Gleixner , Mike Galbraith , Mike Galbraith Subject: Re: [PATCH] mm/zsmalloc: Replace bit spinlock and get_cpu_var() usage. Message-ID: <20210929072359.zkzg57gf362tc76m@linutronix.de> References: <20210923170121.1860133-1-bigeasy@linutronix.de> <20210928084419.mkfu62barwrsvflq@linutronix.de> <20210928154723.1b0577818143734653d9b129@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20210928154723.1b0577818143734653d9b129@linux-foundation.org> X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 43E4310000AA X-Stat-Signature: dz31nj9z31umypqwqjjcigsh383kepih Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=RPYN3L4R; dkim=pass header.d=linutronix.de header.s=2020e header.b=D52lzsfy; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf07.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de X-HE-Tag: 1632900243-489345 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: On 2021-09-28 15:47:23 [-0700], Andrew Morton wrote: > Rather nasty with all the ifdefs and two different locking approaches > to be tested. What would be the impact of simply switching to the new > scheme for all configs? The current scheme uses the lower bit (OBJ_ALLOCATED_TAG) as something special which is guaranteed to be zero due to memory alignment requirements. The content of the memory, that long, is then used a bit spinlock. Moving it to spinlock_t would consume only 4 bytes of memory assuming lockdep is off. It is then 4 bytes less than a long on 64 bits archs. So we could do this if nobody disagrees. The spinlock_t has clearly advantages over a bit spinlock like the "order" from the qspinlock implementation. But then I have no idea what the contention here is. With lockdep enabled the struct gets a little bigger which I assume was to avoid. But then only debug builds are affected so=E2=80=A6 =20 > Which is identical to asking "what is the impact of switching to the new > scheme for PREEMPT_RT"! Which is I think an important thing for the > changelog to address? Well, PREEMPT_RT can't work with the bit spinlock in it. That is that part from the changelog: | 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. Sebastian