[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131223150408.GC11091@parisc-linux.org>
Date: Mon, 23 Dec 2013 08:04:09 -0700
From: Matthew Wilcox <matthew@....cx>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: Matthew Wilcox <matthew.r.wilcox@...el.com>,
linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: Re: [PATCH v4 21/22] Add support for pmd_faults
On Mon, Dec 23, 2013 at 07:50:31AM -0700, Matthew Wilcox wrote:
> > > + pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
> > > + size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
> > > + if (pgoff >= size)
> > > + return VM_FAULT_SIGBUS;
> > > + if ((pgoff | PG_PMD_COLOUR) >= size)
> > > + return VM_FAULT_FALLBACK;
> >
> > I don't think it's necessary to fallback in this case.
> > Do you care about SIGBUS behaviour or what?
>
> I'm looking to preserve the same behaviour we see with PTE mappings. I mean,
> it's supposed to be _transparent_ huge pages, right?
Speaking of which ... we also need to check if the PMD is entirely within
the VMA. So, this is needed:
@@ -308,6 +308,11 @@ static int do_xip_pmd_fault(struct vm_area_struct *vma, uns
/* Fall back to PTEs if we're going to COW */
if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED))
return VM_FAULT_FALLBACK;
+ /* Fall back to PTEs if the mapping would extend outside the VMA */
+ if ((address & ~PMD_MASK) < vma->vm_start)
+ return VM_FAULT_FALLBACK;
+ if (ALIGN(address, PMD_SIZE) >= vma->vm_end)
+ return VM_FAULT_FALLBACK;
pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT;
I'll fold that into the next round of patches.
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists