mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
mm: join struct fault_env and vm_fault
Currently we have two different structures for passing fault information around - struct vm_fault and struct fault_env. DAX will need more information in struct vm_fault to handle its faults so the content of that structure would become event closer to fault_env. Furthermore it would need to generate struct fault_env to be able to call some of the generic functions. So at this point I don't think there's much use in keeping these two structures separate. Just embed into struct vm_fault all that is needed to use it for both purposes. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Jan Kara <[email protected]> Acked-by: Kirill A. Shutemov <[email protected]> Cc: Ross Zwisler <[email protected]> Cc: Dan Williams <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
8b7457ef9a
commit
82b0f8c39a
11 changed files with 423 additions and 422 deletions
|
|
@ -257,9 +257,9 @@ out:
|
|||
* fatal_signal_pending()s, and the mmap_sem must be released before
|
||||
* returning it.
|
||||
*/
|
||||
int handle_userfault(struct fault_env *fe, unsigned long reason)
|
||||
int handle_userfault(struct vm_fault *vmf, unsigned long reason)
|
||||
{
|
||||
struct mm_struct *mm = fe->vma->vm_mm;
|
||||
struct mm_struct *mm = vmf->vma->vm_mm;
|
||||
struct userfaultfd_ctx *ctx;
|
||||
struct userfaultfd_wait_queue uwq;
|
||||
int ret;
|
||||
|
|
@ -268,7 +268,7 @@ int handle_userfault(struct fault_env *fe, unsigned long reason)
|
|||
BUG_ON(!rwsem_is_locked(&mm->mmap_sem));
|
||||
|
||||
ret = VM_FAULT_SIGBUS;
|
||||
ctx = fe->vma->vm_userfaultfd_ctx.ctx;
|
||||
ctx = vmf->vma->vm_userfaultfd_ctx.ctx;
|
||||
if (!ctx)
|
||||
goto out;
|
||||
|
||||
|
|
@ -301,17 +301,18 @@ int handle_userfault(struct fault_env *fe, unsigned long reason)
|
|||
* without first stopping userland access to the memory. For
|
||||
* VM_UFFD_MISSING userfaults this is enough for now.
|
||||
*/
|
||||
if (unlikely(!(fe->flags & FAULT_FLAG_ALLOW_RETRY))) {
|
||||
if (unlikely(!(vmf->flags & FAULT_FLAG_ALLOW_RETRY))) {
|
||||
/*
|
||||
* Validate the invariant that nowait must allow retry
|
||||
* to be sure not to return SIGBUS erroneously on
|
||||
* nowait invocations.
|
||||
*/
|
||||
BUG_ON(fe->flags & FAULT_FLAG_RETRY_NOWAIT);
|
||||
BUG_ON(vmf->flags & FAULT_FLAG_RETRY_NOWAIT);
|
||||
#ifdef CONFIG_DEBUG_VM
|
||||
if (printk_ratelimit()) {
|
||||
printk(KERN_WARNING
|
||||
"FAULT_FLAG_ALLOW_RETRY missing %x\n", fe->flags);
|
||||
"FAULT_FLAG_ALLOW_RETRY missing %x\n",
|
||||
vmf->flags);
|
||||
dump_stack();
|
||||
}
|
||||
#endif
|
||||
|
|
@ -323,7 +324,7 @@ int handle_userfault(struct fault_env *fe, unsigned long reason)
|
|||
* and wait.
|
||||
*/
|
||||
ret = VM_FAULT_RETRY;
|
||||
if (fe->flags & FAULT_FLAG_RETRY_NOWAIT)
|
||||
if (vmf->flags & FAULT_FLAG_RETRY_NOWAIT)
|
||||
goto out;
|
||||
|
||||
/* take the reference before dropping the mmap_sem */
|
||||
|
|
@ -331,11 +332,11 @@ int handle_userfault(struct fault_env *fe, unsigned long reason)
|
|||
|
||||
init_waitqueue_func_entry(&uwq.wq, userfaultfd_wake_function);
|
||||
uwq.wq.private = current;
|
||||
uwq.msg = userfault_msg(fe->address, fe->flags, reason);
|
||||
uwq.msg = userfault_msg(vmf->address, vmf->flags, reason);
|
||||
uwq.ctx = ctx;
|
||||
|
||||
return_to_userland =
|
||||
(fe->flags & (FAULT_FLAG_USER|FAULT_FLAG_KILLABLE)) ==
|
||||
(vmf->flags & (FAULT_FLAG_USER|FAULT_FLAG_KILLABLE)) ==
|
||||
(FAULT_FLAG_USER|FAULT_FLAG_KILLABLE);
|
||||
|
||||
spin_lock(&ctx->fault_pending_wqh.lock);
|
||||
|
|
@ -353,7 +354,8 @@ int handle_userfault(struct fault_env *fe, unsigned long reason)
|
|||
TASK_KILLABLE);
|
||||
spin_unlock(&ctx->fault_pending_wqh.lock);
|
||||
|
||||
must_wait = userfaultfd_must_wait(ctx, fe->address, fe->flags, reason);
|
||||
must_wait = userfaultfd_must_wait(ctx, vmf->address, vmf->flags,
|
||||
reason);
|
||||
up_read(&mm->mmap_sem);
|
||||
|
||||
if (likely(must_wait && !ACCESS_ONCE(ctx->released) &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue