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 1179DC00140 for ; Wed, 24 Aug 2022 13:25:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 75A66940007; Wed, 24 Aug 2022 09:25:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E2586B0074; Wed, 24 Aug 2022 09:25:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 55BCC940007; Wed, 24 Aug 2022 09:25:56 -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 415306B0073 for ; Wed, 24 Aug 2022 09:25:56 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id F2099140B31 for ; Wed, 24 Aug 2022 13:25:55 +0000 (UTC) X-FDA: 79834559070.20.D4A5404 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf09.hostedemail.com (Postfix) with ESMTP id 817C614004C for ; Wed, 24 Aug 2022 13:25:55 +0000 (UTC) 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: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661347555; a=rsa-sha256; cv=none; b=EfGzqwz6SSzFeC5pg+tRDZ2RaTokyNKZINUG8QVEt59aDtzpIPHg7/Za1K+lCUQZImMF4J 8mnxszzSHvQxQcZJZc40DHlaESnLI3esXLMCFzjhkDi3rUDyaMByy7ZBXv8hMd6HG3Xqa5 dgppcMUms8YnHMwybE/bDVMe3Ij8iIM= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=LHoiETNr; dkim=pass header.d=linutronix.de header.s=2020e header.b=CblGcfGl; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf09.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661347555; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZfPjvzWKpgXEo+8hH6kCmmAmITetM6E4iZLw0MzmSl0=; b=hZIpYGkMPwLQ5TnRsKnEcUl2o9vGi7u+6HgXYhqCxdHN3qH+rFJRuQrevzk6XWwOanJj94 eJ3fvrgfootcn0ibNI4U+pHVXycP2lYQI1Pj7mpHdv3NztsSgmmhuPzm7y+Jq5NGSUwyST eIOth4kdT3lOpEMbS7h1vDVm9hIx0sU= X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 817C614004C X-Stat-Signature: 6tkoc7dg76wmxxcnase145z8xrc9yw7q Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=LHoiETNr; dkim=pass header.d=linutronix.de header.s=2020e header.b=CblGcfGl; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf09.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de X-Rspam-User: X-HE-Tag: 1661347555-174500 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 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