Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp686373rwe; Wed, 24 Aug 2022 07:30:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR40zJt+ocIzQXkKUqFAe/hlmqHV4s8MudKfpD60bSXExhGUIZ8MDtGUbOgU0nfImF/CmQ9U X-Received: by 2002:a63:8749:0:b0:41d:89d4:ce3d with SMTP id i70-20020a638749000000b0041d89d4ce3dmr23579341pge.344.1661351457108; Wed, 24 Aug 2022 07:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661351457; cv=none; d=google.com; s=arc-20160816; b=HWiZoTZDQBIilSJUImG3XOFJq/brTlRN8FOtUzD2aP4rPpvxTw7Wdham7xOSJR47c9 EKs+r78tzkR39nI2rxa04YIVARiIBlnT+5QHsqDdP7auDGjq+tmnezheowwSCiFa572p PfC4fYTeQX6hpCSAB8ieiPqfDR3i3aWWPUcttHyhPOxmBrlIpskDA+cIrkZxDD54hmd4 YOqsCZuG37A0ajr/KfzrXEW85zDKGnvO/dMSUeeAD9RIEYTsPlxgPcYrY3qdAdRAhEcI /YHu7vBAyYEIkZ5+S6t4hcBDqK/iEeAS3JJbAwcJ567tO2ucZdWtTyKqotYZmmPyj870 0Czg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=YH9z4JU2bwTg40vWiFH3ozsp+vDepQBVhfttSpFUe/Q=; b=oeATxeCLDXICp4FR0vCV4jZTSrr3lsaA5CyUPn18Kr4t/gO+NCoKYeDchm32hoSwv0 TUO8VETcpwau2tsxVJxWJGjVV0JlrFE8MCdvrJjmC7HTjN5ljQtij/u9qR4Jhp5NzAHj jVbxarhDcgotlpqQUoGjrq39mvB7f+E17h4HIR1w7gLQIA3EKrql9OS5c4+lfMDuTr3F c/hyj4xiNQtJ74hxRcB0al7Mp4f3/+2dU4/12B9s+MihGSwZlWB6Fwx/q6yV7lhvafFT L4SGabmxARTQNsFPhp78X4LC8MrzF+s2h5fc6k87xcuvFgVfAUxK5uCit9/CUuSkLflB RGuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="djF3+5E/"; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j189-20020a6380c6000000b0042b19761809si1974220pgd.445.2022.08.24.07.30.44; Wed, 24 Aug 2022 07:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="djF3+5E/"; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238711AbiHXN4b (ORCPT + 99 others); Wed, 24 Aug 2022 09:56:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239207AbiHXNzv (ORCPT ); Wed, 24 Aug 2022 09:55:51 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C5555B7BF for ; Wed, 24 Aug 2022 06:54:56 -0700 (PDT) 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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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