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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D834FC432BE for ; Wed, 1 Sep 2021 10:50:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 48D7E61053 for ; Wed, 1 Sep 2021 10:50:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 48D7E61053 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=natalenko.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id B81046B006C; Wed, 1 Sep 2021 06:50:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B2F776B0071; Wed, 1 Sep 2021 06:50:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1EB58D0001; Wed, 1 Sep 2021 06:50:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0207.hostedemail.com [216.40.44.207]) by kanga.kvack.org (Postfix) with ESMTP id 8EB356B006C for ; Wed, 1 Sep 2021 06:50:48 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4A6EB8249980 for ; Wed, 1 Sep 2021 10:50:48 +0000 (UTC) X-FDA: 78538686576.03.2F2307A Received: from vulcan.natalenko.name (vulcan.natalenko.name [104.207.131.136]) by imf17.hostedemail.com (Postfix) with ESMTP id D1596F00038D for ; Wed, 1 Sep 2021 10:50:44 +0000 (UTC) Received: from spock.localnet (unknown [151.237.229.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vulcan.natalenko.name (Postfix) with ESMTPSA id 5184CBC775E; Wed, 1 Sep 2021 12:50:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=natalenko.name; s=dkim-20170712; t=1630493442; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zW+p1tJu2N9Wjpk2M7abVhvtcvMOJ1OzLqdRmccxpbk=; b=bHKixlgHso8h1k0nJUYPuLqMnU0iXL+FpzIsKt+e0pn9cx8G2b78yuZjp0Q0W7WWbqYY5E jpAmQ9pk0EMzP65egoUoEIQUsN/csZzqR5rp9N0KvDZsOpMlniLR6AGE46n7ZNJ/mTfffg vrPqKDsVHCs95HkSwmRFa9vilR0flT8= From: Oleksandr Natalenko To: Michal Hocko Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , Matthew Wilcox , Greg Kroah-Hartman , Miaohe Lin , Mel Gorman , Stephen Rothwell Subject: Re: [RFC PATCH 1/1] mm: provide one common K(x) macro Date: Wed, 01 Sep 2021 12:50:40 +0200 Message-ID: <5529272.KFOknHQvy8@natalenko.name> In-Reply-To: References: <20210901092149.994791-1-oleksandr@natalenko.name> <20210901092149.994791-2-oleksandr@natalenko.name> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=natalenko.name header.s=dkim-20170712 header.b=bHKixlgH; spf=pass (imf17.hostedemail.com: domain of oleksandr@natalenko.name designates 104.207.131.136 as permitted sender) smtp.mailfrom=oleksandr@natalenko.name; dmarc=pass (policy=reject) header.from=natalenko.name X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: D1596F00038D X-Stat-Signature: 6witbdx3upiqm88nef78wsuejq4a8ysn X-HE-Tag: 1630493444-329938 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: Hello. On st=C5=99eda 1. z=C3=A1=C5=99=C3=AD 2021 12:31:36 CEST Michal Hocko wrote: > On Wed 01-09-21 11:21:49, Oleksandr Natalenko wrote: > > There are various places where the K(x) macro is defined. This commit > > gets rid of multiple definitions and provides a common one. > >=20 > > This doesn't solve open-coding this macro in various other places. This > > should be addressed by another subsequent commit. >=20 > Why is this an improvement? You are adding a header file for a single > macro which sounds like an overkill. I agree a separate header file is an overkill for just one #define, hence still looking for a suggestion on a better place for it. > The overall net outcome is added > lines of code. Not always. There are some long statements like: ``` seq_printf(seq, ",size=3D%luk", sbinfo->max_blocks << (PAGE_SHIFT - 10)); ``` that are split into two lines. With the macro those take one line only: ``` seq_printf(seq, ",size=3D%luk", K(sbinfo->max_blocks)); ``` As of now (counting unposted open-coding replacements) the grand total is: ``` 31 files changed, 104 insertions(+), 90 deletions(-) ``` which is not that horrible. > It is not like K() or any of its variant is adding a > maintenance burden due to code duplication. So why do we want to change > the existing state? =46or me it's about readability. Compare, for instance: ``` seq_put_decimal_ull_width(m, str, (val) << (PAGE_SHIFT-10), 8) ``` and ``` seq_put_decimal_ull_width(m, str, K(val), 8) ``` It's a small yet visible difference. Thanks. =2D-=20 Oleksandr Natalenko (post-factum)