Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1478958 > unrolled thread
| Started by | wei.guo.simon@gmail.com |
|---|---|
| First post | 2016-09-08 11:20 +0200 |
| Last post | 2016-09-08 11:20 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/3] mm: mlock: correct a typo in count_mm_mlocked_page_nr() for caculate VMLOCKED pages wei.guo.simon@gmail.com - 2016-09-08 11:20 +0200
| From | wei.guo.simon@gmail.com |
|---|---|
| Date | 2016-09-08 11:20 +0200 |
| Subject | [PATCH 1/3] mm: mlock: correct a typo in count_mm_mlocked_page_nr() for caculate VMLOCKED pages |
| Message-ID | <sf3F0-3UY-39@gated-at.bofh.it> |
From: Simon Guo <wei.guo.simon@gmail.com>
There is a typo/bug in count_mm_mlocked_page_nr() for "&" which is
mistakenly used with "&&".
Also add more checks and some minor change based on Kirill's previous
comment.
Suggested-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
---
mm/mlock.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/mm/mlock.c b/mm/mlock.c
index fafbb78..145a425 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -641,9 +641,11 @@ static int count_mm_mlocked_page_nr(struct mm_struct *mm,
vma = mm->mmap;
for (; vma ; vma = vma->vm_next) {
+ if (start >= vma->vm_end)
+ continue;
if (start + len <= vma->vm_start)
break;
- if (vma->vm_flags && VM_LOCKED) {
+ if (vma->vm_flags & VM_LOCKED) {
if (start > vma->vm_start)
count -= (start - vma->vm_start);
if (start + len < vma->vm_end) {
@@ -654,7 +656,7 @@ static int count_mm_mlocked_page_nr(struct mm_struct *mm,
}
}
- return (PAGE_ALIGN(count) >> PAGE_SHIFT);
+ return count >> PAGE_SHIFT;
}
static __must_check int do_mlock(unsigned long start, size_t len, vm_flags_t flags)
--
1.8.3.1
Back to top | Article view | linux.kernel
csiph-web