Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2440
b: refs/heads/master
c: e798c6e
h: refs/heads/master
v: v3
  • Loading branch information
Prasanna Meda authored and Linus Torvalds committed Jun 22, 2005
1 parent 569a21c commit f14bf86
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 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: b15e0905f2b9964fc7426fecab57445e96021b61
refs/heads/master: e798c6e87b64d9fdbd5e9f757b1c033223763d9f
27 changes: 16 additions & 11 deletions trunk/mm/madvise.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ static long madvise_behavior(struct vm_area_struct * vma, unsigned long start,
{
struct mm_struct * mm = vma->vm_mm;
int error = 0;
int new_flags = vma->vm_flags & ~VM_READHINTMASK;

switch (behavior) {
case MADV_SEQUENTIAL:
new_flags |= VM_SEQ_READ;
break;
case MADV_RANDOM:
new_flags |= VM_RAND_READ;
break;
default:
break;
}

if (new_flags == vma->vm_flags)
goto out;

if (start != vma->vm_start) {
error = split_vma(mm, vma, start, 1);
Expand All @@ -36,17 +51,7 @@ static long madvise_behavior(struct vm_area_struct * vma, unsigned long start,
* vm_flags is protected by the mmap_sem held in write mode.
*/
VM_ClearReadHint(vma);

switch (behavior) {
case MADV_SEQUENTIAL:
vma->vm_flags |= VM_SEQ_READ;
break;
case MADV_RANDOM:
vma->vm_flags |= VM_RAND_READ;
break;
default:
break;
}
vma->vm_flags = new_flags;

out:
if (error == -ENOMEM)
Expand Down

0 comments on commit f14bf86

Please sign in to comment.