linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Lindroth <thomas.lindroth@gmail.com>
To: dancol@google.com
Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [REGRESSION] "Locked" and "Pss" in /proc/*/smaps are the same
Date: Sun, 1 Jul 2018 20:31:30 +0200	[thread overview]
Message-ID: <69eb77f7-c8cc-fdee-b44f-ad7e522b8467@gmail.com> (raw)

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".

commit 493b0e9d945fa9dfe96be93ae41b4ca4b6fdb317
Author: Daniel Colascione <dancol@google.com>
Date:   Wed Sep 6 16:25:08 2017 -0700

    mm: add /proc/pid/smaps_rollup

Before that commit the code was like this. Notice the VM_LOCKED
check.

seq_printf(m,
           "Size:           %8lu kB\n"
           "Rss:            %8lu kB\n"
           "Pss:            %8lu kB\n"
           "Shared_Clean:   %8lu kB\n"
           "Shared_Dirty:   %8lu kB\n"
           "Private_Clean:  %8lu kB\n"
           "Private_Dirty:  %8lu kB\n"
           "Referenced:     %8lu kB\n"
           "Anonymous:      %8lu kB\n"
           "LazyFree:       %8lu kB\n"
           "AnonHugePages:  %8lu kB\n"
           "ShmemPmdMapped: %8lu kB\n"
           "Shared_Hugetlb: %8lu kB\n"
           "Private_Hugetlb: %7lu kB\n"
           "Swap:           %8lu kB\n"
           "SwapPss:        %8lu kB\n"
           "KernelPageSize: %8lu kB\n"
           "MMUPageSize:    %8lu kB\n"
           "Locked:         %8lu kB\n",
           (vma->vm_end - vma->vm_start) >> 10,
           mss.resident >> 10,
           (unsigned long)(mss.pss >> (10 + PSS_SHIFT)),
           mss.shared_clean  >> 10,
           mss.shared_dirty  >> 10,
           mss.private_clean >> 10,
           mss.private_dirty >> 10,
           mss.referenced >> 10,
           mss.anonymous >> 10,
           mss.lazyfree >> 10,
           mss.anonymous_thp >> 10,
           mss.shmem_thp >> 10,
           mss.shared_hugetlb >> 10,
           mss.private_hugetlb >> 10,
           mss.swap >> 10,
           (unsigned long)(mss.swap_pss >> (10 + PSS_SHIFT)),
           vma_kernel_pagesize(vma) >> 10,
           vma_mmu_pagesize(vma) >> 10,
           (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.

seq_printf(m,
           "Rss:            %8lu kB\n"
           "Pss:            %8lu kB\n"
           "Shared_Clean:   %8lu kB\n"
           "Shared_Dirty:   %8lu kB\n"
           "Private_Clean:  %8lu kB\n"
           "Private_Dirty:  %8lu kB\n"
           "Referenced:     %8lu kB\n"
           "Anonymous:      %8lu kB\n"
           "LazyFree:       %8lu kB\n"
           "AnonHugePages:  %8lu kB\n"
           "ShmemPmdMapped: %8lu kB\n"
           "Shared_Hugetlb: %8lu kB\n"
           "Private_Hugetlb: %7lu kB\n"
           "Swap:           %8lu kB\n"
           "SwapPss:        %8lu kB\n"
           "Locked:         %8lu kB\n",
           mss->resident >> 10,
           (unsigned long)(mss->pss >> (10 + PSS_SHIFT)),
           mss->shared_clean  >> 10,
           mss->shared_dirty  >> 10,
           mss->private_clean >> 10,
           mss->private_dirty >> 10,
           mss->referenced >> 10,
           mss->anonymous >> 10,
           mss->lazyfree >> 10,
           mss->anonymous_thp >> 10,
           mss->shmem_thp >> 10,
           mss->shared_hugetlb >> 10,
           mss->private_hugetlb >> 10,
           mss->swap >> 10,
           (unsigned long)(mss->swap_pss >> (10 + PSS_SHIFT)),
           (unsigned long)(mss->pss >> (10 + PSS_SHIFT)));

The latest git has changed a bit but the functionality is the
same.

             reply	other threads:[~2018-07-01 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-01 18:31 Thomas Lindroth [this message]
2018-07-03  7:36 ` [REGRESSION] "Locked" and "Pss" in /proc/*/smaps are the same Vlastimil Babka
2018-07-03  7:45   ` Vlastimil Babka
2018-07-03 16:20   ` Daniel Colascione
2018-07-04  8:46     ` Vlastimil Babka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69eb77f7-c8cc-fdee-b44f-ad7e522b8467@gmail.com \
    --to=thomas.lindroth@gmail.com \
    --cc=dancol@google.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).