Skip to content

Commit dde1607

Browse files
xzpetertorvalds
authored andcommitted
mm: introduce FAULT_FLAG_DEFAULT
Although there're tons of arch-specific page fault handlers, most of them are still sharing the same initial value of the page fault flags. Say, merely all of the page fault handlers would allow the fault to be retried, and they also allow the fault to respond to SIGKILL. Let's define a default value for the fault flags to replace those initial page fault flags that were copied over. With this, it'll be far easier to introduce new fault flag that can be used by all the architectures instead of touching all the archs. Signed-off-by: Peter Xu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Tested-by: Brian Geffon <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Bobby Powers <[email protected]> Cc: Denis Plotnikov <[email protected]> Cc: "Dr . David Alan Gilbert" <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Jerome Glisse <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: "Kirill A . Shutemov" <[email protected]> Cc: Martin Cracauer <[email protected]> Cc: Marty McFadden <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Maya Gokhale <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Pavel Emelyanov <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent ef429ee commit dde1607

File tree

24 files changed

+30
-23
lines changed

24 files changed

+30
-23
lines changed

arch/alpha/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
8989
const struct exception_table_entry *fixup;
9090
int si_code = SEGV_MAPERR;
9191
vm_fault_t fault;
92-
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
92+
unsigned int flags = FAULT_FLAG_DEFAULT;
9393

9494
/* As of EV6, a load into $31/$f31 is a prefetch, and never faults
9595
(or is suppressed by the PALcode). Support that for older CPUs

arch/arc/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void do_page_fault(unsigned long address, struct pt_regs *regs)
100100
(regs->ecr_cause == ECR_C_PROTV_INST_FETCH))
101101
exec = 1;
102102

103-
flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
103+
flags = FAULT_FLAG_DEFAULT;
104104
if (user_mode(regs))
105105
flags |= FAULT_FLAG_USER;
106106
if (write)

arch/arm/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
241241
struct mm_struct *mm;
242242
int sig, code;
243243
vm_fault_t fault;
244-
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
244+
unsigned int flags = FAULT_FLAG_DEFAULT;
245245

246246
if (kprobe_page_fault(regs, fsr))
247247
return 0;

arch/arm64/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
446446
struct mm_struct *mm = current->mm;
447447
vm_fault_t fault, major = 0;
448448
unsigned long vm_flags = VM_READ | VM_WRITE | VM_EXEC;
449-
unsigned int mm_flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
449+
unsigned int mm_flags = FAULT_FLAG_DEFAULT;
450450

451451
if (kprobe_page_fault(regs, esr))
452452
return 0;

arch/hexagon/mm/vm_fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void do_page_fault(unsigned long address, long cause, struct pt_regs *regs)
4141
int si_code = SEGV_MAPERR;
4242
vm_fault_t fault;
4343
const struct exception_table_entry *fixup;
44-
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
44+
unsigned int flags = FAULT_FLAG_DEFAULT;
4545

4646
/*
4747
* If we're in an interrupt or have no user context,

arch/ia64/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ ia64_do_page_fault (unsigned long address, unsigned long isr, struct pt_regs *re
6565
struct mm_struct *mm = current->mm;
6666
unsigned long mask;
6767
vm_fault_t fault;
68-
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
68+
unsigned int flags = FAULT_FLAG_DEFAULT;
6969

7070
mask = ((((isr >> IA64_ISR_X_BIT) & 1UL) << VM_EXEC_BIT)
7171
| (((isr >> IA64_ISR_W_BIT) & 1UL) << VM_WRITE_BIT));

arch/m68k/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
7171
struct mm_struct *mm = current->mm;
7272
struct vm_area_struct * vma;
7373
vm_fault_t fault;
74-
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
74+
unsigned int flags = FAULT_FLAG_DEFAULT;
7575

7676
pr_debug("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
7777
regs->sr, regs->pc, address, error_code, mm ? mm->pgd : NULL);

arch/microblaze/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
9191
int code = SEGV_MAPERR;
9292
int is_write = error_code & ESR_S;
9393
vm_fault_t fault;
94-
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
94+
unsigned int flags = FAULT_FLAG_DEFAULT;
9595

9696
regs->ear = address;
9797
regs->esr = error_code;

arch/mips/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static void __kprobes __do_page_fault(struct pt_regs *regs, unsigned long write,
4444
const int field = sizeof(unsigned long) * 2;
4545
int si_code;
4646
vm_fault_t fault;
47-
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
47+
unsigned int flags = FAULT_FLAG_DEFAULT;
4848

4949
static DEFINE_RATELIMIT_STATE(ratelimit_state, 5 * HZ, 10);
5050

arch/nds32/mm/fault.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void do_page_fault(unsigned long entry, unsigned long addr,
8080
int si_code;
8181
vm_fault_t fault;
8282
unsigned int mask = VM_READ | VM_WRITE | VM_EXEC;
83-
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE;
83+
unsigned int flags = FAULT_FLAG_DEFAULT;
8484

8585
error_code = error_code & (ITYPE_mskINST | ITYPE_mskETYPE);
8686
tsk = current;

0 commit comments

Comments
 (0)