Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1436429lqh; Mon, 6 May 2024 07:44:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXRQCFWrEaKMJ8/ypEZh5oRLRKCYaPYLME1rUnBw1Zs/VQ4CAILgkuiL100ccPaCSy9NV0RlJn573pm56FobSbi6GDhfc6Zh9dw8epYLA== X-Google-Smtp-Source: AGHT+IFXJn+KV8PgcnyuVdGN5iYPN2fZSK4UoguAYkAD+wpt+7I5HMfrEqE0Vr/lQisB3juImgoV X-Received: by 2002:a05:6214:1d29:b0:6a0:c800:7b9c with SMTP id f9-20020a0562141d2900b006a0c8007b9cmr13109563qvd.63.1715006673638; Mon, 06 May 2024 07:44:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715006673; cv=pass; d=google.com; s=arc-20160816; b=MNGV70X3kggGkGkCM3i7C/5v/Mlr/P10aTpsLuomgEtgfNfYxY5WgsxS/lqeVqtPwV r1HqiVQFKuD/48bh3HQcufeoGCGay9GhmBFQ4kpTTub4+h+l4oWh8uulZAiKKXIamlip ieQf2WgS1ZYWi5NonZIuo95IMZFL8Wx9sMZLF4LiqRi6kDnU54szyNKdGfGzwxk4Byk+ tx3FDA/472y5CigmGfOeHUfrYq5DhQrR4u81soKMllNXE5Pp+5+F4mLxsFn1zerUHHRt Iatcd3GEmlH7CinwERMwin/WV7wWIreXmCSITjsZrDEYvf7z6iWOxqwID3PwVfsBim3q bR4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:dkim-signature:date; bh=E+17KTu0vecr45/CU20r0ymLx4clM9yLKI0xnA9xyBk=; fh=3bUW+faxFEXVCLryxfjxm52dICSsgXeijN8+mV3crCk=; b=CTjpUn6pQeBetcGcrSUVUEnejc7zlSird2OL3CLo2hAGRa9hkYCXQy0oigQubVy8O7 Wjb7c+1UZosNIeXD53OxR8EacxqFscmQntb3M0PvtYQ8fjGkSV+xdziMpqhjo1fM0xw6 W/kEDJNyDelqkADNJugj3gKUUv3VujfFz1nBpERKJk2YhGGnUIYnGmGYVULPi4kq48a0 5gm7mk8jD6vwQNGseRAp34jfmWw8N1bvDjdcb8Qw4s5uemeWjIvA2TVT/V+Zwo+fso8B 1j1MuxiT6TqvOBgGLa801nUt+JVWtD+l9bVLe9eRMFsjxMaTEv9mLKzurm8Z98Nkcjj8 IG/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="mjTrL+M/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=aBdofRxm; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-170010-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170010-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6-20020a05621420c600b006a0cba880e8si10554277qve.161.2024.05.06.07.44.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 07:44:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170010-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="mjTrL+M/"; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=aBdofRxm; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-170010-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170010-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 020EE1C245EF for ; Mon, 6 May 2024 14:44:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52566153579; Mon, 6 May 2024 14:44:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mjTrL+M/"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="aBdofRxm" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD88C1534E5; Mon, 6 May 2024 14:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715006644; cv=none; b=B13DlyEluEz3h8JU0rPCmscsLzHqmjYdeqPAenvnFUwrgdcU+G36FnUW2OW/EoPWmr19xcZLalc/SheHz+81aE4VcpKoh22FJhq4DUPswsPE1DcgaAZvT37zCEH8k5ELOXEdPuoySiMjgEsPCL6AycJsEzbdHnHvrC/eB1eD21M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715006644; c=relaxed/simple; bh=OuM/H3qINfOzCQkL3sukKEitkVGJMlavmaV4oYhb4Ik=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=efr74gPUVb++xzvVsaHh7UeM+GijtSxPlyeGCInei5ZnxtXetoQJP6oLglHR+JP0Tj81oqxbHM8IJYw15aEpsxP6TMXJo/87vNDrC4PVE19Ac5dAiJ7xSFTKT9MVmseWzIJBxEt6qfrz2iTQWE9f2aP5+C697h2Ik2HMgi3gizY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mjTrL+M/; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=aBdofRxm; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 6 May 2024 16:43:58 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1715006640; 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=E+17KTu0vecr45/CU20r0ymLx4clM9yLKI0xnA9xyBk=; b=mjTrL+M/wnHLmGDQbZ1LTzkD8cdNhzejF0byOGvZ/i4eRbIoSYjirIa2LPwRruBZrfDl4q ntO59K2bs8ns0OAGlXFx/p5nex+0/UMF837kBom8+FwPIUBebc5eorG64CuYYBzvgsaFpj bfjqJqxtVIVkliVhzHvACRSRRIVtp0qn/USE6uVnrVcxpdRUMKoOQAotBB3lNFqg7DKEJX M6t9tCAsEbP3Ia/9ttCtYikK36v9lckkVatk1BfIEtkIbmOngYtgaUAyAL0RnQa67ZjuZs piTqecxDmgGtmj+jRkvNkSIH76hOQbgs7l2aw0SVC05+l2nn4s8UXKWy270fcw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1715006640; 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=E+17KTu0vecr45/CU20r0ymLx4clM9yLKI0xnA9xyBk=; b=aBdofRxm1GkXMlZ8sMIK1OQLxffD8rYQylS1m5koFr7U/90pC91vExaa4zQAlzcFQLryqr vpqcwtg/sOvXIWAg== From: Sebastian Andrzej Siewior To: Paolo Abeni Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, "David S. Miller" , Boqun Feng , Daniel Borkmann , Eric Dumazet , Frederic Weisbecker , Ingo Molnar , Jakub Kicinski , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon Subject: Re: [PATCH v2 net-next 00/15] locking: Introduce nested-BH locking. Message-ID: <20240506144358.Dqd57lTp@linutronix.de> References: <20240503182957.1042122-1-bigeasy@linutronix.de> <0d2eca9e80ae644583248a9e4a4bdee94999a8f8.camel@redhat.com> <20240506093828.OLP2KzcG@linutronix.de> <7d46b465dd986bdf07330a7ed8d466674dec4859.camel@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <7d46b465dd986bdf07330a7ed8d466674dec4859.camel@redhat.com> On 2024-05-06 16:12:00 [+0200], Paolo Abeni wrote: > > I think sometimes the stack could call local_bh_enable() after a while > WRT the paired spin lock release, to enforce some serialization - alike > what inet_twsk_purge() is doing - but I can't point to any specific > line on top of my head. I *think* the inet_twsk_purge() is special because the timer is pinned and that bh_disable call ensures that the timer does not fire. > A possible side-effect you should/could observe in the final tree is > more pressure on the process scheduler, as something alike: > > local_bh_disable() > > > > > > local_bh_enable() > > could results in more invocation of the scheduler, right? Yes, to some degree. On PREEMPT_RT "spinlock lock" does not disable preemption so the section remains preemptible. A task with elevated priority (SCHED_RR/FIFO/DL) remains on the CPU unless preempted by task with higher priority. Regardless of the locks. A SCHED_OTHER task can be preempted by another SCHED_OTHER task even with an acquired spinlock_t. This can be bad performance wise if this other SCHED_OTHER task preempts the lock owner and blocks on the same lock. To cope with this we had something called PREEMPT_LAZY (now PREEMPT_AUTO) in the RT-queue to avoid preemption within SCHED_OTHER tasks as long as a spinlock_t (or other lock that spins on !RT) is acquired. By removing the lock from local_bh_disable() we lose that "please don't preempt me" feature from your scenario above across the BH disabled section for SCHED_OTHER tasks. Nothing changes for tasks with elevated priority. > Cheers, > > Paolo Sebastian