lkml.org 
[lkml]   [2023]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2023-04-11 05:45    [W:0.128 / U:1.788 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site