tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: __{read,write}_once



Le 11/11/2019 à 13:51, Joerg Sonnenberger a écrit :
On Mon, Nov 11, 2019 at 11:02:47AM +0100, Maxime Villard wrote:
Typically in sys/uvm/uvm_fault.c there are several lockless stat increments
like the following:

	/* Increment the counters.*/
	uvmexp.fltanget++;

Wasn't the general consensus here to ideally have per-cpu counters here
that are aggregated passively?

In this specific case it's not going to work, because uvmexp is supposed to
be read from a core dump, and the stats are expected to be found in the
symbol...

I can think of three different options depending the platform:

(1) Use full atomic operations. Fine for true UP platforms and when the
overhead of per-CPU precise accounting is too high.

(2) Use uninterruptible memory operations in per CPU memory, aggregate
passively on demand.

(3) Emulate uninterruptible memory operations with kernel RAS, aggregate
passively on demand.

Generally I would do (2), but in this specific case I suggest (1).
atomic_inc_uint is supposed to be implemented on each platform already, so
it's easy to do.

(3) is a big headache for a very small reason, and it's not going to
prevent inter-CPU races.


Home | Main Index | Thread Index | Old Index