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 1C996C77B7E for ; Tue, 2 May 2023 17:55:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 803A46B0071; Tue, 2 May 2023 13:55:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78CB26B0072; Tue, 2 May 2023 13:55:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62DF8900002; Tue, 2 May 2023 13:55:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 50EE46B0071 for ; Tue, 2 May 2023 13:55:49 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BFB7BAE2E6 for ; Tue, 2 May 2023 15:03:36 +0000 (UTC) X-FDA: 80745634032.18.C6625DA Received: from out-11.mta1.migadu.com (out-11.mta1.migadu.com [95.215.58.11]) by imf15.hostedemail.com (Postfix) with ESMTP id 5B2EFA0682 for ; Tue, 2 May 2023 11:16:39 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=L9Ejkbdl; spf=pass (imf15.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.11 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683026259; 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=NNVXUMOZeoGpfLU/g3IFEb1hzaUHRqGWiLOTQQBIzYs=; b=pbL0lek5ZtBwH58JKfCIe8fWzxY3lJutefwdKqzGAJVHPKDGGleH/Nv5m1rGQMX0DCqytT wW2FRufhuJi4WGJfhGsfKW7MW/xGr3/hfsTwpJ+NK69hyzc8ZCUxSbnw6FIoUY8qZzFijr b35lPelFY60C7IuJok18nH/cFl5HDHo= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=L9Ejkbdl; spf=pass (imf15.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.11 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683026259; a=rsa-sha256; cv=none; b=g/CVFfHGBNRaipVgvlhz/DpH5/HNuV+cg1eZ6L8xnC9MfDstcTu2VmiSj9jQ9BM3bnYFuP xL6nbQN5ix7B4eEeYbq5kUT+ITZXK9sLMnPvQKMcd0AU1oA8w9c1zcNKNHpzw+lPzycFKq HXb20Rr53eHnsGKklpB3NabriuOQtWA= Date: Mon, 1 May 2023 23:17:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1682997481; 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=NNVXUMOZeoGpfLU/g3IFEb1hzaUHRqGWiLOTQQBIzYs=; b=L9EjkbdltRch9MgagDXpSmI/SQ+kmTNwjzD2kEN8waOF/RCt31vTo+jIgPhW0KLguu62G7 jZKDOwsdNq/VcE+v4jYF6hx3mSb878eUweleN/RRxaVLz4V86Oi14XqlhSq7SRWchtaboC hzokkApB+A0wqzQja9W/cxeTQjw0qp4= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: James Bottomley Cc: Suren Baghdasaryan , akpm@linux-foundation.org, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, ldufour@linux.ibm.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org, Andy Shevchenko , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , "Michael S. Tsirkin" , Jason Wang , Noralf =?utf-8?B?VHLDr8K/wr1ubmVz?= Subject: Re: [PATCH 01/40] lib/string_helpers: Drop space in string_get_size's output Message-ID: References: <20230501165450.15352-1-surenb@google.com> <20230501165450.15352-2-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 5B2EFA0682 X-Stat-Signature: iigaom1wq84nicze7j6pxejd8mc95fqc X-HE-Tag: 1683026199-131422 X-HE-Meta: U2FsdGVkX18b9aWdvTnEKeGptJEAFyLwb1h1C8Ia5ipM/KaqvCSLhmeV9g8rt7Kl1Qj2ALteY9Pa2vJzS/F88hyzfKY2vvfEK2ZtueTLjAfdiYUnCxxSR63W4RsTILzKeZmgtqZ90sQYv/DZktbjjCoBICgTL7pSDSxzYN3mKWV8j57irF9pEH7JWp8VQmJhclQYojFLD960oTucyaY4QVa9VSmekWdOfE+v6Fdr7/vxAkF3MUJ++ctJSiJEvqnVvdXQ38JLxXJaJxTBU7mqfLKaN8UxQsrJYz0xjSob6gYbysV06d4tEUCw5xg2/4tvf7fPKyGUbVkJxJKfg2OYuQcwfvW79evpM56srXYgg3JWnybRmL1PkRTQptoWRIZ4AikuE8YE7L89LCrzkoMnp0jgTz2J7MM/oOuVrvKeBX1FM+TiCfcnzoiIXvU5eQrmPbZUo3JoPacgS25efMjZXKbCIxJ7PmPmRaiJfFgh3B1X1geIkCaS6bvV4DShUKBISczBLAedIu/OYCbOawQNBu6wqLglwNrVwon33+yBD4OO+MUBiOWgP9sviIGCQGZdvMNj/CCEnBbM65ShLyEJCfC4C4+AyGbwH0cTLZSyYdJxyM8OZjddTBwhFFhcYkxRFfvBRbYpUlr5HWxuq0vLulUJICFMf7RzyEUQNgnQ7V06LX8/keslj9OUVe1rAgsKf5aO2gb9p0K681rrZjbre7iR8cW4STx3H6/wIWZiAA6c63/VqrIvlhxNApbdIkk/d7dwFz5N5rKl7SIaaC5TRMLp20O8zSbyh+SWVe5ido96NLMMJVJwBjIThY6WON4DJY+CUJXrKoDxYa15VWwc1Omhzeyeg6vE+SX4ibkQT0oCeQSyy+CVru9iKqyAf+J8 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: On Mon, May 01, 2023 at 10:22:18PM -0400, James Bottomley wrote: > It is not used just for debug. It's used all over the kernel for > printing out device sizes. The output mostly goes to the kernel print > buffer, so it's anyone's guess as to what, if any, tools are parsing > it, but the concern about breaking log parsers seems to be a valid one. Ok, there is sd_print_capacity() - but who in their right mind would be trying to scrape device sizes, in human readable units, from log messages when it's available in sysfs/procfs (actually, is it in sysfs? if not, that's an oversight) in more reasonable units? Correct me if I'm wrong, but I've yet to hear about kernel log messages being consider a stable interface, and this seems a bit out there. But, you did write the code :) > > If someone raises a specific objection we'll do something different, > > otherwise I think standardizing on what userspace tooling already > > parses is a good idea. > > If you want to omit the space, why not simply add your own variant? A > string_get_size_nospace() which would use most of the body of this one > as a helper function but give its own snprintf format string at the > end. It's only a couple of lines longer as a patch and has the bonus > that it definitely wouldn't break anything by altering an existing > output. I'm happy to do that - I just wanted to post this version first to see if we can avoid the fragmentation and do a bit of standardizing with how everything else seems to do that.