Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250872
b: refs/heads/master
c: 37b23e0
h: refs/heads/master
v: v3
  • Loading branch information
KOSAKI Motohiro authored and Linus Torvalds committed May 25, 2011
1 parent c2d659b commit 4e2cba5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 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: f62e00cc3a00bfbd394a79fc22b334c31f91bd5f
refs/heads/master: 37b23e0525d393d48a7d59f870b3bc061a30ccdb
12 changes: 11 additions & 1 deletion trunk/arch/x86/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
struct mm_struct *mm;
int fault;
int write = error_code & PF_WRITE;
unsigned int flags = FAULT_FLAG_ALLOW_RETRY |
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
(write ? FAULT_FLAG_WRITE : 0);

tsk = current;
Expand Down Expand Up @@ -1138,6 +1138,16 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
return;
}

/*
* Pagefault was interrupted by SIGKILL. We have no reason to
* continue pagefault.
*/
if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) {
if (!(error_code & PF_USER))
no_context(regs, error_code, address);
return;
}

/*
* Major/minor page fault accounting is only done on the
* initial attempt. If we go through a retry, it is extremely
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ extern pgprot_t protection_map[16];
#define FAULT_FLAG_MKWRITE 0x04 /* Fault was mkwrite of existing pte */
#define FAULT_FLAG_ALLOW_RETRY 0x08 /* Retry fault if blocking */
#define FAULT_FLAG_RETRY_NOWAIT 0x10 /* Don't drop mmap_sem and wait when retrying */
#define FAULT_FLAG_KILLABLE 0x20 /* The fault task is in SIGKILL killable region */

/*
* This interface is used by x86 PAT code to identify a pfn mapping that is
Expand Down
31 changes: 24 additions & 7 deletions trunk/mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,15 +654,32 @@ EXPORT_SYMBOL_GPL(__lock_page_killable);
int __lock_page_or_retry(struct page *page, struct mm_struct *mm,
unsigned int flags)
{
if (!(flags & FAULT_FLAG_ALLOW_RETRY)) {
__lock_page(page);
return 1;
} else {
if (!(flags & FAULT_FLAG_RETRY_NOWAIT)) {
up_read(&mm->mmap_sem);
if (flags & FAULT_FLAG_ALLOW_RETRY) {
/*
* CAUTION! In this case, mmap_sem is not released
* even though return 0.
*/
if (flags & FAULT_FLAG_RETRY_NOWAIT)
return 0;

up_read(&mm->mmap_sem);
if (flags & FAULT_FLAG_KILLABLE)
wait_on_page_locked_killable(page);
else
wait_on_page_locked(page);
}
return 0;
} else {
if (flags & FAULT_FLAG_KILLABLE) {
int ret;

ret = __lock_page_killable(page);
if (ret) {
up_read(&mm->mmap_sem);
return 0;
}
} else
__lock_page(page);
return 1;
}
}

Expand Down

0 comments on commit 4e2cba5

Please sign in to comment.