Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147253
b: refs/heads/master
c: ac17dc8
h: refs/heads/master
i:
  147251: 56c5755
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Apr 6, 2009
1 parent 9b68be0 commit d21897e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 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: 7dd1fcc258b65da718f01e4684a7b9244501a9fb
refs/heads/master: ac17dc8e58f3069ea895cfff963adf98ff3cf6b2
5 changes: 4 additions & 1 deletion trunk/arch/powerpc/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,15 +312,18 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
}
if (ret & VM_FAULT_MAJOR) {
current->maj_flt++;
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MAJ, 1, 0, regs);
#ifdef CONFIG_PPC_SMLPAR
if (firmware_has_feature(FW_FEATURE_CMO)) {
preempt_disable();
get_lppaca()->page_ins += (1 << PAGE_FACTOR);
preempt_enable();
}
#endif
} else
} else {
current->min_flt++;
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MIN, 1, 0, regs);
}
up_read(&mm->mmap_sem);
return 0;

Expand Down
7 changes: 5 additions & 2 deletions trunk/arch/x86/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,10 +1140,13 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
return;
}

if (fault & VM_FAULT_MAJOR)
if (fault & VM_FAULT_MAJOR) {
tsk->maj_flt++;
else
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MAJ, 1, 0, regs);
} else {
tsk->min_flt++;
perf_swcounter_event(PERF_COUNT_PAGE_FAULTS_MIN, 1, 0, regs);
}

check_v8086_mode(regs, address, tsk);

Expand Down
4 changes: 3 additions & 1 deletion trunk/include/linux/perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ enum hw_event_types {
PERF_COUNT_PAGE_FAULTS = -3,
PERF_COUNT_CONTEXT_SWITCHES = -4,
PERF_COUNT_CPU_MIGRATIONS = -5,
PERF_COUNT_PAGE_FAULTS_MIN = -6,
PERF_COUNT_PAGE_FAULTS_MAJ = -7,

PERF_SW_EVENTS_MIN = -6,
PERF_SW_EVENTS_MIN = -8,
};

/*
Expand Down
22 changes: 9 additions & 13 deletions trunk/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,12 @@ static void perf_swcounter_disable(struct perf_counter *counter)
perf_swcounter_update(counter);
}

static const struct hw_perf_counter_ops perf_ops_generic = {
.enable = perf_swcounter_enable,
.disable = perf_swcounter_disable,
.read = perf_swcounter_read,
};

/*
* Software counter: cpu wall time clock
*/
Expand Down Expand Up @@ -1603,16 +1609,6 @@ static const struct hw_perf_counter_ops perf_ops_task_clock = {
.read = task_clock_perf_counter_read,
};

/*
* Software counter: page faults
*/

static const struct hw_perf_counter_ops perf_ops_page_faults = {
.enable = perf_swcounter_enable,
.disable = perf_swcounter_disable,
.read = perf_swcounter_read,
};

/*
* Software counter: context switches
*/
Expand Down Expand Up @@ -1753,9 +1749,9 @@ sw_perf_counter_init(struct perf_counter *counter)
hw_ops = &perf_ops_cpu_clock;
break;
case PERF_COUNT_PAGE_FAULTS:
if (!(counter->hw_event.exclude_user ||
counter->hw_event.exclude_kernel))
hw_ops = &perf_ops_page_faults;
case PERF_COUNT_PAGE_FAULTS_MIN:
case PERF_COUNT_PAGE_FAULTS_MAJ:
hw_ops = &perf_ops_generic;
break;
case PERF_COUNT_CONTEXT_SWITCHES:
if (!counter->hw_event.exclude_kernel)
Expand Down

0 comments on commit d21897e

Please sign in to comment.