NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/56764
Date: Sat, 21 Feb 2026 18:57:45 +0100
From: Thomas Klausner <wiz%gatalith.at@localhost>
Message-ID: <aZnxvnZ8CTpVG1LS%exadelic.gatalith.at@localhost>
| My reason for the lock is not to make the update of the variables
| atomic,
No, the one in question already is.
| but to make the structure consistent, since there are
| assertions about the relative value of structure members that are
| broken.
But to do that you'd need to lock for much longer periods than the
short period locks you've been adding - All this does:
if (swpgonlydelta > 0) {
+ mutex_enter(&uvm_swap_data_lock);
KASSERT(uvmexp.swpgonly >= swpgonlydelta);
atomic_add_int(&uvmexp.swpgonly, -swpgonlydelta);
+ mutex_exit(&uvm_swap_data_lock);
}
for example, is to make sure that nothing is changing uvmexp.swpgonly
during the next two lines. The atomic_add_int() already protects it
for that line, the lock isn't needed for that, so it is just for the
KASSERT() in practice, bit the value might have changed just before
the mutex_enter() after the >0 test, or perhaps earlier than that, when
swpgonlydelta was being computed.
This kind of thing is all very messy, and very hard to get right, but
I really can't see how the extra locking that you are adding can help.
kre
ps: once again, I'm like Jon Snow, I know nothing...
Home |
Main Index |
Thread Index |
Old Index