diff options
| author | Jeff Garzik <jgarzik@pretzel.yyz.us> | 2005-06-26 23:42:30 -0400 | 
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-06-26 23:42:30 -0400 | 
| commit | f45727d52d1581e9ff4df9d1a12a60789ad2d1eb (patch) | |
| tree | 773ae25f98542e6d382c688f7e85e8137d065614 /drivers/oprofile/buffer_sync.c | |
| parent | 4c925f452cfd16c690209e96821ee094e09a2404 (diff) | |
| parent | 5696c1944a33b4434a9a1ebb6383b906afd43a10 (diff) | |
Merge /spare/repo/netdev-2.6/ branch 'ieee80211'
Diffstat (limited to 'drivers/oprofile/buffer_sync.c')
| -rw-r--r-- | drivers/oprofile/buffer_sync.c | 33 | 
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c index 55720dc6ec43..531b07313141 100644 --- a/drivers/oprofile/buffer_sync.c +++ b/drivers/oprofile/buffer_sync.c  | |||
| @@ -62,7 +62,7 @@ static int task_exit_notify(struct notifier_block * self, unsigned long val, voi | |||
| 62 | /* To avoid latency problems, we only process the current CPU, | 62 | /* To avoid latency problems, we only process the current CPU, | 
| 63 | * hoping that most samples for the task are on this CPU | 63 | * hoping that most samples for the task are on this CPU | 
| 64 | */ | 64 | */ | 
| 65 | sync_buffer(_smp_processor_id()); | 65 | sync_buffer(raw_smp_processor_id()); | 
| 66 | return 0; | 66 | return 0; | 
| 67 | } | 67 | } | 
| 68 | 68 | ||
| @@ -86,7 +86,7 @@ static int munmap_notify(struct notifier_block * self, unsigned long val, void * | |||
| 86 | /* To avoid latency problems, we only process the current CPU, | 86 | /* To avoid latency problems, we only process the current CPU, | 
| 87 | * hoping that most samples for the task are on this CPU | 87 | * hoping that most samples for the task are on this CPU | 
| 88 | */ | 88 | */ | 
| 89 | sync_buffer(_smp_processor_id()); | 89 | sync_buffer(raw_smp_processor_id()); | 
| 90 | return 0; | 90 | return 0; | 
| 91 | } | 91 | } | 
| 92 | 92 | ||
| @@ -206,7 +206,7 @@ static inline unsigned long fast_get_dcookie(struct dentry * dentry, | |||
| 206 | */ | 206 | */ | 
| 207 | static unsigned long get_exec_dcookie(struct mm_struct * mm) | 207 | static unsigned long get_exec_dcookie(struct mm_struct * mm) | 
| 208 | { | 208 | { | 
| 209 | unsigned long cookie = 0; | 209 | unsigned long cookie = NO_COOKIE; | 
| 210 | struct vm_area_struct * vma; | 210 | struct vm_area_struct * vma; | 
| 211 | 211 | ||
| 212 | if (!mm) | 212 | if (!mm) | 
| @@ -234,35 +234,42 @@ out: | |||
| 234 | */ | 234 | */ | 
| 235 | static unsigned long lookup_dcookie(struct mm_struct * mm, unsigned long addr, off_t * offset) | 235 | static unsigned long lookup_dcookie(struct mm_struct * mm, unsigned long addr, off_t * offset) | 
| 236 | { | 236 | { | 
| 237 | unsigned long cookie = 0; | 237 | unsigned long cookie = NO_COOKIE; | 
| 238 | struct vm_area_struct * vma; | 238 | struct vm_area_struct * vma; | 
| 239 | 239 | ||
| 240 | for (vma = find_vma(mm, addr); vma; vma = vma->vm_next) { | 240 | for (vma = find_vma(mm, addr); vma; vma = vma->vm_next) { | 
| 241 | 241 | ||
| 242 | if (!vma->vm_file) | ||
| 243 | continue; | ||
| 244 | |||
| 245 | if (addr < vma->vm_start || addr >= vma->vm_end) | 242 | if (addr < vma->vm_start || addr >= vma->vm_end) | 
| 246 | continue; | 243 | continue; | 
| 247 | 244 | ||
| 248 | cookie = fast_get_dcookie(vma->vm_file->f_dentry, | 245 | if (vma->vm_file) { | 
| 249 | vma->vm_file->f_vfsmnt); | 246 | cookie = fast_get_dcookie(vma->vm_file->f_dentry, | 
| 250 | *offset = (vma->vm_pgoff << PAGE_SHIFT) + addr - vma->vm_start; | 247 | vma->vm_file->f_vfsmnt); | 
| 248 | *offset = (vma->vm_pgoff << PAGE_SHIFT) + addr - | ||
| 249 | vma->vm_start; | ||
| 250 | } else { | ||
| 251 | /* must be an anonymous map */ | ||
| 252 | *offset = addr; | ||
| 253 | } | ||
| 254 | |||
| 251 | break; | 255 | break; | 
| 252 | } | 256 | } | 
| 253 | 257 | ||
| 258 | if (!vma) | ||
| 259 | cookie = INVALID_COOKIE; | ||
| 260 | |||
| 254 | return cookie; | 261 | return cookie; | 
| 255 | } | 262 | } | 
| 256 | 263 | ||
| 257 | 264 | ||
| 258 | static unsigned long last_cookie = ~0UL; | 265 | static unsigned long last_cookie = INVALID_COOKIE; | 
| 259 | 266 | ||
| 260 | static void add_cpu_switch(int i) | 267 | static void add_cpu_switch(int i) | 
| 261 | { | 268 | { | 
| 262 | add_event_entry(ESCAPE_CODE); | 269 | add_event_entry(ESCAPE_CODE); | 
| 263 | add_event_entry(CPU_SWITCH_CODE); | 270 | add_event_entry(CPU_SWITCH_CODE); | 
| 264 | add_event_entry(i); | 271 | add_event_entry(i); | 
| 265 | last_cookie = ~0UL; | 272 | last_cookie = INVALID_COOKIE; | 
| 266 | } | 273 | } | 
| 267 | 274 | ||
| 268 | static void add_kernel_ctx_switch(unsigned int in_kernel) | 275 | static void add_kernel_ctx_switch(unsigned int in_kernel) | 
| @@ -317,7 +324,7 @@ static int add_us_sample(struct mm_struct * mm, struct op_sample * s) | |||
| 317 | 324 | ||
| 318 | cookie = lookup_dcookie(mm, s->eip, &offset); | 325 | cookie = lookup_dcookie(mm, s->eip, &offset); | 
| 319 | 326 | ||
| 320 | if (!cookie) { | 327 | if (cookie == INVALID_COOKIE) { | 
| 321 | atomic_inc(&oprofile_stats.sample_lost_no_mapping); | 328 | atomic_inc(&oprofile_stats.sample_lost_no_mapping); | 
| 322 | return 0; | 329 | return 0; | 
| 323 | } | 330 | } | 
