Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp627057rwe; Wed, 24 Aug 2022 06:42:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR701T3lxbXO75YNN6R7vdUV4a12NNHF65FYD7ELuk/cevcvR4IL59TFLDgRyZLhCTmaa/E2 X-Received: by 2002:a17:906:844d:b0:730:cd6a:a487 with SMTP id e13-20020a170906844d00b00730cd6aa487mr2905339ejy.50.1661348578158; Wed, 24 Aug 2022 06:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661348578; cv=none; d=google.com; s=arc-20160816; b=YagbjzZL0EUQodibZilkcpUx9ZIz94fuVPVEVEA6WVlVR0JRj12LHdl2Ioj+zBzNew eSezWrBMxbfSOjruXSz5lddixjigYlvHyA15BeylLl+ChapOa+EadJAFmEIy8C6MZRjr 0xIZz2xWkYS489jzVvW9+aMHy55RZujbUY8x/SrkDAnC6q6IkNRjLLfQ4mnKnRkhcyjN 5T1aaOwJo70WCrFIZRzXYL0xQiLRKwPqZLaRowD6SPxIhJp9vyI6jtdY/uaHQEmeLXZr BMxh9uAP1hmdwC0B3FayXyrNUNWEhBvY2ar0zaLQAcFEon3zsP7nawYh2vKrIZBsURn5 eG9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=ZfPjvzWKpgXEo+8hH6kCmmAmITetM6E4iZLw0MzmSl0=; b=j2YYYFOnoykGX12qXeoKhjP+Qkl2JE4TU+i+uUekbGKylp1XkA/BUnI2FyexF4sqqf lt/IfH476T9bPCoD7Ortm5AMGNEvH/uVKzJ9VMkbE7qwm7Wr1njI2/jM8jhSocQKWugp HArM5QjAZJQcOjykRwcXmi8E9cV6RF4amvD8GOAj9RnceVV+uNlFDdGSwGDrH/o4PBKR YbucAz0zHTUv4/pNCdHk0nCGCk9ZigESYaZIFyqhQUopcVtWjpcJ2V0PtY8vIdHOZ6+v veajWdRayHRP54NGQFgV03HeIqb+5ZuqgLkmN+Se6Tqb5raAM4DNYoVlNXLtrtglGDMh Z+hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LHoiETNr; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a056402500b00b00446b32b19c8si4568992eda.477.2022.08.24.06.42.32; Wed, 24 Aug 2022 06:42:58 -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=@linutronix.de header.s=2020 header.b=LHoiETNr; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237377AbiHXN0O (ORCPT + 99 others); Wed, 24 Aug 2022 09:26:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238315AbiHXNZ7 (ORCPT ); Wed, 24 Aug 2022 09:25:59 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 819C46A4A9 for ; Wed, 24 Aug 2022 06:25:55 -0700 (PDT) Date: Wed, 24 Aug 2022 15:25:51 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1661347553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZfPjvzWKpgXEo+8hH6kCmmAmITetM6E4iZLw0MzmSl0=; b=LHoiETNrfJCJJ0OPU2TIfCShaAnPnCl2HR5cIsb4PdlDlafYFm15sVqj7IH03i+rLG5oTD bB2bt2AuBCAFexTKGn4yBNaq//iKDsTyGza9vwluDwjJvWo7P7lSLDhwtJCnbW9cxN0eJ0 RPqNgnoTHclker3nNR2OfxS/nGgXwji3OUc/YP6HetUlOVBz8YbvcYW0K4ihX/6j5NG93X TbNdsGCp3IRTKt2OLl8DIgrTRDpNpoD4+Z7JkBMSxkiPMkGwnCNc2fUm8uFrBmGugyXGLy f4mBsE8K/3NRczfHsVGbX0csQ8ybI5dB/nrt+kE/o8tikXvhajurQhoBn88Lsw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1661347553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZfPjvzWKpgXEo+8hH6kCmmAmITetM6E4iZLw0MzmSl0=; b=CblGcfGlUQaxOugnOAbiMLnlzpWS+/n+xzy4dcZClDMij3BMtlXVV7G64QhRvcwocwN/M4 V+2AarcNvoca7dAA== From: Sebastian Andrzej Siewior To: Vlastimil Babka 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 Subject: Re: [PATCH 1/9] slub: Make PREEMPT_RT support less convoluted Message-ID: References: <20220817162703.728679-1-bigeasy@linutronix.de> <20220817162703.728679-2-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 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). 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. Sebastian