Skip to content

Commit e70cc2b

Browse files
tehcastertorvalds
authored andcommitted
fs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps*
Thomas reports: "While looking around in /proc on my v4.14.52 system I noticed that all processes got a lot of "Locked" memory in /proc/*/smaps. A lot more memory than a regular user can usually lock with mlock(). Commit 493b0e9 (in v4.14-rc1) seems to have changed the behavior of "Locked". Before that commit the code was like this. Notice the VM_LOCKED check. (vma->vm_flags & VM_LOCKED) ? (unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0); After that commit Locked is now the same as Pss: (unsigned long)(mss->pss >> (10 + PSS_SHIFT))); This looks like a mistake." Indeed, the commit has added mss->pss_locked with the correct value that depends on VM_LOCKED, but forgot to actually use it. Fix it. Link: http://lkml.kernel.org/r/[email protected] Fixes: 493b0e9 ("mm: add /proc/pid/smaps_rollup") Signed-off-by: Vlastimil Babka <[email protected]> Reported-by: Thomas Lindroth <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Daniel Colascione <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent bce73e4 commit e70cc2b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/proc/task_mmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,8 @@ static int show_smap(struct seq_file *m, void *v, int is_pid)
831831
SEQ_PUT_DEC(" kB\nSwap: ", mss->swap);
832832
SEQ_PUT_DEC(" kB\nSwapPss: ",
833833
mss->swap_pss >> PSS_SHIFT);
834-
SEQ_PUT_DEC(" kB\nLocked: ", mss->pss >> PSS_SHIFT);
834+
SEQ_PUT_DEC(" kB\nLocked: ",
835+
mss->pss_locked >> PSS_SHIFT);
835836
seq_puts(m, " kB\n");
836837
}
837838
if (!rollup_mode) {

0 commit comments

Comments
 (0)