From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B55C5C07E97 for ; Tue, 28 Nov 2023 03:53:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 186436B02F2; Mon, 27 Nov 2023 22:53:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1366F6B02F4; Mon, 27 Nov 2023 22:53:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1A216B02F6; Mon, 27 Nov 2023 22:53:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DECFC6B02F2 for ; Mon, 27 Nov 2023 22:53:55 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B0E228017A for ; Tue, 28 Nov 2023 03:53:55 +0000 (UTC) X-FDA: 81505994430.09.9EB5276 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) by imf24.hostedemail.com (Postfix) with ESMTP id C29F8180016 for ; Tue, 28 Nov 2023 03:53:51 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=RT274r+A; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf24.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.181 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701143632; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ltroLqviQ4lHKFN5qNaVbgM2/VXvtAeYp19q2JtiWHk=; b=geBvsFgtlgS4n1AcnLtpiGC3K9xSiO4XXkwfO6xoimCJ7hf3WZu12+2ryqtyibe1IoTC1X Asv4rPsdiB1KDT0olMOR0bAemVLSoBmkQgAU7NzK0WJ0n+3a1BMmAfMklt6nLNlOnwYH/V Im6FxFrBv0fjRtbF/v3BWkPrpHWSH8Q= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=RT274r+A; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf24.hostedemail.com: domain of kent.overstreet@linux.dev designates 91.218.175.181 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701143632; a=rsa-sha256; cv=none; b=5+mON8J+X1L4Nkwnueon+wXx9gQA7NvuoVniiyr563OSoApce/9cgolzWknqclntfHly1h cf2gWn4qwoHPsPuDixK/6WDYJQv2Ob6hQlb2CBKH9Pg+KSgYPPzLEcTUZRIe3RwRl04cjP fiQt9zvY04w03thjvWvzecchv8SWj2g= 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-Rspamd-Queue-Id: C29F8180016 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 7gi7kwb4mze53dnouz3t7sqx4z5h5z4k X-HE-Tag: 1701143631-674993 X-HE-Meta: U2FsdGVkX18Q+TRUKreU33DhhGXTjS7m+SdpXP+VtCYIjgEYClTRoCuofIRAxscPySAnsWr28qECvSCO/E3ZsF0V6SP42ry2LaVhq83JfEWKG1yxpSOuSKrrePlMM2H4+lyfJchWoAsyaambT2w87GHv3+tH/WOhjbn560sFq1ZsjeqE7rMlz1ppr+47Mn6IwxoBieSMEhrf5lPxEvUhjtlWQhegGa7zXqFsc1Y5YoOM1y3M//kb/BmbYImD1nrL8iZVPCEhCVsD7MFNwJ0SI85judqOM3dfEUixdfeQYiQi/RUhSlr4w4wuV+nRW/3Un9SkhmHI4tkIJZBjpiAJOUfUZIRmJ0i713jcdmRsVrD0jwD4zefoePq3qMUXJ+BX9tpOfeMe0RcOQ5aqeTgAFHnyTIxCVFc/+kGRisRZ6QqY8FoT6fucbLfQgtsGIBXKAM+SK2WATq9UMBiTZcxI0Is/PXV99269U4NGMVLb85vNojZYgx7onU4df32SA2BFLM8o7RwjVXd+GQ+yIWUz9rDnmCvPBp0nk6z9Z712Nf4cvOHAM2WlqBW2rdX5Tl87pcGC6EHMSqJenhpIC04by/r2eW7ioh6IfY2u+bLS8vZ8uHAPo4irGb+ufmoZVzp8Bg5PirtymO4nzR89yn0V+KbtQ6zva1JzeN6ivUGLDQS6gm+9cvhh5DtSePs8Jp0m0rEdz/JVEsBHslOZg/8ER53CIe3li1NDh8yTr/Np2dWdFwfiVIEp7eGUdx+gRUcWgsTdFC0buLr+W395nnZJ1MS8ws6la+v4nv7g1zdQ0/cnZbtqlv5RRB3exwxrz3mYvBYD+DT5mzwVt8mRTSHloGQIF6ZWdwRDtLXQXxPV6TUCzDYFmVTCsPCRExGjOUj79FrHKkFf03U0o7yNupVf7CYAuS8ZJTNxiRYGlqwQbFQPvPJ+Kh/Ww/C2FmiT68ERaSEH01rdIwawNvUEXVV 5E8G+N/i 0jfEcouxxAMXMWasq8q5JnHaLjRtOZ6/0AyY3sEQK23NhOuhFP943e+ENk2nII7A3BMTginGJIiDt1Z3XdjLmbf97KbpLHSwtBkE0 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: List-Subscribe: List-Unsubscribe: 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.