Re: [rfc 19/45] cpu alloc: NFS statistics

From: Mathieu Desnoyers
Date: Tue Nov 20 2007 - 16:51:00 EST


* Trond Myklebust (trond.myklebust@xxxxxxxxxx) wrote:
>
> On Tue, 2007-11-20 at 16:28 -0500, Mathieu Desnoyers wrote:
> > * Trond Myklebust (trond.myklebust@xxxxxxxxxx) wrote:
> > >
> > > On Tue, 2007-11-20 at 12:49 -0800, Christoph Lameter wrote:
> > > > On Tue, 20 Nov 2007, Mathieu Desnoyers wrote:
> > > >
> > > > > > Index: linux-2.6/fs/nfs/iostat.h
> > > > > > ===================================================================
> > > > > > --- linux-2.6.orig/fs/nfs/iostat.h 2007-11-15 21:17:24.391404458 -0800
> > > > > > +++ linux-2.6/fs/nfs/iostat.h 2007-11-15 21:25:33.167654066 -0800
> > > > > > @@ -123,7 +123,7 @@ static inline void nfs_inc_server_stats(
> > > > > > int cpu;
> > > > > >
> > > > > > cpu = get_cpu();
> > > > > > - iostats = per_cpu_ptr(server->io_stats, cpu);
> > > > > > + iostats = CPU_PTR(server->io_stats, cpu);
> > > > > > iostats->events[stat] ++;
> > > > >
> > > > > Is there a way to change this into a CPU_ADD ?
> > > >
> > > > Yes I must have missed that.
> > > >
> > > > Could be
> > > >
> > > > CPU_INC(server->io_stats->events[stat]);
> > > >
> > > > >
> > > > > > put_cpu_no_resched();
> > > > >
> > > > > Why put_cpu_no_resched here ?
> > > >
> > > > We do not want to reschedule here? We may have already disabled interrupts
> > > > or some such thing.
> > >
> > > Some of these statistics are updated from inside a spinlocked
> > > environment, hence the put_no_resched().
> > >
> >
> > The we could use __get_cpu_var instead ? (since we know preemption is
> > _always_ disabled when we are called) ?
>
> We don't know that. I said that _some_ of these statistics are updated
> in that way.
>

Then my original point is valid : put_no_resched() will cause unwanted
scheduler latencies. It's designed only to be used from within the
scheduler code itself. The correct approach would be a standard
put_cpu().

Or am I missing something ?

Mathieu

> Cheers
> Trond
>

--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/