Skip to content

Commit

Permalink
mm/mlock: drop dead code in count_mm_mlocked_page_nr()
Browse files Browse the repository at this point in the history
The check for mm being null has never been needed since the only caller
has always passed in current->mm.  Remove the check from
count_mm_mlocked_page_nr().

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Liam R. Howlett <[email protected]>
Suggested-by: Lukas Bulwahn <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
howlett authored and akpm00 committed Sep 27, 2022
1 parent c154124 commit 6607189
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions mm/mlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -531,14 +531,12 @@ static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm,
unsigned long end;
VMA_ITERATOR(vmi, mm, start);

if (mm == NULL)
mm = current->mm;

/* Don't overflow past ULONG_MAX */
if (unlikely(ULONG_MAX - len < start))
end = ULONG_MAX;
else
end = start + len;

for_each_vma_range(vmi, vma, end) {
if (vma->vm_flags & VM_LOCKED) {
if (start > vma->vm_start)
Expand Down

0 comments on commit 6607189

Please sign in to comment.