Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3591182rdh; Mon, 27 Nov 2023 19:54:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IGq2/uoGhHl4oy9DR1YW8GJ0s65laCsaBM3sAGN4/33eHbNOcFX2ltghVVIMg5172VaNIxm X-Received: by 2002:a17:902:d384:b0:1cc:4559:ea with SMTP id e4-20020a170902d38400b001cc455900eamr12580967pld.3.1701143645655; Mon, 27 Nov 2023 19:54:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701143645; cv=none; d=google.com; s=arc-20160816; b=kspS84A+dcMjjODyq8Z/e7BXGy37q/6L99jZGpkhyWAi0R2zMNkCuHjJEQZ857GoNs DdHZCRjz6jgRhhcPnI/aCBj975ans5HErjc1eZl73xr2Iz84fjofqvcx39vmuaUeP+tC Gd7he0qHcdWkRLr2xKl59tGNwxxbcUxG4iL6Y8qxrl+NyfrEx41Doqj1b/n3fJs1eTLU 2Z/P2vAd6iqaZqzYZ9oiHLvZPR2VzoTD2PhNqQay6iOxwTpcq+fZI6dd0OMmg0HFzOLH OmaaApfdW3EpkJf5u/azl/mLIpCC6vZhe1wBOLHkvCHLFGOhu5fm0YDRrKKf4Xtm2snj ojJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature:date; bh=ltroLqviQ4lHKFN5qNaVbgM2/VXvtAeYp19q2JtiWHk=; fh=7tVtM+/ehLDX+akwXpdvoe+r5CuEbc+BeFGEV+byNu0=; b=eJAOzWbbNgrfRmbz7SE/BDgfQiXpPywGaCHuFHPXesZPxvusoQoWcEQc/O8xoDfgzE ooQRyE+mehoo3K7MwGX6AJYb35wNTOEqXicgPgVZiIJ8m7MhD8px01m0pS8o8d5OEM2Y iZkjQzK/gTqqioxm0pE3QE3ZcnwRyU+QG3yam8X9pELclKHkstAVq7A665YDNNHhBAB3 QXNc7FnsmwS0NCy3pjGPQwavW73khBw+G2UvLyZE8KcVJKbXsCjPZaio/JqtRAMsPHMs TR74Fa9F8LOAV3t2l077Uigj7HnHpQ9aHn+D60p9LiDdr8i797FYGTvuyMRBjLUEgJgz 8Q+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=RT274r+A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id q3-20020a17090311c300b001ce5b6de761si11496975plh.447.2023.11.27.19.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 19:54:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=RT274r+A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id D9DD2818FBF3; Mon, 27 Nov 2023 19:54:01 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234449AbjK1Dxq (ORCPT + 99 others); Mon, 27 Nov 2023 22:53:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbjK1Dxp (ORCPT ); Mon, 27 Nov 2023 22:53:45 -0500 Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [IPv6:2001:41d0:1004:224b::b4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 401779D for ; Mon, 27 Nov 2023 19:53:51 -0800 (PST) Date: Mon, 27 Nov 2023 22:53:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1701143629; 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: in-reply-to:in-reply-to:references:references; bh=ltroLqviQ4lHKFN5qNaVbgM2/VXvtAeYp19q2JtiWHk=; b=RT274r+AtrfGYjQp6+DSpGZQFDTOVvoa/2NbWP6DrGCzNJJsOgnQYA4aUZQ/9Ogj1HGBGl mVo/SvsDuJNb4RciNGpPODy8k8/kS9jjCdiA5N6uTzUXxK50HHI1qkW/TPJPQJ4IFtZt3T OU13ski2WqJ+SVEmEQ8/F2dzP/Qxjk0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Muchun Song Cc: Qi Zheng , Linux-MM , linux-kernel@vger.kernel.org, Andrew Morton , Roman Gushchin , Dave Chinner Subject: Re: [PATCH 2/7] mm: shrinker: Add a .to_text() method for shrinkers Message-ID: <20231128035345.5c7yc7jnautjpfoc@moria.home.lan> References: <20231122232515.177833-1-kent.overstreet@linux.dev> <20231122232515.177833-3-kent.overstreet@linux.dev> <20231123212411.s6r5ekvkklvhwfra@moria.home.lan> <4caadff7-1df0-45cc-9d43-e616f9e4ddb3@bytedance.com> <20231125003009.tbaxuquny43uwei3@moria.home.lan> <76A1EE85-B62C-49B3-889C-80F9A2A88040@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <76A1EE85-B62C-49B3-889C-80F9A2A88040@linux.dev> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 27 Nov 2023 19:54:02 -0800 (PST) On Tue, Nov 28, 2023 at 11:27:11AM +0800, Muchun Song wrote: > > > > On Nov 25, 2023, at 08:30, Kent Overstreet wrote: > > > > On Fri, Nov 24, 2023 at 11:08:11AM +0800, Qi Zheng wrote: > >> Hi Kent, > >> > >> On 2023/11/24 05:24, Kent Overstreet wrote: > >>> On Thu, Nov 23, 2023 at 11:32:59AM +0800, Qi Zheng wrote: > >>>>> + void (*to_text)(struct seq_buf *, struct shrinker *); > >>>> > >>>> The "to_text" looks a little strange, how about naming it > >>>> "stat_objects"? > >>> > >>> The convention I've been using heavily in bcachefs is > >>> typename_to_text(), or type.to_text(), for debug reports. The > >> > >> OK. > >> > >>> consistency is nice. > >> > >> However, this is inconsistent with the name style of other > >> shrinker callbacks. Please use the "objects" suffix. As for > >> bcachefs's own callback function, you can use typename_to_text() > >> to ensure consistency. > > > > That would be inconsistent with introducing a convention to the wider > > kernel. > > > > I don not think .to_text is a good name. I really do not know what it means > when I first look at this name. I knew you want to report the objects of > shrinks, so why not use .report_objects or stat_objects proposed by Qi. > Although .to_text is only used by bcachefs now, shrinker is a general module > which is not only serving the bcachefs itself. I think it should be better > to use a more straightforward name. No, .report_objects or .stat_objects would be wrong; this isn't generating a report on the objects owned by the shrinker, it's just a report on the statistics of the shrinker itself. That's why the convention is typename_to_text() - generate a text representation of an object of that type.