Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/mlock: drop dead code in count_mm_mlocked_page_nr()

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/20220615174050.738523-1-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Suggested-by: Lukas Bulwahn <lukas.bulwahn@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Liam Howlett and committed by
Andrew Morton
66071896 c154124f

+1 -3
+1 -3
mm/mlock.c
··· 531 531 unsigned long end; 532 532 VMA_ITERATOR(vmi, mm, start); 533 533 534 - if (mm == NULL) 535 - mm = current->mm; 536 - 537 534 /* Don't overflow past ULONG_MAX */ 538 535 if (unlikely(ULONG_MAX - len < start)) 539 536 end = ULONG_MAX; 540 537 else 541 538 end = start + len; 539 + 542 540 for_each_vma_range(vmi, vma, end) { 543 541 if (vma->vm_flags & VM_LOCKED) { 544 542 if (start > vma->vm_start)