Messages in this thread | | | Date | Sat, 31 Jan 2009 12:16:11 +0000 (GMT) | From | Hugh Dickins <> | Subject | Re: [PATCH] Fix OOPS in mmap_region() when merging adjacent VM_LOCKED file segments |
| |
On Fri, 30 Jan 2009, Linus Torvalds wrote: > On Fri, 30 Jan 2009, Hugh Dickins wrote: > > > > By the same (used to merge, now won't) argument, one could say > > VM_INSERTPAGE should be there too; but whereas VM_MIXEDMAP is used > > in one place only, quite a lot of drivers use vm_insert_page(), so > > I feel more comfortable with the idea that it's stopping merges - > > though in that case, shouldn't we add it to VM_SPECIAL? > > But VM_INSERTPAGE - no. > > Why? Because VM_INSERTPAGE implies that mmap() itself quite possibly > actually _does_ something (it may have inserted _all_ the pages, and may > not even have any ->fault handler at all). > > So we can't just expand a current mapping and forget about it, we need to > do the mmap(). So the "only do merges early" fundamentally cannot merge > such a vma, even if the old code did.
Good point indeed. Same as why we test for it in copy_page_range(). Should it be added to VM_SPECIAL? Not for this particular (need to call ->mmap) reason, but we probably ought to add it anyway.
Hugh
> > Of course, we could look at whether it has a ->fault handler as an > indication of whether it's possible to merge or not. We already do that > for ->close, and in many ways ->fault would likely be a better indicator > of whether something is mergeable or not. > > But there's really no point. VM_INSERTPAGE implies a very special mapping: > it's used by things like the SCSI target user space ring map, or the magic > network packet mmap thing. If you use those things, you really don't care > about merging adjacent VM's anyway, and at least the two I looked at > really do the whole "pre-populate at mmap time" thing. > > And at least the packet one really does have a ->close function, and lacks > a ->fault function, so it wouldn't have merged before either (and looking > at ->fault again seems to be as valid as looking at ->close). > > Linus
| |