lkml.org 
[lkml]   [2023]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] mm: filemap: avoid unnecessary major faults in filemap_fault()
On Thu, Nov 23, 2023 at 05:09:04PM +0800, zhangpeng (AS) wrote:
> > > + pte_t *ptep = pte_offset_map_lock(vmf->vma->vm_mm, vmf->pmd,
> > > + vmf->address, &vmf->ptl);
> > > + if (ptep) {
> > > + /*
> > > + * Recheck pte with ptl locked as the pte can be cleared
> > > + * temporarily during a read/modify/write update.
> > > + */
> > > + if (unlikely(!pte_none(ptep_get(ptep))))
> > > + ret = VM_FAULT_NOPAGE;
> > > + pte_unmap_unlock(ptep, vmf->ptl);
> > > + if (unlikely(ret))
> > > + return ret;
> > > + }
> > > +
> > Need to deal with ptep == NULL. Although that is high impossible.
>
> If ptep == NULL, we may just need to return VM_FAULT_SIGBUS.
> I'll add it in the next version.

no? wouldn't ptep being NULL mean that the ptep has been replaced with
a PMD entry, and thus should return NOPAGE?

\
 
 \ /
  Last update: 2023-11-23 16:34    [W:0.103 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site