Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2790689imm; Sun, 12 Aug 2018 23:59:40 -0700 (PDT) X-Google-Smtp-Source: AA+uWPw25OD4o57Et+f70sZzd8Oyo23pa9c/f0U+txEnL3ZLPce1bNU1l8ZihxMgE/H6LiI7ez/a X-Received: by 2002:a63:f206:: with SMTP id v6-v6mr15860082pgh.319.1534143580252; Sun, 12 Aug 2018 23:59:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534143580; cv=none; d=google.com; s=arc-20160816; b=VKwhbVHXCqlrYTyZ63wmm/t/Q+rKPlOUJ5NTqjwY+6OuSenhScPmVXRCrJjMlS+kku OZgUFueOg4TQ7z2QN7beMkfS2cUji4PHoIY4DPlFky1+FBrAKJxs4JC+IZf8BVEZZfyy nsyGP4mkvE6PNsOfHAIOklH8YYrqULmWhKxHo4dN9K7gvoWzTaZWVLrDGz8TH8aS85sH sEijSTfZxbhRS7In649qi5hcVBblRivdAL7GFSCO4FSQOiqhEjXoqwALyoAM2p6sPBsz akb3Zfm0FG2O5uKdG2yhdEyVNB3egzsx6HrOisWmVf2+RGjk6PFHbk/nXy7lK5H5o+iA oS6Q== 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:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature:dkim-signature:arc-authentication-results; bh=g8KK2eY9Qx5mtXYPtyrNv99QbkJY/jwtgDsrn4/1FV0=; b=G/WBZgVX77ZFgqScrVoy6UXATbJWCjz7ieF8/n4MEX4vEKiFZNWT0BrH3Lz6H4kEsL RTKMcON12b9wFJg381wcQov/3bACGCqP5y75037CONwhaq7L/IWgSvse43K4nbZqWmz7 zIquMaDTB3vLCzr6ldiyl0ZuYXaBwIahUghtztWiSyxTyKenSnmsFd/9aM9mb2+9Q4xe WNJ3cW6YsRwbhgPXOLGePVuuDp5iagl2lIjbeSknZHcTyOe84wvl4++Z5qqKYVjDnZyR qyI7F9s1xF2xgjaCv0NTUuMDrKRpM1C1DuAqVfLBgZWcNNN9UGr8oWVr3AzUeeuLc9xN 074w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex-team.ru header.s=default header.b=utZfwDI5; dkim=pass header.i=@yandex-team.ru header.s=default header.b=utZfwDI5; 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=NONE dis=NONE) header.from=yandex-team.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u5-v6si14310281pls.372.2018.08.12.23.59.25; Sun, 12 Aug 2018 23:59:40 -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=@yandex-team.ru header.s=default header.b=utZfwDI5; dkim=pass header.i=@yandex-team.ru header.s=default header.b=utZfwDI5; 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=NONE dis=NONE) header.from=yandex-team.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728504AbeHMJjP (ORCPT + 99 others); Mon, 13 Aug 2018 05:39:15 -0400 Received: from forwardcorp1j.cmail.yandex.net ([5.255.227.105]:50912 "EHLO forwardcorp1j.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728481AbeHMJjO (ORCPT ); Mon, 13 Aug 2018 05:39:14 -0400 Received: from mxbackcorp1g.mail.yandex.net (mxbackcorp1g.mail.yandex.net [IPv6:2a02:6b8:0:1402::301]) by forwardcorp1j.cmail.yandex.net (Yandex) with ESMTP id 7141A21233; Mon, 13 Aug 2018 09:58:17 +0300 (MSK) Received: from smtpcorp1p.mail.yandex.net (smtpcorp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:10]) by mxbackcorp1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id EpZ3JuQNfW-wHN8cpY2; Mon, 13 Aug 2018 09:58:17 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1534143497; bh=g8KK2eY9Qx5mtXYPtyrNv99QbkJY/jwtgDsrn4/1FV0=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References; b=utZfwDI5V7wYbwnn/A+RSPxNxnyD2iS620obLp2CZK3EA/KM+PHruewO6HeEW9qac +Qe7/DWhS2MSFVUOwzfIXALFixLVtQOynBF30jLP1/zIw17LVqnGcfWcp9HPqj4B0m 6ZZsWQPI7xx3bCGXIIs+3BoLG837I0PvIA9hNzgE= Received: from dynamic-red.dhcp.yndx.net (dynamic-red.dhcp.yndx.net [2a02:6b8:0:40c:854c:7dcd:9203:76a5]) by smtpcorp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2msfYMj7CI-wH8StnEP; Mon, 13 Aug 2018 09:58:17 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1534143497; bh=g8KK2eY9Qx5mtXYPtyrNv99QbkJY/jwtgDsrn4/1FV0=; h=Subject:From:To:Cc:Date:Message-ID:In-Reply-To:References; b=utZfwDI5V7wYbwnn/A+RSPxNxnyD2iS620obLp2CZK3EA/KM+PHruewO6HeEW9qac +Qe7/DWhS2MSFVUOwzfIXALFixLVtQOynBF30jLP1/zIw17LVqnGcfWcp9HPqj4B0m 6ZZsWQPI7xx3bCGXIIs+3BoLG837I0PvIA9hNzgE= Authentication-Results: smtpcorp1p.mail.yandex.net; dkim=pass header.i=@yandex-team.ru Subject: [PATCH RFC 3/3] tools/vm/page-types: add flag for showing inodes of offline cgroups From: Konstantin Khlebnikov To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org Cc: Tejun Heo , Michal Hocko , Vladimir Davydov , Roman Gushchin , Johannes Weiner Date: Mon, 13 Aug 2018 09:58:14 +0300 Message-ID: <153414349419.737150.8224164787883146532.stgit@buzz> In-Reply-To: <153414348591.737150.14229960913953276515.stgit@buzz> References: <153414348591.737150.14229960913953276515.stgit@buzz> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With flag -R|--real-cgroup page-types will report real owner. Signed-off-by: Konstantin Khlebnikov --- tools/vm/page-types.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c index cce853dca691..453dbbb9fe8b 100644 --- a/tools/vm/page-types.c +++ b/tools/vm/page-types.c @@ -173,6 +173,7 @@ static pid_t opt_pid; /* process to walk */ const char *opt_file; /* file or directory path */ static uint64_t opt_cgroup; /* cgroup inode */ static int opt_list_cgroup;/* list page cgroup */ +static int opt_real_cgroup;/* real offline cgroup */ static const char *opt_kpageflags;/* kpageflags file to parse */ #define MAX_ADDR_RANGES 1024 @@ -789,6 +790,7 @@ static void usage(void) " -l|--list Show page details in ranges\n" " -L|--list-each Show page details one by one\n" " -C|--list-cgroup Show cgroup inode for pages\n" +" -R|--real-cgroup Show real offline cgroups\n" " -N|--no-summary Don't show summary info\n" " -X|--hwpoison hwpoison pages\n" " -x|--unpoison unpoison pages\n" @@ -1193,6 +1195,7 @@ static const struct option opts[] = { { "list" , 0, NULL, 'l' }, { "list-each" , 0, NULL, 'L' }, { "list-cgroup", 0, NULL, 'C' }, + { "real-cgroup", 0, NULL, 'R' }, { "no-summary", 0, NULL, 'N' }, { "hwpoison" , 0, NULL, 'X' }, { "unpoison" , 0, NULL, 'x' }, @@ -1208,7 +1211,7 @@ int main(int argc, char *argv[]) page_size = getpagesize(); while ((c = getopt_long(argc, argv, - "rp:f:a:b:d:c:ClLNXxF:h", opts, NULL)) != -1) { + "rp:f:a:b:d:c:CRlLNXxF:h", opts, NULL)) != -1) { switch (c) { case 'r': opt_raw = 1; @@ -1231,6 +1234,9 @@ int main(int argc, char *argv[]) case 'C': opt_list_cgroup = 1; break; + case 'R': + opt_real_cgroup = 1; + break; case 'd': describe_flags(optarg); exit(0); @@ -1266,7 +1272,15 @@ int main(int argc, char *argv[]) if (!opt_kpageflags) opt_kpageflags = PROC_KPAGEFLAGS; - if (opt_cgroup || opt_list_cgroup) + if (opt_real_cgroup) { + uint64_t flags = 1; + + kpagecgroup_fd = checked_open(PROC_KPAGECGROUP, O_RDWR); + if (write(kpagecgroup_fd, &flags, sizeof(flags)) < 0) { + perror(PROC_KPAGECGROUP); + exit(EXIT_FAILURE); + } + } else if (opt_cgroup || opt_list_cgroup) kpagecgroup_fd = checked_open(PROC_KPAGECGROUP, O_RDONLY); if (opt_list && opt_pid)