Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1915567pxb; Wed, 2 Feb 2022 15:51:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWqqZdDj8geB45qiIYvmDvaTr4Gtz0ia+m9o49bc+biMTUz3sgj2Vi8pv6+sAZ4yScMbOM X-Received: by 2002:a17:90b:3841:: with SMTP id nl1mr10709804pjb.24.1643845887907; Wed, 02 Feb 2022 15:51:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643845887; cv=none; d=google.com; s=arc-20160816; b=raZ/oDp61zENYGu81daY8rN6b20Bl70u0dXanBlunQECvvXtYwvD/3oxLcslLmAOWR lC83L9XcXn8iOKuGkN0ZG0/m/kZmwUN1DyoecwA/6XLLh9QqHYneF95Qt86TEn5zjCCw 4YNVuuPuvYDQZOTsozZulJO+ivC5HzibeBtF4TItqcFdtNQ2XLzB03TWe2IACK1uZW/G QPIdkKrqQmejZ85oDaRnUtPMpHWFfeTCnCp3eWZxFsXD5jqRcLfbVeKPSi5/LEOudOMz kZXN2IQh6XA6VUxePMoVf3i1HkGznrGf6HfGpYNdlG5BcJ8/QfnGHSDLTMm+SCsFpeB9 Yrww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=PC8NZ8lG/hbKxyQngU3kWuHlJ5Tl5ht+lJl5+tMvXcM=; b=kJ8prIGBzKI03WDh+41whFgFkG+fIHEddtk0jy/ID6CL4vcRCZZz4uXJ/GPPooKeZi 65nwfoUZm6d1Lml336J07DMdAJ1v0xKJ4mSzMakR7sHIOSyTYphgcnM4b1OP7mI9crBe uk+Yt37jqFvdatoCK1O+wUOVewTiPHhn4m+fueT1WRyjK46cljIq6pKjsD5u2J7XDQ+k dcp0CWVy5tAUISxE1UjMy7CJStAbgl412/0Jb7WqrINWXxTMW72zHTQ1OVqztbV9B1Cz PjGxWhhJM82RdF0hQN52QJjrijNA4P7xhsRpn4vZFQcCOMahIPwqYrbfo51+zZyga2Mf x4dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B7hNIJLR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g71si4312085pgc.187.2022.02.02.15.51.11; Wed, 02 Feb 2022 15:51:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B7hNIJLR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241169AbiBAQlb (ORCPT + 99 others); Tue, 1 Feb 2022 11:41:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:27672 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241161AbiBAQl1 (ORCPT ); Tue, 1 Feb 2022 11:41:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643733687; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PC8NZ8lG/hbKxyQngU3kWuHlJ5Tl5ht+lJl5+tMvXcM=; b=B7hNIJLRf1rknpzQE3GYo2p6w/JVO5Gl7gLZ355ox5uncd+RTUsnfsqQsWhXMVx6gUlYQ8 LTGaiG5+tufi9/5kYjuSgTGAS9Kq/2/Vw6gAMXKAyQ85dtabgs6Y76sGjRcd3VdKzXaBbu qvsU9Jr/tlMahM7HCVb3E1Q3SwH4o04= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-655-XeNOkZiYNrC9gA6ixD_JFQ-1; Tue, 01 Feb 2022 11:41:24 -0500 X-MC-Unique: XeNOkZiYNrC9gA6ixD_JFQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E95D41898292; Tue, 1 Feb 2022 16:41:21 +0000 (UTC) Received: from [10.22.19.61] (unknown [10.22.19.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id F14C410A4B53; Tue, 1 Feb 2022 16:41:19 +0000 (UTC) Message-ID: <268a8bdf-4c70-b967-f34c-2293b54186f0@redhat.com> Date: Tue, 1 Feb 2022 11:41:19 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v2 3/3] mm/page_owner: Dump memcg information Content-Language: en-US To: Michal Hocko Cc: Roman Gushchin , Johannes Weiner , Vladimir Davydov , Andrew Morton , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, Ira Weiny , Rafael Aquini References: <20220129205315.478628-1-longman@redhat.com> <20220129205315.478628-4-longman@redhat.com> <12686956-612d-d89b-5641-470d5e913090@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/1/22 05:49, Michal Hocko wrote: > On Mon 31-01-22 13:38:28, Waiman Long wrote: > [...] >> Of course, it is also possible to have a debugfs interface to list those >> dead memcg information, displaying more information about the page that pins >> the memcg will be hard without using the page owner tool. > Yes, you will need page owner or hook into the kernel by other means > (like already mentioned drgn). The question is whether scanning all > existing pages to get that information is the best we can offer. The page_owner tool records the page information at allocation time. There are some slight performance overhead, but it is the memory overhead that is the major drawback of this approach as we need one page_owner structure for each physical page. Page scanning is only done when users read the page_owner debugfs file. Yes, I agree that scanning all the pages is not the most efficient way to get these dead memcg information, but it is what the page_owner tool does. I would argue that this is the most efficient coding-wise to get this information. >> Keeping track of >> the list of dead memcg's may also have some runtime overhead. > Could you be more specific? Offlined memcgs are still part of the > hierarchy IIRC. So it shouldn't be much more than iterating the whole > cgroup tree and collect interesting data about dead cgroups. What I mean is that without piggybacking on top of page_owner, we will to add a lot more code to collect and display those information which may have some overhead of its own. Cheers, Longman