Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
7c526e1f
Commit
7c526e1f
authored
Mar 26, 2009
by
Ingo Molnar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branches 'timers/new-apis', 'timers/ntp' and 'timers/urgent' into timers/core
parents
e8684605
74019224
a2a5ac86
37bebc70
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
357 additions
and
234 deletions
+357
-234
arch/powerpc/platforms/cell/spufs/sched.c
arch/powerpc/platforms/cell/spufs/sched.c
+1
-1
drivers/infiniband/hw/ipath/ipath_driver.c
drivers/infiniband/hw/ipath/ipath_driver.c
+3
-3
include/linux/timer.h
include/linux/timer.h
+2
-20
include/linux/timex.h
include/linux/timex.h
+1
-1
kernel/posix-cpu-timers.c
kernel/posix-cpu-timers.c
+2
-1
kernel/relay.c
kernel/relay.c
+1
-1
kernel/time/ntp.c
kernel/time/ntp.c
+274
-170
kernel/timer.c
kernel/timer.c
+73
-37
No files found.
arch/powerpc/platforms/cell/spufs/sched.c
View file @
7c526e1f
...
...
@@ -508,7 +508,7 @@ static void __spu_add_to_rq(struct spu_context *ctx)
list_add_tail
(
&
ctx
->
rq
,
&
spu_prio
->
runq
[
ctx
->
prio
]);
set_bit
(
ctx
->
prio
,
spu_prio
->
bitmap
);
if
(
!
spu_prio
->
nr_waiting
++
)
__
mod_timer
(
&
spusched_timer
,
jiffies
+
SPUSCHED_TICK
);
mod_timer
(
&
spusched_timer
,
jiffies
+
SPUSCHED_TICK
);
}
}
...
...
drivers/infiniband/hw/ipath/ipath_driver.c
View file @
7c526e1f
...
...
@@ -2715,7 +2715,7 @@ static void ipath_hol_signal_up(struct ipath_devdata *dd)
* to prevent HoL blocking, then start the HoL timer that
* periodically continues, then stop procs, so they can detect
* link down if they want, and do something about it.
* Timer may already be running, so use
__
mod_timer, not add_timer.
* Timer may already be running, so use mod_timer, not add_timer.
*/
void
ipath_hol_down
(
struct
ipath_devdata
*
dd
)
{
...
...
@@ -2724,7 +2724,7 @@ void ipath_hol_down(struct ipath_devdata *dd)
dd
->
ipath_hol_next
=
IPATH_HOL_DOWNCONT
;
dd
->
ipath_hol_timer
.
expires
=
jiffies
+
msecs_to_jiffies
(
ipath_hol_timeout_ms
);
__
mod_timer
(
&
dd
->
ipath_hol_timer
,
dd
->
ipath_hol_timer
.
expires
);
mod_timer
(
&
dd
->
ipath_hol_timer
,
dd
->
ipath_hol_timer
.
expires
);
}
/*
...
...
@@ -2763,7 +2763,7 @@ void ipath_hol_event(unsigned long opaque)
else
{
dd
->
ipath_hol_timer
.
expires
=
jiffies
+
msecs_to_jiffies
(
ipath_hol_timeout_ms
);
__
mod_timer
(
&
dd
->
ipath_hol_timer
,
mod_timer
(
&
dd
->
ipath_hol_timer
,
dd
->
ipath_hol_timer
.
expires
);
}
}
...
...
include/linux/timer.h
View file @
7c526e1f
...
...
@@ -86,8 +86,8 @@ static inline int timer_pending(const struct timer_list * timer)
extern
void
add_timer_on
(
struct
timer_list
*
timer
,
int
cpu
);
extern
int
del_timer
(
struct
timer_list
*
timer
);
extern
int
__mod_timer
(
struct
timer_list
*
timer
,
unsigned
long
expires
);
extern
int
mod_timer
(
struct
timer_list
*
timer
,
unsigned
long
expires
);
extern
int
mod_timer_pending
(
struct
timer_list
*
timer
,
unsigned
long
expires
);
/*
* The jiffies value which is added to now, when there is no timer
...
...
@@ -146,25 +146,7 @@ static inline void timer_stats_timer_clear_start_info(struct timer_list *timer)
}
#endif
/**
* add_timer - start a timer
* @timer: the timer to be added
*
* The kernel will do a ->function(->data) callback from the
* timer interrupt at the ->expires point in the future. The
* current time is 'jiffies'.
*
* The timer's ->expires, ->function (and if the handler uses it, ->data)
* fields must be set prior calling this function.
*
* Timers with an ->expires field in the past will be executed in the next
* timer tick.
*/
static
inline
void
add_timer
(
struct
timer_list
*
timer
)
{
BUG_ON
(
timer_pending
(
timer
));
__mod_timer
(
timer
,
timer
->
expires
);
}
extern
void
add_timer
(
struct
timer_list
*
timer
);
#ifdef CONFIG_SMP
extern
int
try_to_del_timer_sync
(
struct
timer_list
*
timer
);
...
...
include/linux/timex.h
View file @
7c526e1f
...
...
@@ -190,7 +190,7 @@ struct timex {
* offset and maximum frequency tolerance.
*/
#define SHIFT_USEC 16
/* frequency offset scale (shift) */
#define PPM_SCALE (NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
#define PPM_SCALE (
(s64)
NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
#define PPM_SCALE_INV_SHIFT 19
#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
PPM_SCALE + 1)
...
...
kernel/posix-cpu-timers.c
View file @
7c526e1f
...
...
@@ -1370,7 +1370,8 @@ static inline int fastpath_timer_check(struct task_struct *tsk)
if
(
task_cputime_expired
(
&
group_sample
,
&
sig
->
cputime_expires
))
return
1
;
}
return
0
;
return
sig
->
rlim
[
RLIMIT_CPU
].
rlim_cur
!=
RLIM_INFINITY
;
}
/*
...
...
kernel/relay.c
View file @
7c526e1f
...
...
@@ -750,7 +750,7 @@ size_t relay_switch_subbuf(struct rchan_buf *buf, size_t length)
* from the scheduler (trying to re-grab
* rq->lock), so defer it.
*/
__
mod_timer
(
&
buf
->
timer
,
jiffies
+
1
);
mod_timer
(
&
buf
->
timer
,
jiffies
+
1
);
}
old
=
buf
->
data
;
...
...
kernel/time/ntp.c
View file @
7c526e1f
This diff is collapsed.
Click to expand it.
kernel/timer.c
View file @
7c526e1f
...
...
@@ -589,11 +589,14 @@ static struct tvec_base *lock_timer_base(struct timer_list *timer,
}
}
int
__mod_timer
(
struct
timer_list
*
timer
,
unsigned
long
expires
)
static
inline
int
__mod_timer
(
struct
timer_list
*
timer
,
unsigned
long
expires
,
bool
pending_only
)
{
struct
tvec_base
*
base
,
*
new_base
;
unsigned
long
flags
;
int
ret
=
0
;
int
ret
;
ret
=
0
;
timer_stats_timer_set_start_info
(
timer
);
BUG_ON
(
!
timer
->
function
);
...
...
@@ -603,6 +606,9 @@ int __mod_timer(struct timer_list *timer, unsigned long expires)
if
(
timer_pending
(
timer
))
{
detach_timer
(
timer
,
0
);
ret
=
1
;
}
else
{
if
(
pending_only
)
goto
out_unlock
;
}
debug_timer_activate
(
timer
);
...
...
@@ -629,42 +635,28 @@ int __mod_timer(struct timer_list *timer, unsigned long expires)
timer
->
expires
=
expires
;
internal_add_timer
(
base
,
timer
);
out_unlock:
spin_unlock_irqrestore
(
&
base
->
lock
,
flags
);
return
ret
;
}
EXPORT_SYMBOL
(
__mod_timer
);
/**
*
add_timer_on - start a timer on a particular CPU
* @timer: the
timer to be add
ed
* @
cpu: the CPU to start it on
*
mod_timer_pending - modify a pending timer's timeout
* @timer: the
pending timer to be modifi
ed
* @
expires: new timeout in jiffies
*
* This is not very scalable on SMP. Double adds are not possible.
* mod_timer_pending() is the same for pending timers as mod_timer(),
* but will not re-activate and modify already deleted timers.
*
* It is useful for unserialized use of timers.
*/
void
add_timer_on
(
struct
timer_list
*
timer
,
int
cpu
)
int
mod_timer_pending
(
struct
timer_list
*
timer
,
unsigned
long
expires
)
{
struct
tvec_base
*
base
=
per_cpu
(
tvec_bases
,
cpu
);
unsigned
long
flags
;
timer_stats_timer_set_start_info
(
timer
);
BUG_ON
(
timer_pending
(
timer
)
||
!
timer
->
function
);
spin_lock_irqsave
(
&
base
->
lock
,
flags
);
timer_set_base
(
timer
,
base
);
debug_timer_activate
(
timer
);
internal_add_timer
(
base
,
timer
);
/*
* Check whether the other CPU is idle and needs to be
* triggered to reevaluate the timer wheel when nohz is
* active. We are protected against the other CPU fiddling
* with the timer by holding the timer base lock. This also
* makes sure that a CPU on the way to idle can not evaluate
* the timer wheel.
*/
wake_up_idle_cpu
(
cpu
);
spin_unlock_irqrestore
(
&
base
->
lock
,
flags
);
return
__mod_timer
(
timer
,
expires
,
true
);
}
EXPORT_SYMBOL
(
mod_timer_pending
);
/**
* mod_timer - modify a timer's timeout
...
...
@@ -688,9 +680,6 @@ void add_timer_on(struct timer_list *timer, int cpu)
*/
int
mod_timer
(
struct
timer_list
*
timer
,
unsigned
long
expires
)
{
BUG_ON
(
!
timer
->
function
);
timer_stats_timer_set_start_info
(
timer
);
/*
* This is a common optimization triggered by the
* networking code - if the timer is re-modified
...
...
@@ -699,11 +688,61 @@ int mod_timer(struct timer_list *timer, unsigned long expires)
if
(
timer
->
expires
==
expires
&&
timer_pending
(
timer
))
return
1
;
return
__mod_timer
(
timer
,
expires
);
return
__mod_timer
(
timer
,
expires
,
false
);
}
EXPORT_SYMBOL
(
mod_timer
);
/**
* add_timer - start a timer
* @timer: the timer to be added
*
* The kernel will do a ->function(->data) callback from the
* timer interrupt at the ->expires point in the future. The
* current time is 'jiffies'.
*
* The timer's ->expires, ->function (and if the handler uses it, ->data)
* fields must be set prior calling this function.
*
* Timers with an ->expires field in the past will be executed in the next
* timer tick.
*/
void
add_timer
(
struct
timer_list
*
timer
)
{
BUG_ON
(
timer_pending
(
timer
));
mod_timer
(
timer
,
timer
->
expires
);
}
EXPORT_SYMBOL
(
add_timer
);
/**
* add_timer_on - start a timer on a particular CPU
* @timer: the timer to be added
* @cpu: the CPU to start it on
*
* This is not very scalable on SMP. Double adds are not possible.
*/
void
add_timer_on
(
struct
timer_list
*
timer
,
int
cpu
)
{
struct
tvec_base
*
base
=
per_cpu
(
tvec_bases
,
cpu
);
unsigned
long
flags
;
timer_stats_timer_set_start_info
(
timer
);
BUG_ON
(
timer_pending
(
timer
)
||
!
timer
->
function
);
spin_lock_irqsave
(
&
base
->
lock
,
flags
);
timer_set_base
(
timer
,
base
);
debug_timer_activate
(
timer
);
internal_add_timer
(
base
,
timer
);
/*
* Check whether the other CPU is idle and needs to be
* triggered to reevaluate the timer wheel when nohz is
* active. We are protected against the other CPU fiddling
* with the timer by holding the timer base lock. This also
* makes sure that a CPU on the way to idle can not evaluate
* the timer wheel.
*/
wake_up_idle_cpu
(
cpu
);
spin_unlock_irqrestore
(
&
base
->
lock
,
flags
);
}
/**
* del_timer - deactive a timer.
* @timer: the timer to be deactivated
...
...
@@ -733,7 +772,6 @@ int del_timer(struct timer_list *timer)
return
ret
;
}
EXPORT_SYMBOL
(
del_timer
);
#ifdef CONFIG_SMP
...
...
@@ -767,7 +805,6 @@ out:
return
ret
;
}
EXPORT_SYMBOL
(
try_to_del_timer_sync
);
/**
...
...
@@ -796,7 +833,6 @@ int del_timer_sync(struct timer_list *timer)
cpu_relax
();
}
}
EXPORT_SYMBOL
(
del_timer_sync
);
#endif
...
...
@@ -1268,7 +1304,7 @@ signed long __sched schedule_timeout(signed long timeout)
expire
=
timeout
+
jiffies
;
setup_timer_on_stack
(
&
timer
,
process_timeout
,
(
unsigned
long
)
current
);
__mod_timer
(
&
timer
,
expire
);
__mod_timer
(
&
timer
,
expire
,
false
);
schedule
();
del_singleshot_timer_sync
(
&
timer
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment