Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 25496
b: refs/heads/master
c: ba6edfc
h: refs/heads/master
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Apr 11, 2006
1 parent 9402947 commit 62ea96d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5246d0503130fa58904c8beb987fcf93b96d8ab6
refs/heads/master: ba6edfcd1708da2e665f14eee76e87f39448ec40
29 changes: 19 additions & 10 deletions trunk/kernel/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,10 @@ struct tvec_t_base_s {
} ____cacheline_aligned_in_smp;

typedef struct tvec_t_base_s tvec_base_t;
static DEFINE_PER_CPU(tvec_base_t *, tvec_bases);

tvec_base_t boot_tvec_bases;
EXPORT_SYMBOL(boot_tvec_bases);
static DEFINE_PER_CPU(tvec_base_t *, tvec_bases) = { &boot_tvec_bases };

static inline void set_running_timer(tvec_base_t *base,
struct timer_list *timer)
Expand Down Expand Up @@ -1224,28 +1225,36 @@ static int __devinit init_timers_cpu(int cpu)
{
int j;
tvec_base_t *base;
static char __devinitdata tvec_base_done[NR_CPUS];

base = per_cpu(tvec_bases, cpu);
if (!base) {
if (!tvec_base_done[cpu]) {
static char boot_done;

/*
* Cannot do allocation in init_timers as that runs before the
* allocator initializes (and would waste memory if there are
* more possible CPUs than will ever be installed/brought up).
*/
if (boot_done) {
/*
* The APs use this path later in boot
*/
base = kmalloc_node(sizeof(*base), GFP_KERNEL,
cpu_to_node(cpu));
if (!base)
return -ENOMEM;
memset(base, 0, sizeof(*base));
per_cpu(tvec_bases, cpu) = base;
} else {
base = &boot_tvec_bases;
/*
* This is for the boot CPU - we use compile-time
* static initialisation because per-cpu memory isn't
* ready yet and because the memory allocators are not
* initialised either.
*/
boot_done = 1;
base = &boot_tvec_bases;
}
per_cpu(tvec_bases, cpu) = base;
tvec_base_done[cpu] = 1;
} else {
base = per_cpu(tvec_bases, cpu);
}

spin_lock_init(&base->lock);
for (j = 0; j < TVN_SIZE; j++) {
INIT_LIST_HEAD(base->tv5.vec + j);
Expand Down

0 comments on commit 62ea96d

Please sign in to comment.