Re: [discuss] Re: [RFC, patch] i386: vgetcpu(), take 2

From: Rohit Seth
Date: Mon Jun 26 2006 - 21:12:56 EST


On Sat, 2006-06-24 at 10:42 +0200, Andi Kleen wrote:
> > It just does not sound like a right interface. Why should an app be
> > giving the last time value that it asked for the same information.
>
> First this information comes with a good-before date stamp
> so it's natural. Otherwise the application will never pick
> up when the scheduler decides to schedule it somewhere else,
> which would be bad.
>

Though the rescheduling can happen any time. I'm not sure how is tcache
going to track rescheduling deterministically. In theory there are
always going to be those pathological cases which will be very difficult
to get right (with or without tcache).


> And that came from conversation with application developers.
>
> A: We want something to get the current node
> me: how fast does it need to be?
> B: we will cache it anyways.
>
> Problem is that normally the application can't do a good job
> at doing the cache because it doesn't have a fast way to
> do time stamping (gettimeofday would be too slow and it's
> the fastest timer available short of having a second thread
> that sleeps and updates a counter)
>
> But the vsyscall incidentially knows this because of it
> sharing data with vgettimeofday(), so it can
> do the job for the application
>

I think I probably read your patch wrong or an earlier version where
user was sending the tcache down to vsyscall. Is user sending the
tcache parameter containing the last jiffies down to vsyscall in your
latest patch? Could you please point me to latest patch.

I think the system call is going to come with caveat that the
information provided by vgetcpu could be stale as the process could have
moved to different CPU before returning information.

> > User
> > wants cpu, package and node numbers and those are the three parameters
> > that should be there. Besides if we are using lsl then the latency part
> > of cpuid is already gone so no need to optimize this any more.
> >

> > Though this will be good interface to export jiffies ;-)
>
> No - jiffies don't have a defined unit and might even go away
> on a fully tickless kernel.
>
> If we just exported jiffies you would get lots of HZ dependent
> programs.


I agree and that is why I don't think we should export anything relating
to jiffies to external world (may be my smiley selection wasn't right).
This goes back to my understanding that tcache is user visible.

-rohit

-
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/