Messages in this thread | | | Date | Tue, 11 Apr 2023 05:42:53 +0200 | From | Christoph Hellwig <> | 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.
| |