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 620C9C4167B for ; Tue, 28 Nov 2023 06:23:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 504266B02FC; Tue, 28 Nov 2023 01:23:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B3ED6B02FD; Tue, 28 Nov 2023 01:23:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37E1F6B02FF; Tue, 28 Nov 2023 01:23:46 -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 28D056B02FC for ; Tue, 28 Nov 2023 01:23:46 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DAC02C01A6 for ; Tue, 28 Nov 2023 06:23:45 +0000 (UTC) X-FDA: 81506372010.11.AB9DFF6 Received: from mail-oa1-f41.google.com (mail-oa1-f41.google.com [209.85.160.41]) by imf08.hostedemail.com (Postfix) with ESMTP id 0CE95160009 for ; Tue, 28 Nov 2023 06:23:42 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=jyvuUOkt; spf=pass (imf08.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.160.41 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701152624; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LbwrnUh6cvf5haA/BX0nPLmj+8uunF8iu3+nmhJrr78=; b=NqMqvjKdFuw74dIEAMy3P8ueqpeIgO3Cq2S6aX0WUCDFJmaQ+4RsABiS8mui4nwGh+Ysq9 6XQghJDe+o95BvqYEd4o5ZhPz0Pmu2MGnJkS4uS45CKbRyEnj5JvtwfYifNaw/Kl81q1AO bDnJqgXIW2SVzNP1jXMU8G8+QSjPFZQ= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=jyvuUOkt; spf=pass (imf08.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.160.41 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701152624; a=rsa-sha256; cv=none; b=79n0f2VZQKsidpsT/kNU586piOjJskSGeI4P7QfwkQl6M5gTj4PDNnl1EugO1lmR2OiqiP INZEnCPWPQBLaW7AjZrsH4sNnYThuipz7ZqRYwDPDjkS5WaA13vAZtP7V9OuC3UbjfYihG +SD50jTSyunrIzyRhXOBbQo6pSYEjzE= Received: by mail-oa1-f41.google.com with SMTP id 586e51a60fabf-1f9f23b4fa2so1038921fac.0 for ; Mon, 27 Nov 2023 22:23:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1701152622; x=1701757422; darn=kvack.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=LbwrnUh6cvf5haA/BX0nPLmj+8uunF8iu3+nmhJrr78=; b=jyvuUOktFu4SgpK90ozXXgTaZQv4GmL9MdVZovTIYgcvAzYhApSL4GP5XJqIaQuRx/ BdzqqvLIBcDs26PgtbHIRoANWJ2Hh1DYlC7BcgopLREm3zz51Ar/VQN5iwSCAnnHrLGi JgOMYILs4OCbwD7iOU/pQ68GOQYNG2QxyoI6GPK4cO5O80sLqauPB5LLaJKX1XOOO6Ow lB2xgAz1cuSFx3dgRhrB8pF5SIqTTKNPuqZ1De5P/zuvEAu7rbafkY+USWPhSpKsI0Rb X1kCUhbwcPuTHSGWUcBNHXj1FiGpQMLWlnMUxd6C0mq99EeEFwhvZNeuta0o/X3Exq46 C/Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701152622; x=1701757422; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LbwrnUh6cvf5haA/BX0nPLmj+8uunF8iu3+nmhJrr78=; b=HDJZHjuR0+RY0X3LF0xl2tx1FYbT/vbiK7wBel75zk6igK9xkifzBGO235jQ+sfPJW k5zKejH2ZGz6dwYS6uZlGRj0wkz6WWp8oaI990rsaJaZV92ZNxv9MgRXtqfjvF9zT9qP C34d6K4HlBUfDoORsbo6XodbVZC5ubTg7XpTukjB+n7xi9gWhNwZv+P+RPWk6qbW8iPY s33x10W8CRvyI7zZEFbkjDygEYCgvV/sIhzLk2QlwVsCLjv8MbGW7FlZNb3r6w9zs5AZ 5F/a8/HYTsnFA+mbkR5Em0arPKUvXZibeV7IfleWq5ipKQ0P+IuwCEsECOnA0Ek2cLAC sgvw== X-Gm-Message-State: AOJu0Yzedn4O/y2Q1NzKB+jPtGA9x+ZDm2vfCqQTOnyT1IFhuPrY+N3D yE+1dqeBf9dZK0+athUBZjDKCw== X-Google-Smtp-Source: AGHT+IG21+YPnBYYcWldFBAfFUJzLBR599msydhlLhyRFGBkuPTAG6cPeRBkjASPTWXnwyDxBVGb2g== X-Received: by 2002:a05:6870:64a2:b0:1fa:138f:5419 with SMTP id cz34-20020a05687064a200b001fa138f5419mr14947863oab.0.1701152621834; Mon, 27 Nov 2023 22:23:41 -0800 (PST) Received: from [10.84.152.29] ([203.208.167.146]) by smtp.gmail.com with ESMTPSA id f11-20020aa78b0b000000b006c31c0dfb69sm8227059pfd.188.2023.11.27.22.23.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Nov 2023 22:23:41 -0800 (PST) Message-ID: Date: Tue, 28 Nov 2023 14:23:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/7] mm: shrinker: Add a .to_text() method for shrinkers Content-Language: en-US To: Kent Overstreet Cc: Muchun Song , Linux-MM , linux-kernel@vger.kernel.org, Andrew Morton , Roman Gushchin , Dave Chinner , Michal Hocko 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> <20231128035345.5c7yc7jnautjpfoc@moria.home.lan> From: Qi Zheng In-Reply-To: <20231128035345.5c7yc7jnautjpfoc@moria.home.lan> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 0CE95160009 X-Rspam-User: X-Stat-Signature: 1g98yr4wxkzkuks1zj8b515zpkbtbxpg X-Rspamd-Server: rspam01 X-HE-Tag: 1701152622-223991 X-HE-Meta: U2FsdGVkX1+y9zT3/3NR7VXGxH8IqV6HMcFZYXBaHvZ1NmNrtOcFq9NV68Q9N/HfpZsVqdjONLeYEmI3GfA/MCX1IdKOc+x7nFmkzGlpMw53fO1DMSYeNnNd2vFYqnQH8NPCRMW1NBxH/RXsoqPDlhTxYMpZ24a8KnnaFOnF5vbXvsXus685EQj64IN+QvU+X3cfGJDMAwn+BLvOFbtCt45ScDktXeZs/eGDTlqP0Y7KSRE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m+vnY85o0TEkfuT+g/c2e/1UAZtDaNmZRbYubEhx+nByjhIMplU2qilkDPJ86NB6O5YE38guRZfA+vbsHl0enMD2GvptjeEtRkUjd8lib9zMWK+GzPdvgqFt9Oxs7rSNREA4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000268, 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 2023/11/28 11:53, Kent Overstreet wrote: > 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. Now I think adding this method might not be a good idea. If we allow shrinkers to report thier own private information, OOM logs may become cluttered. Most people only care about some general information when troubleshooting OOM problem, but not the private information of a shrinker. So I thought maybe we could add some general statistics to the shrinker, but adding private ".to_text" method is not necessary. Also +CC Michal, who is reviwing OOM related patches recently. Thanks, Qi > > That's why the convention is typename_to_text() - generate a text > representation of an object of that type.