From patchwork Mon Aug 13 06:58:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konstantin Khlebnikov X-Patchwork-Id: 10563907 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2201E17E1 for ; Mon, 13 Aug 2018 06:58:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 182CA28EC6 for ; Mon, 13 Aug 2018 06:58:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C82628F1E; Mon, 13 Aug 2018 06:58:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89CE628EC6 for ; Mon, 13 Aug 2018 06:58:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C9A76B000A; Mon, 13 Aug 2018 02:58:20 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 229E36B000C; Mon, 13 Aug 2018 02:58:20 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11A0A6B000D; Mon, 13 Aug 2018 02:58:20 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by kanga.kvack.org (Postfix) with ESMTP id 8F9E36B000A for ; Mon, 13 Aug 2018 02:58:19 -0400 (EDT) Received: by mail-lj1-f200.google.com with SMTP id v23-v6so2436739ljc.8 for ; Sun, 12 Aug 2018 23:58:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:dkim-signature:subject:from:to:cc :date:message-id:in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=g8KK2eY9Qx5mtXYPtyrNv99QbkJY/jwtgDsrn4/1FV0=; b=OdBs3DCBwNwVkTScX3eKE+U32e6VQ6ko+EL9xS/S0yqMO+bezy7FDxaSBE0Miht8Cd R3qZ7yoE4hcrjl8T6+tC2BGhLpT2Gz15MF4ZRhcCKMZqZku5eOxe6zoipYkrSCMyD0Bg lT2xdWZvsDa4tGFZLOk8FCZa55O6BrRgXATBDl7x4NjmsIGP4uiEK9MpxAMlMikn1dXP 48ERqErpx3OmkuoHD1/pURnsaIwpObXGAGZiIAgNdV/W/J7YhZVRJtjwzhBVcupaL7Sm Kl1FJfKyTmWhv6HkjFfdxNSefvpoDoJiir+BGS50UcrNoqCZIHdnYJF9wAuj7Qj6mlMo qgyg== X-Gm-Message-State: AOUpUlGnNiC6H06ZBqltPx5NVaPdVRCjHnqinOMBJj2g7+MFTdEBfX+C cNDFlE+SkWHWK/+17CaKWWxX5mtKkmn50cuspT3TXQ81SU0CECmLVLfuvN04KnXeo20lQreo8f/ W90Snh/t73v6snij5XRNOchmm3ZGlAltl5/BG2GW+CblTyAnzSY46+6oggPdhWv3PAg== X-Received: by 2002:a2e:1953:: with SMTP id p80-v6mr5875781lje.127.1534143498987; Sun, 12 Aug 2018 23:58:18 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzlEVwccILzy5YvzxJNiiy9CUK7AqfpALhMV86v2bDrrm5ON0UeqreNxua/YwzGktPMuIZR X-Received: by 2002:a2e:1953:: with SMTP id p80-v6mr5875748lje.127.1534143498070; Sun, 12 Aug 2018 23:58:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534143498; cv=none; d=google.com; s=arc-20160816; b=Fm8LURX9jOa44DX1N+bsrpDcO+eaU4PvPJju1Pzg/radZesCiQumw9sypk5YlQKJBN 2NHNirVG3NT104SzTcDVlolRIv9qeIfQbP5XRGSGL6dbqeanSXgiHXXTzwmIl846Tm1c W3kiEVUe6O77H8zoW+y0lLXnOIxqSjn86Cg/FrrWt04yyaKujwA0vffhHiu9qVxfAHRC K8QfpWrz+jNS5SFpqczoR+N+wISvBIZE5V3R+lUtn7Wd2y5KkTLEH31Hr0/GBmQirdHJ mrrFudsO+0d02VgLZxIWo2BFFmkDQJlTugDtOihRshMUnms3GnZs73Lu84cNEIuXdJEH fmMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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=Q8wTER/dREoQc60V26H8QbwLNFeWCMFJLbSrpsUd81TziIBk0s7iy3uMZQuBBDF7im S3ZLrOrv+5trUwcfZ7nLAPFLpbIeWOiOEeNRESME5irRRs9uRXRggPOjSDAfioJJzOF/ NhIbxCMUAlUdvhV5g0sv9PTqOkT7tgwbG2Iny/CEUMwUeqalKn83f3TnZs98HNEIpES5 618kfoYTEt93Cmz4fWJ7qKlEFVi3/b6HKl7nPDgDQb4Nsloodd+XwRjVJJCAJauCh53l ylAfC/jn0WavZ48qXL/Qaabx94O3/D+pBk+DnzzcA70SdmzJrigSSxA5utl7urrGeHso prLg== 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: domain of khlebnikov@yandex-team.ru designates 2a02:6b8:0:1630::190 as permitted sender) smtp.mailfrom=khlebnikov@yandex-team.ru; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru Received: from forwardcorp1j.cmail.yandex.net (forwardcorp1j.cmail.yandex.net. [2a02:6b8:0:1630::190]) by mx.google.com with ESMTPS id o10-v6si6123471ljd.100.2018.08.12.23.58.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Aug 2018 23:58:18 -0700 (PDT) Received-SPF: pass (google.com: domain of khlebnikov@yandex-team.ru designates 2a02:6b8:0:1630::190 as permitted sender) client-ip=2a02:6b8:0:1630::190; 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: domain of khlebnikov@yandex-team.ru designates 2a02:6b8:0:1630::190 as permitted sender) smtp.mailfrom=khlebnikov@yandex-team.ru; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex-team.ru 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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)