Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 44635
b: refs/heads/master
c: 4fb23e4
h: refs/heads/master
i:
  44633: bd899d3
  44631: 2558783
v: v3
  • Loading branch information
Linus Torvalds committed Dec 17, 2006
1 parent 4af8090 commit 5292a23
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c7ef259bfb4084d8806dfff9eb8bfc6e82bb8c45
refs/heads/master: 4fb23e439ce09157d64b89a21061b9fc08f2b495
29 changes: 10 additions & 19 deletions trunk/mm/mincore.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,20 @@ static long do_mincore(unsigned long addr, unsigned char *vec, unsigned long pag
struct vm_area_struct *vma = find_vma(current->mm, addr);

/*
* find_vma() didn't find anything: the address
* is above everything we have mapped.
* find_vma() didn't find anything above us, or we're
* in an unmapped hole in the address space: ENOMEM.
*/
if (!vma) {
memset(vec, 0, pages);
return pages;
}

/*
* find_vma() found something, but we might be
* below it: check for that.
*/
if (addr < vma->vm_start) {
unsigned long gap = (vma->vm_start - addr) >> PAGE_SHIFT;
if (gap > pages)
gap = pages;
memset(vec, 0, gap);
return gap;
}
if (!vma || addr < vma->vm_start)
return -ENOMEM;

/*
* Ok, got it. But check whether it's a segment we support
* mincore() on. Right now, we don't do any anonymous mappings.
*
* FIXME: This is just stupid. And returning ENOMEM is
* stupid too. We should just look at the page tables. But
* this is what we've traditionally done, so we'll just
* continue doing it.
*/
if (!vma->vm_file)
return -ENOMEM;
Expand Down Expand Up @@ -142,7 +133,7 @@ asmlinkage long sys_mincore(unsigned long start, size_t len,

tmp = (void *) __get_free_page(GFP_USER);
if (!tmp)
return -ENOMEM;
return -EAGAIN;

retval = 0;
while (pages) {
Expand Down

0 comments on commit 5292a23

Please sign in to comment.