Skip to contentSkip to conversation

fs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps*

PATCH New [email protected] 1 participant 1 message Jul 14, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 2/11 fs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps*

From: Vlastimil Babka <[email protected]>
Subject: 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 493b0e9d945fa9dfe96be93ae41b4ca4b6fdb317 (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. This looks like a : mistake.
:
: (unsigned long)(mss->pss >> (10 + PSS_SHIFT)));

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.

Fixes 493b0e9d945f ("mm: add /proc/pid/smaps_rollup")
Cc Alexey Dobriyan <[email protected]>
Cc Daniel Colascione <[email protected]>

---

 fs/proc/task_mmu.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/task_mmu.c renamed from fs/proc/task_mmu.c~mm-fix-locked-field-in-proc-pid-smaps +2 -1
diff -puN fs/proc/task_mmu.c~mm-fix-locked-field-in-proc-pid-smaps fs/proc/task_mmu.c
@@ -831,7 +831,8 @@ static int show_smap(struct seq_file *m,
 		SEQ_PUT_DEC(" kB\nSwap:           ", mss->swap);
 		SEQ_PUT_DEC(" kB\nSwapPss:        ",
 						mss->swap_pss >> PSS_SHIFT);
-		SEQ_PUT_DEC(" kB\nLocked:         ", mss->pss >> PSS_SHIFT);
+		SEQ_PUT_DEC(" kB\nLocked:         ",
+						mss->pss_locked >> PSS_SHIFT);
 		seq_puts(m, " kB\n");
 	}
 	if (!rollup_mode) {

_