Skip to contentSkip to conversation

+ clocksource-add-generic-sched_clock.patch added to -mm tree

DISCUSSION Thomas Gleixner 3 participants 20 messages Oct 8, 2006 – Oct 9, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 3 lines · On Fri, 2006-10-06 at 18:53 -0700, [email protected] wrote:

Adds a generic sched_clock, along with a boot time override for the scheduler clocksource (sched_clocksource). Hopefully the config option would eventually be removed.

Again, this belongs into the clocksource code and not into sched.c

Your patch series scatters clock source related code snippets all over the place. This becomes simply a maintenance nightmare.

tglx

#2 lore raw
Quoted 9 lines · Thomas Gleixner
Quoted 3 lines · On Fri, 2006-10-06 at 18:53 -0700, [email protected] wrote:

Adds a generic sched_clock, along with a boot time override for the scheduler clocksource (sched_clocksource). Hopefully the config option would eventually be removed.

Again, this belongs into the clocksource code and not into sched.c

Your patch series scatters clock source related code snippets all over the place. This becomes simply a maintenance nightmare.

It's an API, it's suppose to be used in different places.

Daniel

#3 lore raw
Quoted 6 lines · Daniel Walker
Quoted 5 lines · Thomas Gleixner
Quoted 3 lines · On Fri, 2006-10-06 at 18:53 -0700, [email protected] wrote:

Adds a generic sched_clock, along with a boot time override for the scheduler clocksource (sched_clocksource). Hopefully the config option would eventually be removed.

Quoted 6 lines
Quoted 4 lines

Again, this belongs into the clocksource code and not into sched.c

Your patch series scatters clock source related code snippets all over the place. This becomes simply a maintenance nightmare.

It's an API, it's suppose to be used in different places.

Err. clocksource is an API and it is supposed to be at a place, where clocksource code is.

sched_clock is a user of the clocksource API and there is absolutely no reason to put that into sched.c

tglx

#4 lore raw
Quoted 9 lines · Thomas Gleixner
Quoted 8 lines · Daniel Walker
Quoted 7 lines · Thomas Gleixner
Quoted 3 lines · On Fri, 2006-10-06 at 18:53 -0700, [email protected] wrote:

Adds a generic sched_clock, along with a boot time override for the scheduler clocksource (sched_clocksource). Hopefully the config option would eventually be removed.

Again, this belongs into the clocksource code and not into sched.c

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Your patch series scatters clock source related code snippets all over the place. This becomes simply a maintenance nightmare.

It's an API, it's suppose to be used in different places.

Err. clocksource is an API and it is supposed to be at a place, where clocksource code is.

Agreed on this.

Quoted 2 lines

sched_clock is a user of the clocksource API and there is absolutely no reason to put that into sched.c

We could do something like kernel/time/sched_clock.c ? I really don't like the idea of stuff sched_clock() , and timekeeping back into clocksource.

Daniel

#5 lore raw
Quoted 6 lines · Daniel Walker
Quoted 2 lines

sched_clock is a user of the clocksource API and there is absolutely no reason to put that into sched.c

We could do something like kernel/time/sched_clock.c ? I really don't like the idea of stuff sched_clock() , and timekeeping back into clocksource.

Do we really want 3 files which each has 50 lines of code ? Although it's better than pushing that stuff into sched.c and timer.c. timer.c is enough mess and we really do not want to add more.

tglx

#6 lore raw
Quoted 11 lines · Thomas Gleixner
Quoted 6 lines · Daniel Walker
Quoted 2 lines

sched_clock is a user of the clocksource API and there is absolutely no reason to put that into sched.c

We could do something like kernel/time/sched_clock.c ? I really don't like the idea of stuff sched_clock() , and timekeeping back into clocksource.

Do we really want 3 files which each has 50 lines of code ? Although it's better than pushing that stuff into sched.c and timer.c. timer.c is enough mess and we really do not want to add more.

I think John's plan, and my plan, is to move the generic time bits, plus the timekeeping specific clocksource stuff, into a different file. kernel/timer.c shouldn't have that stuff anyway. That's about 250 lines, the part of that which is due to the clocksource is about 100 lines.

Are you thinking that this interface is only likely to have one or two users?

Daniel

#7 lore raw
Quoted 13 lines · Daniel Walker
Quoted 11 lines · Thomas Gleixner
Quoted 6 lines · Daniel Walker
Quoted 2 lines

sched_clock is a user of the clocksource API and there is absolutely no reason to put that into sched.c

