Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200563
b: refs/heads/master
c: 9983b6f
h: refs/heads/master
i:
  200561: 84dc558
  200559: f916c81
v: v3
  • Loading branch information
Tejun Heo committed Jun 18, 2010
1 parent e024ca9 commit 3f86131
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 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: a92d3ff9e5dbd958d8008a3e7a573e988e370ca3
refs/heads/master: 9983b6f0cf8263e51bcf4c8a9dc0c1ef175b3c60
31 changes: 28 additions & 3 deletions trunk/mm/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ static int __maybe_unused pcpu_page_idx(unsigned int cpu, int page_idx)
return pcpu_unit_map[cpu] * pcpu_unit_pages + page_idx;
}

static unsigned long __maybe_unused pcpu_chunk_addr(struct pcpu_chunk *chunk,
unsigned int cpu, int page_idx)
static unsigned long pcpu_chunk_addr(struct pcpu_chunk *chunk,
unsigned int cpu, int page_idx)
{
return (unsigned long)chunk->base_addr + pcpu_unit_offsets[cpu] +
(page_idx << PAGE_SHIFT);
Expand Down Expand Up @@ -978,7 +978,32 @@ bool is_kernel_percpu_address(unsigned long addr)
*/
phys_addr_t per_cpu_ptr_to_phys(void *addr)
{
if (pcpu_addr_in_first_chunk(addr)) {
void __percpu *base = __addr_to_pcpu_ptr(pcpu_base_addr);
bool in_first_chunk = false;
unsigned long first_start, first_end;
unsigned int cpu;

/*
* The following test on first_start/end isn't strictly
* necessary but will speed up lookups of addresses which
* aren't in the first chunk.
*/
first_start = pcpu_chunk_addr(pcpu_first_chunk, pcpu_first_unit_cpu, 0);
first_end = pcpu_chunk_addr(pcpu_first_chunk, pcpu_last_unit_cpu,
pcpu_unit_pages);
if ((unsigned long)addr >= first_start &&
(unsigned long)addr < first_end) {
for_each_possible_cpu(cpu) {
void *start = per_cpu_ptr(base, cpu);

if (addr >= start && addr < start + pcpu_unit_size) {
in_first_chunk = true;
break;
}
}
}

if (in_first_chunk) {
if ((unsigned long)addr < VMALLOC_START ||
(unsigned long)addr >= VMALLOC_END)
return __pa(addr);
Expand Down

0 comments on commit 3f86131

Please sign in to comment.