On Sat, Feb 1, 2025 at 7:19 PM David Laight <david.laight.linux@xxxxxxxxx> wrote: > > On Sat, 1 Feb 2025 17:31:06 +0100 > Mateusz Guzik <mjguzik@xxxxxxxxx> wrote: > > > It no longer serves any purpose now that the tasklist_lock -> > > pidmap_lock ordering got eliminated. > > Not disabling interrupts may make thing worse. > It is a trade off between 'interrupt latency' and 'lock hold time'. > > If interrupts are disabled then (clearly) they can get delayed because > the lock is held. > Provided the lock is only held for a short time it probably doesn't matter. > Indeed, unless it is the worst one, it probably doesn't matter at all. > After all spin locks shouldn't really be held for significant periods. > > OTOH if the lock doesn't disable interrupts then an interrupt will > increase the length of time a lock is held for. > This can be significant - and I mean upwards of 1ms. > Network interrupts can tale a while - and then the work that is deferred > to 'softint' context happens as well (I don't think a spinlock stops > the softint code). > > I've a feeling that unless a spin lock is held for 'far longer than one > should ever be held for' then you really want to disable interrupts. > Note that taking the interrupt trip increases single-threaded overhead. Per your own description, if the lock is contested and interrupts are disabled, handling them also get delayed by CPUs which are busy just waiting (and which would otherwise take care of them). So while this is indeed a tradeoff, as I understand the sane default is to *not* disable interrupts unless necessary. -- Mateusz Guzik <mjguzik gmail.com>