We could do something like kernel/time/sched_clock.c ? I really don't like the idea of stuff sched_clock() , and timekeeping back into clocksource.

Do we really want 3 files which each has 50 lines of code ? Although it's better than pushing that stuff into sched.c and timer.c. timer.c is enough mess and we really do not want to add more.

Quoted 7 lines

I think John's plan, and my plan, is to move the generic time bits, plus the timekeeping specific clocksource stuff, into a different file. kernel/timer.c shouldn't have that stuff anyway. That's about 250 lines, the part of that which is due to the clocksource is about 100 lines.

Are you thinking that this interface is only likely to have one or two users?

Probably. Anyway, can we just keep the stuff in clocksource.c right now ?

The sched stuff is really not worth a seperate file and the timekeeping bits might move into kernel/time/timeofday.c once everone is happy to move the timekeeping code out of timer.c

tglx

#8 lore raw
Quoted 2 lines · Thomas Gleixner

Probably. Anyway, can we just keep the stuff in clocksource.c right now ?

I suppose I can move the sched_clock stuff.

Quoted 3 lines

The sched stuff is really not worth a seperate file and the timekeeping bits might move into kernel/time/timeofday.c once everone is happy to move the timekeeping code out of timer.c

Ok.

Daniel

#9 lore raw
Quoted 6 lines · Daniel Walker
Quoted 2 lines · Thomas Gleixner

Probably. Anyway, can we just keep the stuff in clocksource.c right now ?

I suppose I can move the sched_clock stuff.

And keep the code you wanted to move into timer.c too.

tglx

#10 lore raw
Quoted 9 lines · Thomas Gleixner
Quoted 6 lines · Daniel Walker
Quoted 2 lines · Thomas Gleixner

Probably. Anyway, can we just keep the stuff in clocksource.c right now ?

I suppose I can move the sched_clock stuff.

And keep the code you wanted to move into timer.c too.

I'm not moving the kernel/timer.c clocksource user back into kernel/time/clocksource.c . That code completely belongs with the generic time of day changes. The code is directly coupled, and in fact it improves the timekeeping clock switching code to have it that way.

I'd be happy to create kernel/time/timeofday.c though .

Daniel

#11 lore raw
Quoted 7 lines · Daniel Walker
Quoted 6 lines · Thomas Gleixner
Quoted 5 lines · Daniel Walker
Quoted 2 lines · Thomas Gleixner

Probably. Anyway, can we just keep the stuff in clocksource.c right now ?

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

I suppose I can move the sched_clock stuff.

And keep the code you wanted to move into timer.c too.

I'm not moving the kernel/timer.c clocksource user back into kernel/time/clocksource.c . That code completely belongs with the generic time of day changes. The code is directly coupled, and in fact it improves the timekeeping clock switching code to have it that way.

I don't see any reason, why it must be added to timer.c. You can achieve the same result with calling the code outside, except that the compiler might miss some inline optimization. The switch clock code is not a hotpath and so it does not matter whether it is called here or there.

Quoted 1 line

I'd be happy to create kernel/time/timeofday.c though .

Then please get an agreement with John and Roman, so we can move it now.

tglx

#12 lore raw
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines

I'm not moving the kernel/timer.c clocksource user back into kernel/time/clocksource.c . That code completely belongs with the generic time of day changes. The code is directly coupled, and in fact it improves the timekeeping clock switching code to have it that way.

I don't see any reason, why it must be added to timer.c. You can achieve the same result with calling the code outside, except that the compiler might miss some inline optimization. The switch clock code is not a hotpath and so it does not matter whether it is called here or there.

It wouldn't be as clean to integrate the two. The hotpath is improved (which is what I was referring too above.)

Daniel

#13 lore raw
Quoted 7 lines · Daniel Walker
Quoted 5 lines · Thomas Gleixner
Quoted 4 lines

I'm not moving the kernel/timer.c clocksource user back into kernel/time/clocksource.c . That code completely belongs with the generic time of day changes. The code is directly coupled, and in fact it improves the timekeeping clock switching code to have it that way.

Quoted 7 lines
Quoted 4 lines

I don't see any reason, why it must be added to timer.c. You can achieve the same result with calling the code outside, except that the compiler might miss some inline optimization. The switch clock code is not a hotpath and so it does not matter whether it is called here or there.

It wouldn't be as clean to integrate the two. The hotpath is improved (which is what I was referring too above.)

Sorry, where is which hotpath improved ?

tglx

#14 lore raw
Quoted 13 lines · Thomas Gleixner
Quoted 12 lines · Daniel Walker
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines

