Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3070952imm; Sun, 1 Jul 2018 11:33:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf+0GTR8Xwel88BICZWghKJM6I/T+OXS0ciQlsAvC88jgJxija9+85AyQF1UjIiSrF6p6wO X-Received: by 2002:a62:6882:: with SMTP id d124-v6mr22451660pfc.122.1530470036171; Sun, 01 Jul 2018 11:33:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530470036; cv=none; d=google.com; s=arc-20160816; b=PsNCykiiJJG4n2f8Aiupuj+DCmRH1joiVvrSNQ3dWQDpDcYnOqkO9oopTXqH7pf2uw t+L+3UEiErpGLmeuko+nHvs91z8nGwLd0jRyFI8CqaKFKd07awD5Cfyevbh1W94f15y/ aWKU/kxeqjrzx5VsLhS2AHttnLU77STzGhX7ShX1kh3Daoz2bncW/kmQimq+vNlK2dFC 5NexacTYWmJKfTs024VtxpUH882qLo3ss4Fsgg6dFo/g5fujFAXlnVimKd5JxYvGNimY 3LeGjVrjizsiUHOlxxLZg8igZF/9XsZceZ4o4yarq/sFt5PfKGSqsROnOI7v6QGXlH+E b/mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to:dkim-signature:arc-authentication-results; bh=U19HPJasvGAtPde9Dd1eGkdksCSq78pD5o4LpKfbEHo=; b=IUbKx4Su8vXjR10HHS2EY1EEIJNTP9o0VkbL21NtpzRsW+I4Y8RJNnvqVSeaV6VzRM i9pj1wPKyBBlzia2wRluxkKarY8Z8S6sIg0FxPMnnnav2Fj6rlJFd2cy/cwPOrH8tKne wmFCfHjCVacOCAke4Ck7n5zMST/9XNAnFOV6oZL3IqJPNyHMqf0USSihoX67VlJ51Kv6 v+ra0aYaWa2bGejfCt7VtcD9B4vwDD84ZecbKuqnn57x2tPR150f6jdxlnt5cSYoTV+W 2zIHW3O1nx1Up0gf3BP2LxRg3EiTngZjlEW+ig8DGPcxTBOc18tbs2qnvHSu1Pz0hh8e SiMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NEkJ2jw6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d35-v6si15046786pla.116.2018.07.01.11.33.41; Sun, 01 Jul 2018 11:33:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NEkJ2jw6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964953AbeGASbk (ORCPT + 99 others); Sun, 1 Jul 2018 14:31:40 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33306 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933532AbeGASbd (ORCPT ); Sun, 1 Jul 2018 14:31:33 -0400 Received: by mail-lf0-f66.google.com with SMTP id u14-v6so5279470lfu.0; Sun, 01 Jul 2018 11:31:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=U19HPJasvGAtPde9Dd1eGkdksCSq78pD5o4LpKfbEHo=; b=NEkJ2jw6EmVH7KAFPxJTf9Z2Ulx7aaeRkyIidG89tUEvLaYWgR714mKJDxfAZoG84e W9j9QkZAhNaZSeVUJojhFoQmeX4UDCLdIvfXK6ihMiP86anp5nvpe6fAO4jOBl7eXvrp tT9z16TBZ/g6c7TyBQI0+viijL+YAvhdhL4s4LoMRjNP8HdhoyxneNp9YhYmO3qh35WB fT1C51P3jEsUhE5f4ANazo8tClJeCZsoGLM0o7CKyjhd8+kejaHgSLmNwlNFK9MkVCRv snGoF2SwYKgdl4BMOiv72ScjYeNN0bI7CLxlU52/A2E4OQxoWMZbN2tQrtUTvh62dDJ0 4jIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=U19HPJasvGAtPde9Dd1eGkdksCSq78pD5o4LpKfbEHo=; b=rkffRrJ7nu5Kx01dmcEoO1QGTGGSu2aY9West07fSVMDq7dLc7FFppeDSAyZs2bJPA ELmpMUZcbfN1W+lk7gesXrJp7mAp+rwirbvhvOzWky4UVOTJsNR9Wcyga+Nnm37jAhy6 IrWq9qP3lyCoMoERbHL7FXiGSKJaxv+kLkioTyK1Uqyd/+6LfFl0NTURz+18qa6ltDmi ECC/tEPhKQK4LKBmKg5kU/TokjrTYKej3RvDs4oFju02HbWItOD7lvt9hT4PmRRl+6KV eKe+/sqOjdv54jN1lHvthKGXKuoN9ylr/kU39yhPxoV7O+apQc+auxTs2n2wY9exLeaS 5/2w== X-Gm-Message-State: APt69E1YLk+mzufnjZQ60D3aBl1hu3KyXbHwvhztcxQLVTPp5c6tvJPV 5cvN1E0vfLuB/wuydA/Crb5/TQ== X-Received: by 2002:a19:4c57:: with SMTP id z84-v6mr12542934lfa.67.1530469891804; Sun, 01 Jul 2018 11:31:31 -0700 (PDT) Received: from [84.217.175.60] (c-3cafd954.501502050104-0-757473696b74.bbcust.telenor.se. [84.217.175.60]) by smtp.gmail.com with ESMTPSA id x19-v6sm1178721lff.36.2018.07.01.11.31.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Jul 2018 11:31:31 -0700 (PDT) To: dancol@google.com Cc: linux-api@vger.kernel.org, linux-kernel@vger.kernel.org From: Thomas Lindroth Subject: [REGRESSION] "Locked" and "Pss" in /proc/*/smaps are the same Message-ID: <69eb77f7-c8cc-fdee-b44f-ad7e522b8467@gmail.com> Date: Sun, 1 Jul 2018 20:31:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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.