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 328D3C00140 for ; Wed, 24 Aug 2022 13:54:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8007C6B0073; Wed, 24 Aug 2022 09:54:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7AFE0940007; Wed, 24 Aug 2022 09:54:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 681976B0075; Wed, 24 Aug 2022 09:54:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 58AB16B0073 for ; Wed, 24 Aug 2022 09:54:57 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 29226A1B98 for ; Wed, 24 Aug 2022 13:54:57 +0000 (UTC) X-FDA: 79834632234.18.8EC55DC Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf07.hostedemail.com (Postfix) with ESMTP id 636EE40048 for ; Wed, 24 Aug 2022 13:54:56 +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-out2.suse.de (Postfix) with ESMTPS id 204891FE9A; Wed, 24 Aug 2022 13:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1661349295; 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=YH9z4JU2bwTg40vWiFH3ozsp+vDepQBVhfttSpFUe/Q=; b=djF3+5E/HPbHqJyAtNKK1WLWYUZbayvBv6M6oWQ09IxwtcZUVLtQKXy3fsF0LANJB49WsK rYf48qkXeCM2BRLESMyBQwKwYosfZuS8qAELsKaT2stk40kLPZmywKGpIa7rP99lhpwP/1 a8o7fX/dA5h0h7gm9X+Xpe1oUxZTwPw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1661349295; 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=YH9z4JU2bwTg40vWiFH3ozsp+vDepQBVhfttSpFUe/Q=; b=IBhR97T2hKnM0VdB90QD6TK5aWwuVCNpM2ZDAqkdx48k4XG9pRwzkJp4ZK22DRnNPpTCNV L0p+6OeaxMrVgXBg== 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 B0CC613780; Wed, 24 Aug 2022 13:54:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0tYeKq4tBmN9dwAAMHmgww (envelope-from ); Wed, 24 Aug 2022 13:54:54 +0000 Message-ID: Date: Wed, 24 Aug 2022 15:54:54 +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 1/9] slub: Make PREEMPT_RT support less convoluted Content-Language: en-US To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Thomas Gleixner , Peter Zijlstra , Steven Rostedt , Linus Torvalds , Matthew Wilcox , Andrew Morton , Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg , linux-mm@kvack.org References: <20220817162703.728679-1-bigeasy@linutronix.de> <20220817162703.728679-2-bigeasy@linutronix.de> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="djF3+5E/"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=IBhR97T2; spf=pass (imf07.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661349296; a=rsa-sha256; cv=none; b=mTJJ85RJZSVuFC9yi3FKcaCEX0+4AeIpjKonFL5ll9w3GvYMKDvGsa5A9VgkhbbUMSTBRH C8c6iOhg9+u93NCnc4vBZ3MSZKqhIwm49b+m4ruW7bs+nq+E1sbANkbdHcYv1YR00hKpa3 DzUWYGfP7lk7yrOu4RhNWhEEY3FJbtU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661349296; 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=YH9z4JU2bwTg40vWiFH3ozsp+vDepQBVhfttSpFUe/Q=; b=PV6C6unMbyyGJThnwCP2I8DwhrscHDZDYaWRST+YDxuNw7qzRKVD2WJLVpICYRseOB8b71 PdQrxy8QP3sTKYZZ1tDIK+yq0rFCM0IB5rkiPlhzGdxF3/7f29jfGFru4KJRJTsF+wbI9C vX4ufDf018cHgmEHY/jq9wuS3TztUgw= X-Stat-Signature: 5gwsww75ctqdyhumhmdtwckbi4trnt8c X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 636EE40048 Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="djF3+5E/"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=IBhR97T2; spf=pass (imf07.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-HE-Tag: 1661349296-850529 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 15:25, Sebastian Andrzej Siewior wrote: > On 2022-08-23 19:15:43 [+0200], Vlastimil Babka wrote: >>> +#define slub_local_irq_save(flags) local_irq_save(flags) >>> +#define slub_local_irq_restore(flags) local_irq_restore(flags) >> >> Note these won't be neccessary anymore after >> https://lore.kernel.org/linux-mm/20220823170400.26546-6-vbabka@suse.cz/T/#u > > Okay, let me postpone that one and rebase what is left on top. > >>> @@ -482,7 +488,7 @@ static inline bool __cmpxchg_double_slab(struct kmem_cache *s, struct slab *slab >>> void *freelist_new, unsigned long counters_new, >>> const char *n) >>> { >>> - if (!IS_ENABLED(CONFIG_PREEMPT_RT)) >>> + if (use_lockless_fast_path()) >>> lockdep_assert_irqs_disabled(); >> >> This test would stay after the patch I referenced above. But while this >> change will keep testing the technically correct thing, the name would be >> IMHO misleading here, as this is semantically not about the lockless fast >> path, but whether we need to have irqs disabled to avoid a deadlock due to >> irq incoming when we hold the bit_spin_lock() and its handler trying to >> acquire it as well. > > Color me confused. Memory is never allocated in-IRQ context on > PREEMPT_RT. Therefore I don't understand why interrupts must be disabled > for the fast path (unless that comment only applied to !RT). Yes that only applied to !RT. Hence why the assert is there only for !RT. > It could be about preemption since spinlock, local_lock don't disable > preemption and so another allocation on the same CPU is possible. But > then you say "we hold the bit_spin_lock()" and this one disables > preemption. This means nothing can stop the bit_spin_lock() owner from > making progress and since there is no memory allocation in-IRQ, we can't > block on the same bit_spin_lock() on the same CPU. Yeah, realizing that this is true on RT led to the recent patch I referenced. Initially when converting SLUB to RT last year I didn't realize this detail, and instead replaced the irq disabling done (only on !RT) by e.g. local_lock_irqsave with the manual local_irq_save(). > Sebastian