I'm not moving the kernel/timer.c clocksource user back into kernel/time/clocksource.c . That code completely belongs with the generic time of day changes. The code is directly coupled, and in fact it improves the timekeeping clock switching code to have it that way.

I don't see any reason, why it must be added to timer.c. You can achieve the same result with calling the code outside, except that the compiler might miss some inline optimization. The switch clock code is not a hotpath and so it does not matter whether it is called here or there.

Quoted 4 lines
Quoted 2 lines

It wouldn't be as clean to integrate the two. The hotpath is improved (which is what I was referring too above.)

Sorry, where is which hotpath improved ?

The hotpath in update_wall_time() kernel/timer.c which involves clock switching.

Daniel

#15 lore raw
Quoted 14 lines · Daniel Walker
Quoted 13 lines · Thomas Gleixner
Quoted 12 lines · Daniel Walker
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines

I'm not moving the kernel/timer.c clocksource user back into kernel/time/clocksource.c . That code completely belongs with the generic time of day changes. The code is directly coupled, and in fact it improves the timekeeping clock switching code to have it that way.

I don't see any reason, why it must be added to timer.c. You can achieve the same result with calling the code outside, except that the compiler might miss some inline optimization. The switch clock code is not a hotpath and so it does not matter whether it is called here or there.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

It wouldn't be as clean to integrate the two. The hotpath is improved (which is what I was referring too above.)

Sorry, where is which hotpath improved ?

The hotpath in update_wall_time() kernel/timer.c which involves clock switching.

And why the heck does this require to move _clocksource_ related code including sysfs hackery into timer.c ? Your improvement works with extern code as well.

tglx

#16 lore raw
Quoted 18 lines · Thomas Gleixner
Quoted 17 lines · Daniel Walker
Quoted 16 lines · Thomas Gleixner
Quoted 14 lines · Daniel Walker
Quoted 9 lines · Thomas Gleixner
Quoted 4 lines

I'm not moving the kernel/timer.c clocksource user back into kernel/time/clocksource.c . That code completely belongs with the generic time of day changes. The code is directly coupled, and in fact it improves the timekeeping clock switching code to have it that way.

I don't see any reason, why it must be added to timer.c. You can achieve the same result with calling the code outside, except that the compiler might miss some inline optimization. The switch clock code is not a hotpath and so it does not matter whether it is called here or there.

It wouldn't be as clean to integrate the two. The hotpath is improved (which is what I was referring too above.)

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Sorry, where is which hotpath improved ?

The hotpath in update_wall_time() kernel/timer.c which involves clock switching.

And why the heck does this require to move _clocksource_ related code including sysfs hackery into timer.c ? Your improvement works with extern code as well.

There are no clocksource internals added by me. There is a exposed clocksource API which is all that is used.

The design of the original clocksource interface was specific for timekeeping. What I did was modified it to be used by more than just timekeeping.

If I add tons of externs there and cram all that into clocksource.c , that would just be a mess. Then we're tending back to the original clocksource design when it's designed just for time keeping.

Daniel

#17 lore raw
Quoted 6 lines · Daniel Walker
Quoted 3 lines

And why the heck does this require to move _clocksource_ related code including sysfs hackery into timer.c ? Your improvement works with extern code as well.

There are no clocksource internals added by me. There is a exposed clocksource API which is all that is used.

You move tons of code into timer.c, which does not belong there. clocksource is a different thing than timekeeping. timekeeping makes use of clocksources, and your extra layer of timekeeping_clocksource API does not change that at all. What you call abstraction is just an artificial extra layer, as it is intrinsically tied to the clocksource core.

Quoted 7 lines

The design of the original clocksource interface was specific for timekeeping. What I did was modified it to be used by more than just timekeeping.

If I add tons of externs there and cram all that into clocksource.c , that would just be a mess. Then we're tending back to the original clocksource design when it's designed just for time keeping.

Tons of externs for the optimization of the clock source switch? Sorry, I'm not following.

The clock source switch happens once or twice during bootup and the replacement of a call with an atomic check does not in any way legitimate the move of code into timer.c. The number of cylces saved is not impressing. Moving the clock source switch out of that path at all would be progress and save real cylces.
.
The maintainability of code has to weighed carefully against some obscure cylce savings.

tglx

#18 lore raw
Quoted 8 lines · Thomas Gleixner
Quoted 6 lines · Daniel Walker
Quoted 3 lines

And why the heck does this require to move _clocksource_ related code including sysfs hackery into timer.c ? Your improvement works with extern code as well.

