Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp501094pxb; Wed, 1 Sep 2021 03:55:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXSRWT6o1gKh3EYcH0YKbrKdTsuLBl/Bsq4xSG/hLA2MLuieI6y8QV8/rPDXqt+5wVvy25 X-Received: by 2002:a17:906:3699:: with SMTP id a25mr35389566ejc.452.1630493705696; Wed, 01 Sep 2021 03:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630493705; cv=none; d=google.com; s=arc-20160816; b=gFAjtkUCbOk8zRdHT007GMagCpHaQRmKKqyOOaYUljjfo/K1Sr6oXMpv4sCKh4aZUB U7hwkL17TqNPgYR/9mhCZYk5BL2znzBc031Qm3iZCji7+FxC2kbLX/uUTpbKQTrGanmv zjtSfP4+XbAbUrz9/YprA/Tfx7hp2HlIB+Xs1kRXNFX6EnXrHk8D4DBHmyB67NYB+gli gRasDY28z7o2LGuFHsoEZKZMaBms7j6w/geKkXL0eRn+9SI6X2I6P36NyY1JOJ0D/HUw J8Y/C8vpeqr0VUgHozDD03xa2ZSEqtbYq2fB7KDdPMCmmjukhFxj5+N5q7dYJHU7zozk 1l6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zW+p1tJu2N9Wjpk2M7abVhvtcvMOJ1OzLqdRmccxpbk=; b=e2+AJXMmjc+3fttSCiGJFx0XsIXBUL8UoaVOH4VIdKZr8Y0QyYApPITXVaYmwXrVWa 3ZuCnThJJ1xl2MvAq2+Ulb0/J31Kkgy6YDpgtwEcalBndhKB3Pp0grVj6Txl8s3cKt5A QjroN31Dj6gfze2goc7A/r8ZnXYZRIm5ZoElOenRdyHb7Ao5yI1s3Nd1HXcJG4719the cceV3uEFHyr7kMiH+znxOACy54tRwNv7LetDWenCtcl4+gi697uEzF5mJPIGhPMW7JSi MesRIro+6Fq3cYnA3ZHuDXAqKJWgHW5zQbT++xmOxrsB7nsDaUfUH7IVLoYBeuNFQqem VX4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@natalenko.name header.s=dkim-20170712 header.b=bHKixlgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g16si20549740edv.404.2021.09.01.03.54.21; Wed, 01 Sep 2021 03:55:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@natalenko.name header.s=dkim-20170712 header.b=bHKixlgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=natalenko.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236816AbhIAKvn (ORCPT + 99 others); Wed, 1 Sep 2021 06:51:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238520AbhIAKvl (ORCPT ); Wed, 1 Sep 2021 06:51:41 -0400 Received: from vulcan.natalenko.name (vulcan.natalenko.name [IPv6:2001:19f0:6c00:8846:5400:ff:fe0c:dfa0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9290C061575 for ; Wed, 1 Sep 2021 03:50:44 -0700 (PDT) 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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)