tech-kern archive

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

Re: uvm & percpu

On Tue, Jun 01, 2010 at 11:26:40AM -0400, Matthew Mondor wrote:
> On Tue, 1 Jun 2010 15:29:05 +0100
> Sad Clouds <> wrote:
> > A better way would be for cpu to have its own counter, which is
> > incremented until it reaches a certain threshold. At the threshold, the
> > global counter is incremented by the local counter.
> > 
> > It all depends on the logic of what the counter is supposed to do. But
> > it doesn't have to be very expensive, i.e. if it's just a statistics
> > counter, you can do the above trick to reduce contention.
> Another way would be for the cpu+global values to only be assembled
> when statistics are requested, unless there's active code taking that
> global counter into consideration frequently.

One general solution would be to enhance event counters (evcnt) to use
the percpu allocator.  A simple * way to access this from assembly language,
and a way for it to work when percpu isn't available (bootstrap) would
be necessary.

* when I say simple here, I mean "just increment the global counter"
because it's too difficult to do fancy stuff in assembly sometimes
and the performance impact may not be of concern. It really depends on
the application.

Home | Main Index | Thread Index | Old Index