There are no clocksource internals added by me. There is a exposed clocksource API which is all that is used.

Quoted 6 lines

You move tons of code into timer.c, which does not belong there. clocksource is a different thing than timekeeping. timekeeping makes use of clocksources, and your extra layer of timekeeping_clocksource API does not change that at all. What you call abstraction is just an artificial extra layer, as it is intrinsically tied to the clocksource core.

I think that code does belong there. Yes clocksources and timekeeping are different. Which is the point of the patch set.

htimers is intrinsically connected to time keeping, but they aren't housed in the same files. Just because one subsystem uses another doesn't mean they shouldn't be organized/optimized/maintained on their own.

Quoted 11 lines
Quoted 7 lines

The design of the original clocksource interface was specific for timekeeping. What I did was modified it to be used by more than just timekeeping.

If I add tons of externs there and cram all that into clocksource.c , that would just be a mess. Then we're tending back to the original clocksource design when it's designed just for time keeping.

Tons of externs for the optimization of the clock source switch? Sorry, I'm not following.

Quoted 6 lines

The clock source switch happens once or twice during bootup and the replacement of a call with an atomic check does not in any way legitimate the move of code into timer.c. The number of cylces saved is not impressing. Moving the clock source switch out of that path at all would be progress and save real cylces.
.

Moving the code is a separation issue. I _could_ move it back, but you haven't convinced me that it wins anything. In fact you've convinced me that it would be a step back instead of forward.

Quoted 2 lines

The maintainability of code has to weighed carefully against some obscure cylce savings.

It's not less maintainable now, or if it is your going to have to be a lot more specific.

Daniel

#19 lore raw
Quoted 9 lines · Daniel Walker
Quoted 6 lines

You move tons of code into timer.c, which does not belong there. clocksource is a different thing than timekeeping. timekeeping makes use of clocksources, and your extra layer of timekeeping_clocksource API does not change that at all. What you call abstraction is just an artificial extra layer, as it is intrinsically tied to the clocksource core.

I think that code does belong there. Yes clocksources and timekeeping are different. Which is the point of the patch set.

And I have to accept that you think, that the code belongs there ?

Quoted 2 lines

It's not less maintainable now, or if it is your going to have to be a lot more specific.

In order to satisfy your idea of abstraction, you add glue code to make it work:

clocksource.c:

Review

Quoted 5 lines
(quoted diff) +5 -0
+int clocksource_sysfs_register(struct sysdev_attribute * attr)
+{
+       return sysdev_create_file(&device_clocksource, attr);
+}
+

timer.c:

Review

Quoted 3 lines
(quoted diff) +3 -0
+
+#ifdef CONFIG_GENERIC_TIME
+       clocksource_sysfs_register(&attr_timeofday_clocksource);

Abstractions are good in general, but this is artificial for no benefit.

You claim, that you optmize update_wll_time()

Quoted 14 lines
        /* check to see if there is a new clocksource to use */
(quoted diff) +11 -1
-       if (change_clocksource()) {
+       if (unlikely(atomic_read(&clock_check))) {
+
+               /*
+                * Switch to the new override clock, or the highest
+                * rated clock.
+                */
+               if (*clock_override_name)
+                       change_clocksource(clock_override_name);
+               else
+                       change_clocksource(NULL);
+
                clock->error = 0;

Review

Quoted 10 lines
(quoted diff) +6 -0
                clock->xtime_nsec = 0;
                hrtimer_clock_notify();
                clocksource_calculate_interval(clock, tick_nsec);
+
+               /*
+                * Remove the change signal
+                */
+               atomic_dec(&clock_check);
+
        }

Well, I guess I have some perceptional disturbance. What exactly is the optimization ? Pushing clock_override_name into that code path ? As I said before, the performance difference of change_clocksource() and atomic_read() is not big enough to justify the mess you create all over the place.

The whole notifier business is not necessary, if you keep the clocksource related code in one place.

You break sched_clock on x86 for no good reason.

tglx

#20 lore raw
In reply to Thomas Gleixner
Quoted 9 lines · Thomas Gleixner
Quoted 3 lines · On Fri, 2006-10-06 at 18:53 -0700, [email protected] wrote:

Adds a generic sched_clock, along with a boot time override for the scheduler clocksource (sched_clocksource). Hopefully the config option would eventually be removed.

Again, this belongs into the clocksource code and not into sched.c

Your patch series scatters clock source related code snippets all over the place. This becomes simply a maintenance nightmare.

seconded.

Ingo