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 F40E9C00140 for ; Wed, 24 Aug 2022 11:51:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4784F940007; Wed, 24 Aug 2022 07:51:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4011D6B0074; Wed, 24 Aug 2022 07:51:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27A2B940007; Wed, 24 Aug 2022 07:51:27 -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 1131F6B0073 for ; Wed, 24 Aug 2022 07:51:27 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E6456418B6 for ; Wed, 24 Aug 2022 11:51:26 +0000 (UTC) X-FDA: 79834320972.31.F1B8AA4 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf08.hostedemail.com (Postfix) with ESMTP id 73F6E160035 for ; Wed, 24 Aug 2022 11:51:26 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id ED03A33C20; Wed, 24 Aug 2022 11:51:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661341884; h=from:from:reply-to: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=1cHwRzKKYpfqn3d7iBd8qXAQa04no8JKC8lzcgi5R6Y=; b=EfEuAprPzFlCwWjdKv3TsFYx66XZcVllZAsrYxr8BSG6dlPmkRZz3YO6Es+iJA3x3xjT8F jEo2tq67kVpc1bT6KKDnyMgXnKP9UWEYCQWzG/VvF1IKTR+sYNC3wgHcXeXs1fUtM5LLF6 0/Ow6wyqq8muD736T0vIeU0HsCXUhw4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661341884; h=from:from:reply-to: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=1cHwRzKKYpfqn3d7iBd8qXAQa04no8JKC8lzcgi5R6Y=; b=RLjVF7ziJGRCNH2QlVRPExl7J1IQdXmp3reLE5MmQjundhZnXg76cwDSyXCjVsAYHeHgN6 El+nInkvG/ry2nDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id AFC8213AC0; Wed, 24 Aug 2022 11:51:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +4rmKbwQBmOPPwAAMHmgww (envelope-from ); Wed, 24 Aug 2022 11:51:24 +0000 Message-ID: <693b9fad-4083-2bc6-f979-136978e12fd2@suse.cz> Date: Wed, 24 Aug 2022 13:51:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH v2 5/5] mm/slub: simplify __cmpxchg_double_slab() and slab_[un]lock() Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Rongwei Wang , Christoph Lameter , Joonsoo Kim , David Rientjes , Pekka Enberg , Roman Gushchin , linux-mm@kvack.org, Sebastian Andrzej Siewior , Thomas Gleixner , Mike Galbraith References: <20220823170400.26546-1-vbabka@suse.cz> <20220823170400.26546-6-vbabka@suse.cz> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661341886; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=1cHwRzKKYpfqn3d7iBd8qXAQa04no8JKC8lzcgi5R6Y=; b=KVESuaAnwL+XTaosIzQAUL8oY4w/XyUxO7y/TlpiNKA5yKQqFkaIhn028gJkwe9jQ0Q3E0 d7wH2JCDA2ZiGXUFLHXSuXTAhWy+RASv76lOTuGgDMHP6XBo3Ws+yiYxF0vz8KW+Ixlzsc u92utZf4wdD5p7I7KSvIT3Ad32z1skc= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=EfEuAprP; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=RLjVF7zi; spf=pass (imf08.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661341886; a=rsa-sha256; cv=none; b=PuJW3lyKjxHOQem5EV3Hkh4f5XUxjoPxvKtq1628GfkxksabR8wC4BtHUcjZ/U8IhsXCyq KkKN9q4sYqVulXGcSCwfhKmnYL4+6GiWokDgXOgMahFwOujs1347n7JW6rJzNPmHIX9mZp Vs9Q4gGzr3AfPekLGloMtOWmxUfRCZE= X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=EfEuAprP; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=RLjVF7zi; spf=pass (imf08.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 73F6E160035 X-Stat-Signature: 3nhzdy8znzffkhqdtnxub7ehedu4xb5r X-HE-Tag: 1661341886-163249 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 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. 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. > 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()). > 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. > Thanks! >