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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBA1CC00140 for ; Wed, 24 Aug 2022 12:45:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 79B10940009; Wed, 24 Aug 2022 08:45:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74980940007; Wed, 24 Aug 2022 08:45:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EACE940009; Wed, 24 Aug 2022 08:45:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 5284F940007 for ; Wed, 24 Aug 2022 08:45:28 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 09563140276 for ; Wed, 24 Aug 2022 12:45:28 +0000 (UTC) X-FDA: 79834457136.06.4718444 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by imf27.hostedemail.com (Postfix) with ESMTP id B8FA84004E for ; Wed, 24 Aug 2022 12:45:27 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id o14-20020a17090a0a0e00b001fabfd3369cso1347700pjo.5 for ; Wed, 24 Aug 2022 05:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=f4bJJ4zKBXG7xnBV8spoWWtGWbwvY8KziDAKmjyi6JI=; b=n1I4co/qG5Ho+TjHm5l43tsO8K954hU9sz3CDCPcxzdUFcbs9IgEGA7eATScq5GpHe 9O0NUcpPV9DgPzKuKfOQVar33n6lCjBkFld6y5yc5lgxDjtTVabsgaZ1sQa9AmvoLlBy XEk0Bysq+Pl6wrvHSCNlOjKK6lux4Az2896TzY6x5avvDUBylksPoFQOwvHLxhIVlXfH EiJXDKgZQzmhygVq34MnygjthNPsV6mQlwNkC97wcfwZu7seLLJRButA+ARnWMCI62Bd DGFAH2qoBSlRX5bhqI7Rs+LuM8hMJOPAsYtVA5eM1xy8UIFTwQLePHVkHHAJA7Qo0NWZ tTQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=f4bJJ4zKBXG7xnBV8spoWWtGWbwvY8KziDAKmjyi6JI=; b=DsCs/KHb1QyExeC0iGUMaCggF+DVvTvoUA4EFmIRBBA+1PMReQUYxAuVQPEJCRMGXl xxGUbCREIaSLUxxnfPrg/SGhPLaAecdwG3o7dFl+sNRDoz18DnNevYNqOac/7ibPv9We hQhfZDxUt138ujQCy3cYOljbIccshsxOjCxDqCSWRk5k40eZHSFsVczMjbsjI2dIMY9U VT7+qqaT6t3tcYwEqm1DOImFoTsL6562Dv2prRxBE5/8j7M7iugJ5pUjNjQeJ1REX0Wp Noo4JgvjbLxe4+3jfvXLxrfwRr0ntoU32IL0EZPh0HQ8em548VxIj5JLNa6QU2ANjpBZ igag== X-Gm-Message-State: ACgBeo3nym0EljaYAh0M0ogQqTs8Kv+JdWCEBH97FQShhvW1V6SAB7s4 MV3gRI0vCtyYxJ3hjZjyU8w= X-Google-Smtp-Source: AA6agR4QWan9OAXb3uaKMKnDWGaTDC9S0tasrIf9RrBLLwsLN8gbzVu6Q8R6AszcrqNffxxqBd9rgw== X-Received: by 2002:a17:902:8c90:b0:173:1571:4029 with SMTP id t16-20020a1709028c9000b0017315714029mr2386781plo.83.1661345126769; Wed, 24 Aug 2022 05:45:26 -0700 (PDT) Received: from hyeyoo ([114.29.91.56]) by smtp.gmail.com with ESMTPSA id y9-20020a62ce09000000b0052e987c64efsm13191495pfg.174.2022.08.24.05.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 05:45:25 -0700 (PDT) Date: Wed, 24 Aug 2022 21:45:20 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Vlastimil Babka Cc: Rongwei Wang , Christoph Lameter , Joonsoo Kim , David Rientjes , Pekka Enberg , Roman Gushchin , linux-mm@kvack.org, Sebastian Andrzej Siewior , Thomas Gleixner , Mike Galbraith Subject: Re: [PATCH v2 5/5] mm/slub: simplify __cmpxchg_double_slab() and slab_[un]lock() Message-ID: References: <20220823170400.26546-1-vbabka@suse.cz> <20220823170400.26546-6-vbabka@suse.cz> <693b9fad-4083-2bc6-f979-136978e12fd2@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <693b9fad-4083-2bc6-f979-136978e12fd2@suse.cz> ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661345127; a=rsa-sha256; cv=none; b=Y6v3irfKJNKvS05zF8I4LtWYmXzYLj2lGVNUJX7Gq/PWVZZeQ1zRyP81LVNtxTcHkkN1UF vVZVGjAzaI/8ForFRYxVDMvn9Yne+wFHvWsUmnZbhxzX0o4sIWO7Slqiou6/h4T4IBgl9l tK1i4Z8CUs8PG2t5PzKrFOlMzifQPoQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="n1I4co/q"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661345127; 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:in-reply-to:references:references:dkim-signature; bh=f4bJJ4zKBXG7xnBV8spoWWtGWbwvY8KziDAKmjyi6JI=; b=W4A9UBV1U4KCEjlGk9lgZq/x0WNEmrnzAPo2J8c7W/jFSQJ7VI3/peyvOsnScNQhJDfNit hIYTyd0SUd4kHrbw35CVRHiC8D3NKJ+bRHZQ8mBcCnX7QIc/w7N5YBsdbjJ4XSU36dh3k2 DAcz9JD5p9LwFQkrUV0xV/jq3mpzDJk= Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="n1I4co/q"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.42 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com X-Rspamd-Queue-Id: B8FA84004E X-Rspamd-Server: rspam02 X-Stat-Signature: 89w8ncpat9jy4qcdsgzre55geq7qrkrd X-Rspam-User: X-HE-Tag: 1661345127-888520 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 Wed, Aug 24, 2022 at 01:51:24PM +0200, Vlastimil Babka wrote: > On 8/24/22 12:24, Hyeonggon Yoo wrote: > > On Tue, Aug 23, 2022 at 07:04:00PM +0200, Vlastimil Babka wrote: > > > The PREEMPT_RT specific disabling of irqs in __cmpxchg_double_slab() > > > (through slab_[un]lock()) is unnecessary as bit_spin_lock() disables > > > preemption and that's sufficient on RT where interrupts are threaded. > > > > > > That means we no longer need the slab_[un]lock() wrappers, so delete > > > them and rename the current __slab_[un]lock() to slab_[un]lock(). > > > > > > > I'm not familiar with PREEMPT_RT preemption model so not sure I'm following. > > > > 1) Does "interrupts are threaded on RT" mean processing _most_ (all handlers > > that did not specified IRQF_NO_THREAD) of interrupts are delayed to irq threads > > and processed later in process context, and the kernel *never* use > > spinlock_t, local_lock_t that does not disable interrupts (and sleep) on RT > > in hardware/software interrupt context? > > AFAIK, yes, that's the case. So if some non-threaded handler used slab, we > would be in trouble. Yeah, that was exactly what I wondered! > But that would already be the case before this patch > due to the local_lock usage in other paths - the bit_spin_lock() without > disabled irq shouldn't add anything new here AFAIK. Agreed. > > 2) Do we need disabling irq in cmpxchg_double_slab() on RT? > > By that logic, we don't. But IMHO it's not worth complicating the code by > special casing it for some negligible performance gain (the protected > sections are very short), like we now special case __cmpxchg_double_slab() > for correctness (after this patch, just the correctness of > lockdep_assert_irqs_disabled()). Okay. Wanted to make sure that disabling interrupts is not required by RT. > > > BTW Is there a good documentation/papers on PREEMPT_RT preemption model? > > I tried to find but only found Documentation/locking/locktypes.rst :( > > Good question, I don't know myself, maybe the RT guys do. Okay. Thanks! -- Thanks, Hyeonggon