Skip to content
Permalink
Browse files
ANDROID: Fix sparse warning in __handle_speculative_fault caused by SPF
SPF patchset introduced a sparse warning caused by the mismatch in
__handle_speculative_fault function's return type. Fix the return
type.

Fixes: 1c53717 ("FROMLIST: mm: provide speculative fault infrastructure")

Bug: 161210518
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I27c75f2b3729fa5d4b610f4a1829c9beba29735c
  • Loading branch information
surenbaghdasaryan committed Feb 4, 2021
1 parent aef918d commit 9e4d84273c9d786ee7592970f0a46c1c28eb3c18
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
@@ -1749,14 +1749,14 @@ extern int fixup_user_fault(struct mm_struct *mm,
bool *unlocked);

#ifdef CONFIG_SPECULATIVE_PAGE_FAULT
extern int __handle_speculative_fault(struct mm_struct *mm,
unsigned long address,
unsigned int flags,
struct vm_area_struct **vma);
static inline int handle_speculative_fault(struct mm_struct *mm,
unsigned long address,
unsigned int flags,
struct vm_area_struct **vma)
extern vm_fault_t __handle_speculative_fault(struct mm_struct *mm,
unsigned long address,
unsigned int flags,
struct vm_area_struct **vma);
static inline vm_fault_t handle_speculative_fault(struct mm_struct *mm,
unsigned long address,
unsigned int flags,
struct vm_area_struct **vma)
{
/*
* Try speculative page fault for multithreaded user space task only.
@@ -1770,10 +1770,10 @@ static inline int handle_speculative_fault(struct mm_struct *mm,
extern bool can_reuse_spf_vma(struct vm_area_struct *vma,
unsigned long address);
#else
static inline int handle_speculative_fault(struct mm_struct *mm,
unsigned long address,
unsigned int flags,
struct vm_area_struct **vma)
static inline vm_fault_t handle_speculative_fault(struct mm_struct *mm,
unsigned long address,
unsigned int flags,
struct vm_area_struct **vma)
{
return VM_FAULT_RETRY;
}
@@ -4841,16 +4841,18 @@ static inline void mm_account_fault(struct pt_regs *regs,
* This is needed as the returned vma is kept in memory until the call to
* can_reuse_spf_vma() is made.
*/
int __handle_speculative_fault(struct mm_struct *mm, unsigned long address,
unsigned int flags, struct vm_area_struct **vma)
vm_fault_t __handle_speculative_fault(struct mm_struct *mm,
unsigned long address, unsigned int flags,
struct vm_area_struct **vma)
{
struct vm_fault vmf = {
.address = address,
};
pgd_t *pgd, pgdval;
p4d_t *p4d, p4dval;
pud_t pudval;
int seq, ret;
int seq;
vm_fault_t ret;

/* Clear flags that may lead to release the mmap_sem to retry */
flags &= ~(FAULT_FLAG_ALLOW_RETRY|FAULT_FLAG_KILLABLE);

0 comments on commit 9e4d842

Please sign in to comment.