[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230411034253.GC15679@lst.de>
Date: Tue, 11 Apr 2023 05:42:53 +0200
From: Christoph Hellwig <hch@....de>
To: "Michael Kelley (LINUX)" <mikelley@...rosoft.com>
Cc: Christoph Hellwig <hch@....de>,
"m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
"robin.murphy@....com" <robin.murphy@....com>,
Dexuan Cui <decui@...rosoft.com>,
Tianyu Lan <Tianyu.Lan@...rosoft.com>,
"iommu@...ts.linux.dev" <iommu@...ts.linux.dev>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 1/1] swiotlb: Track and report io_tlb_used high
water mark in debugfs
On Fri, Apr 07, 2023 at 10:01:13PM +0000, Michael Kelley (LINUX) wrote:
> I coded the way I did to follow the kernel coding style guidance
> that prefers converting a Kconfig symbol into a C boolean
> expression, and using it in a normal C conditional instead of
> using #ifdef. If CONFIG_DEBUG_FS=n, the compiler will constant
> fold the conditional away so there's no runtime overhead. I
> like the way that approached worked out in this case, but if you prefer
> separate functions with #ifdef and stubs, I don't feel strongly either way.
I don't think there is a a hard and clear rule. Actual ifdefs have the
benefit of allowing to actually remove struct fields as well. But
the important bit is that I do want the accounting in helpers instead
of in the main swiotlb logic. And once you do that, having #ifdefed
stubs for the functions make sense to me.
Powered by blists - more mailing lists