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 79BD4C04AA5 for ; Thu, 25 Aug 2022 12:59:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3AC1940008; Thu, 25 Aug 2022 08:59:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EE929940007; Thu, 25 Aug 2022 08:59:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8AAC940008; Thu, 25 Aug 2022 08:59:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id C58F3940007 for ; Thu, 25 Aug 2022 08:59:24 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 988FA1C77D4 for ; Thu, 25 Aug 2022 12:59:24 +0000 (UTC) X-FDA: 79838121048.01.4098ABB Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf15.hostedemail.com (Postfix) with ESMTP id D8701A0011 for ; Thu, 25 Aug 2022 12:59:23 +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 A4FB0344CB; Thu, 25 Aug 2022 12:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661432362; 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=MYkxRtiq3JAvj/A+qf31fenWdOjmVT3wOY7QO2FjCIM=; b=eQ3kMY9b2zhtcD8SIpaySEZnaS5ed2J5GntRPMvr4+7LCrF6r0906hqxP6idwHZ5Y/R3PI oN95UMjoN9/Ij8DRwQYbx7ZYVShdmKsd2yJMOVC9+suCDXSAroG17FUtGI5aRQYwHww/D+ yj9DfFCvFaxmuHGMF6PNZoAZxdSBJqo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661432362; 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=MYkxRtiq3JAvj/A+qf31fenWdOjmVT3wOY7QO2FjCIM=; b=ql+Qf7eRSguR7YyOiYwlKp2/Rf//XoZwVrPv2KQ5Z/9/lGYtUBDmGlxaLuvW11d0noljZ8 aogyiPPKdwxa6wAw== 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 74D8113A8E; Thu, 25 Aug 2022 12:59:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id duOuGypyB2N/JAAAMHmgww (envelope-from ); Thu, 25 Aug 2022 12:59:22 +0000 Message-ID: Date: Thu, 25 Aug 2022 14:59:22 +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: Sebastian Andrzej Siewior Cc: Rongwei Wang , Christoph Lameter , Joonsoo Kim , David Rientjes , Pekka Enberg , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , linux-mm@kvack.org, 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 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661432364; a=rsa-sha256; cv=none; b=TO3GXDH3vlP0WBmzY3m31dkTyIQpBmNbgf1pdLPnndYDXtfHihnyFsvrK8ol6LKUsOxChI nY+ALSawCIOsJDm1Xb890Y6v87HdwPN0PNQvFB+9wqlaNthAKzVwEEgOX4Nx16qB6NpKLv w0APi4fCe12b6mIj+hlCaXA2uYX6qKs= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=eQ3kMY9b; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=ql+Qf7eR; dmarc=none; spf=pass (imf15.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661432364; 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=MYkxRtiq3JAvj/A+qf31fenWdOjmVT3wOY7QO2FjCIM=; b=nwZ16tT8bvbLfaaOJedhuqpKb1EWemP2adzgyA05ClKkTGP1KfEtID/fumplGiB/ZMrVfH HEWrUbCtQ3RH4jnE+1tu1WI7YzEQrprF9gaTQsxQdotLXV0ecbXRqSp9rv+YbpxtP1xmCs WLcmSwrXa853CaoLnIiUMbnr5l8gl3U= Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=eQ3kMY9b; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=ql+Qf7eR; dmarc=none; spf=pass (imf15.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspam-User: X-Rspamd-Queue-Id: D8701A0011 X-Rspamd-Server: rspam08 X-Stat-Signature: gmfjrxj9pky8img191fpp4w6sntcxjdb X-HE-Tag: 1661432363-154499 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 18:25, Sebastian Andrzej Siewior wrote: > On 2022-08-23 19:04:00 [+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. > > maybe something like > "… sufficient on PREEMPT_RT where no allocation/ free operation is > performed in hardirq context and so interrupt the current operation." > >> 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(). >> >> Signed-off-by: Vlastimil Babka >> Acked-by: David Rientjes > > Reviewed-by: Sebastian Andrzej Siewior Thanks, incorporated your wording suggestions. >> --- a/mm/slub.c >> +++ b/mm/slub.c >> @@ -454,7 +454,7 @@ static __always_inline void __slab_lock(struct slab *slab) > … >> /* >> * Interrupts must be disabled (for the fallback code to work right), typically >> - * by an _irqsave() lock variant. Except on PREEMPT_RT where locks are different >> - * so we disable interrupts as part of slab_[un]lock(). >> + * by an _irqsave() lock variant. Except on PREEMPT_RT where these variants do >> + * not actually disable interrupts. On the other hand the migrate_disable() >> + * done by bit_spin_lock() is sufficient on PREEMPT_RT thanks to its threaded >> + * interrupts. > > " On PREEMPT_RT the > preempt_disable(), which is part of bit_spin_lock(), is sufficient > because the policy is not to allow any allocation/ free operation in > hardirq context. Therefore nothing can interrupt the operation." > > This also includes SMP function calls (IPI). > >> */ >> static inline bool __cmpxchg_double_slab(struct kmem_cache *s, struct slab *slab, >> void *freelist_old, unsigned long counters_old, > > Sebastian