lkml.org 
[lkml]   [2013]   [Jun]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 3/5] vmcore: Introduce remap_oldmem_pfn_range()
On Mon, 10 Jun 2013 22:40:24 +0900
HATAYAMA Daisuke <d.hatayama@gmail.com> wrote:

> > +static int mmap_vmcore_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
> > +{
> > + struct address_space *mapping = vma->vm_private_data;
> > + pgoff_t index = vmf->pgoff;
> > + struct page *page;
> > + loff_t src;
> > + char *buf;
> > + int rc;
> > +
> > +find_page:
> > + page = find_lock_page(mapping, index);
> > + if (page) {
> > + unlock_page(page);
> > + rc = VM_FAULT_MINOR;
> > + } else {
> > + page = page_cache_alloc_cold(mapping);
> > + if (!page)
> > + return VM_FAULT_OOM;
> > + rc = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL);
> > + if (rc) {
> > + page_cache_release(page);
> > + if (rc == -EEXIST)
> > + goto find_page;
> > + /* Probably ENOMEM for radix tree node */
> > + return VM_FAULT_OOM;
> > + }
> > + buf = (void *) (page_to_pfn(page) << PAGE_SHIFT);
> > + src = index << PAGE_CACHE_SHIFT;
> > + __read_vmcore(buf, PAGE_SIZE, &src, 0);
> > + unlock_page(page);
> > + rc = VM_FAULT_MAJOR;
> > + }
> > + vmf->page = page;
> > + return rc;
> > +}
>
> How about reusing find_or_create_page()?

Hmmm, how would I know then if I have to fill the page with
__read_vmcore() or not?

Best Regards,
Michael



\
 
 \ /
  Last update: 2013-06-10 16:21    [W:0.257 / U:1.856 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site