Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3543250pxb; Tue, 19 Apr 2022 05:08:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYdFKVtgtglwziabmybU4yJKgyJPNxaT5ozLUTTQ53nqnxCpOHf40F7OvUEctAQ7QWfNVU X-Received: by 2002:a17:90b:3ecd:b0:1d1:7733:a125 with SMTP id rm13-20020a17090b3ecd00b001d17733a125mr20279132pjb.184.1650370095652; Tue, 19 Apr 2022 05:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650370095; cv=none; d=google.com; s=arc-20160816; b=xwxN1+UlEWw9xL6b+npbga0fWje7ej+sQmTE9HUfKDSmWCP3+AWZ7M8cFiexq3uH7T PiLdvD/a1/Rvj4BHn7VMrYdKhtV9KBqslPPoVN7ROujOqk7PZSJalTXOwgd544Ob4ohY EiAr7Fu2/KOasNRnFhpabojXF4c0Rgikr0eUekHT5aBHkLrbWsTAsZfx4M/F1+lKghoL FdYZ7TjbWzCX0at4E/Afg/77Z1gktA9JAeNZ2UB0gVjIPR2VTJwFxXALL1mFUx89cEKj 97HezAer8ciAopvthMVRxSyciiw+z1UqnJFdsM8loHEEV4MW/DZPB6ZekjgcukE2DWAk w+kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=7yVlaY/nyhjE6Muk+l83sEkIAJF4ORmWZ6B4RGNZmjA=; b=LE8ovgU5TwSCJE33SniHCIRPJj39TkEKZw4d+FSJNKkrtMXfaaU52u4hvlSEhYINnS WE5oRgypUWfoyV5tVGWS1M+KNxqNH9l8W5IslomGJ7s1CiglIIgQOYs6OFoxECprq9is C6aEdIi7y5AujducpbF73qZ6COc6zbShvuekaM96ALAKOljaM09LD1JHCqjLMxRbl4fG jGJ4KflnMoV3B5nloAtk6Q+0TZS06Qy4W+8ZiypgUZjIxtP8X4U6J660eEJFyoDHFEqP mAwer+nFQhkbScFoo/N+SaNT1BDI0hjD00EAoh5o9E9XLsr4/ms87KZ9KwiKuZ1caM28 Y49A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=dQrCWZVZ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e124-20020a636982000000b003a2bcad9c75si11565964pgc.502.2022.04.19.05.08.01; Tue, 19 Apr 2022 05:08:15 -0700 (PDT) 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=@linux-foundation.org header.s=korg header.b=dQrCWZVZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348213AbiDSE3z (ORCPT + 99 others); Tue, 19 Apr 2022 00:29:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbiDSE3y (ORCPT ); Tue, 19 Apr 2022 00:29:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F89424F1A for ; Mon, 18 Apr 2022 21:27:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F2714B81125 for ; Tue, 19 Apr 2022 04:27:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53E07C385A7; Tue, 19 Apr 2022 04:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1650342430; bh=U87XC1YEsD2BTQUvV8SJzW0Xi6JkPFRYfotP8FuYOXs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dQrCWZVZ3Vj91DG/8XP28ubGi1QZkqEtifxM67rP1rMkDDavcGrXSeD13dXoMjkCK 9LCptanc9Zpeo+Citnuucwe7rxFq133eT7rW/lrq3LfuIITwvVKLvtA9UaM1R/CLwR pWV7yBj+dkh+iKMYd7gAigkWbqNTd2z7bOqz3uB0= Date: Mon, 18 Apr 2022 21:27:09 -0700 From: Andrew Morton To: Roman Gushchin Cc: linux-mm@kvack.org, Dave Chinner , linux-kernel@vger.kernel.org, Johannes Weiner , Michal Hocko , Shakeel Butt , Yang Shi Subject: Re: [PATCH rfc 0/5] mm: introduce shrinker sysfs interface Message-Id: <20220418212709.42f2ba15e00999bb57086b27@linux-foundation.org> In-Reply-To: <20220416002756.4087977-1-roman.gushchin@linux.dev> References: <20220416002756.4087977-1-roman.gushchin@linux.dev> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 15 Apr 2022 17:27:51 -0700 Roman Gushchin wrote: > There are 50+ different shrinkers in the kernel, many with their own bells and > whistles. Under the memory pressure the kernel applies some pressure on each of > them in the order of which they were created/registered in the system. Some > of them can contain only few objects, some can be quite large. Some can be > effective at reclaiming memory, some not. > > The only existing debugging mechanism is a couple of tracepoints in > do_shrink_slab(): mm_shrink_slab_start and mm_shrink_slab_end. They aren't > covering everything though: shrinkers which report 0 objects will never show up, > there is no support for memcg-aware shrinkers. Shrinkers are identified by their > scan function, which is not always enough (e.g. hard to guess which super > block's shrinker it is having only "super_cache_scan"). They are a passive > mechanism: there is no way to call into counting and scanning of an individual > shrinker and profile it. > > To provide a better visibility and debug options for memory shrinkers > this patchset introduces a /sys/kernel/shrinker interface, to some extent > similar to /sys/kernel/slab. > > For each shrinker registered in the system a folder is created. Please, "directory". > The folder > contains "count" and "scan" files, which allow to trigger count_objects() > and scan_objects() callbacks. For memcg-aware and numa-aware shrinkers > count_memcg, scan_memcg, count_node, scan_node, count_memcg_node > and scan_memcg_node are additionally provided. They allow to get per-memcg > and/or per-node object count and shrink only a specific memcg/node. > > To make debugging more pleasant, the patchset also names all shrinkers, > so that sysfs entries can have more meaningful names. I also was wondering "why not debugfs". > Usage examples: > > ... > > If the output doesn't fit into a single page, "...\n" is printed at the end of > output. Unclear. At the end of what output? > > Roman Gushchin (5): > mm: introduce sysfs interface for debugging kernel shrinker > mm: memcontrol: introduce mem_cgroup_ino() and > mem_cgroup_get_from_ino() > mm: introduce memcg interfaces for shrinker sysfs > mm: introduce numa interfaces for shrinker sysfs > mm: provide shrinkers with names > > arch/x86/kvm/mmu/mmu.c | 2 +- > ... > Nothing under Documentation/!