Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2039007imm; Mon, 16 Jul 2018 00:39:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe5pWG2MZwhrKnmY05jadBQnKUm5zc5wy+GFON+kGHTntOMjHMu9VaojtKWibl+ylqGdxlO X-Received: by 2002:a63:d80f:: with SMTP id b15-v6mr14770868pgh.347.1531726787040; Mon, 16 Jul 2018 00:39:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531726787; cv=none; d=google.com; s=arc-20160816; b=XodWOJdvN2gu4Ew/HIWfGNTJI9KR3KmHdQOZ48atqnuKfairSKaHzlrw4JGHoRdi7v qrn/5kz/muqdY1E+snW576XKdOD65gBMUk3omXkdyA05X0chLMYwl5s181s3MNxfyTiw /86bgfyKPfsigeVBmzdcSlgMUMFYO743X8o6ebIjOdbBnfHee7QOkRUfxeWYraCpO2J2 7vuXCUDd1lHkkyHoleUlNoauME5ZIt5QTli6SYPk05RPHZq9OEZAa+IzlGdirEurN7KO LQMEm54tZjY+En41s0iYtPbSXVFwFyE1lZEZt1JC5XSOjJoMXU/uXTeBMl+Cq6qLcuzh DJhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Ym/yg0vuplApTayulX+LrrBs4aTEfC+z3xf57iJ4ztk=; b=FJAYgcirIpfXbJX760qoBfjJAsjPFcTTj25DJllcAGhq1iljaEjcjZS312GHpsfMfI T3kAocbJCH7k+hS1izIJ2O4rSYJ7e6YEX7EM6O/TJGMG4grPs1PIPUl1GkUNPPkRoBm0 1q2kZPxpQJ57hWyZbQ9goYhX6Jb28ujZQT2Y3b0FuIWD45kIC1kfIaBPYjqn/yD/1UqQ HQYT16J9nQUV/+Rei9dBcGFLMX8M/9WsJfdqtTsuBm63szcLvKXHUAENjjZyvCC8UQky wd5MeFfZLg4XJHqodBUSKz7OMsJ0xgwdMEKXu0CywwwlLQHJMuPekAsY6i07Bg/liXzk +R8g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r10-v6si27976109pgm.535.2018.07.16.00.39.31; Mon, 16 Jul 2018 00:39:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732846AbeGPIEe (ORCPT + 99 others); Mon, 16 Jul 2018 04:04:34 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46930 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732677AbeGPIEd (ORCPT ); Mon, 16 Jul 2018 04:04:33 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C02EEC03; Mon, 16 Jul 2018 07:38:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vlastimil Babka , Thomas Lindroth , Alexey Dobriyan , Daniel Colascione , Andrew Morton , Linus Torvalds Subject: [PATCH 4.17 36/67] fs/proc/task_mmu.c: fix Locked field in /proc/pid/smaps* Date: Mon, 16 Jul 2018 09:35:05 +0200 Message-Id: <20180716073448.807781923@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180716073443.294323458@linuxfoundation.org> References: <20180716073443.294323458@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vlastimil Babka commit e70cc2bd579e8a9d6d153762f0fe294d0e652ff0 upstream. 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 493b0e9d945f (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/ebf6c7fb-fec3-6a26-544f-710ed193c154@suse.cz Fixes: 493b0e9d945f ("mm: add /proc/pid/smaps_rollup") Signed-off-by: Vlastimil Babka Reported-by: Thomas Lindroth Cc: Alexey Dobriyan Cc: Daniel Colascione Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/proc/task_mmu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/proc/task_mmu.c +++ b/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) {