From: Willy Tarreau <w@1wt.eu>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
John Ogness <john.ogness@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Yury Norov <ynorov@nvidia.com>,
LKML <linux-kernel@vger.kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Ao Sun <ao.sun@transsion.com>, David Carlier <devnexen@gmail.com>,
Karl Mehltretter <kmehltretter@gmail.com>,
Martin Kaiser <martin@kaiser.cx>,
Pengpeng Hou <pengpeng@iscas.ac.cn>,
Qian-Yu Lin <tiffany019230@gmail.com>,
Rik van Riel <riel@surriel.com>, Rosen Penev <rosenp@gmail.com>,
Shuvam Pandey <shuvampandey1@gmail.com>,
Vineeth Pillai <vineeth@bitbyteword.org>,
Yash Suthar <yashsuthar983@gmail.com>,
Yu Peng <pengyu@kylinos.cn>
Subject: Re: [GIT PULL] tracing: Updates for 7.2
Date: Sat, 20 Jun 2026 11:22:39 +0200 [thread overview]
Message-ID: <ajZb3yhFEEqUrJOj@1wt.eu> (raw)
In-Reply-To: <CAHk-=wiAf8BhqbH_ZxN8LH98MY15KgFtQP58bGYnUJ8QNJ+hkw@mail.gmail.com>
On Fri, Jun 19, 2026 at 01:55:15PM -0700, Linus Torvalds wrote:
> On Fri, 19 Jun 2026 at 13:28, Thomas Gleixner <tglx@kernel.org> wrote:
> >
> > One thing I'm seeing is that the kernel is patently bad in separating
> > data type declarations from actual APIs, where the APIs usually just
> > need a forward declaration of the pointer type. Ditto for struct
> > declarations with pointer types.
>
> We tend to do a lot of inline functions, and that often makes it
> impossible to do the simple "just forward-declare the type".
>
> And often there are fairly good reasons for the inline functions, in
> that they tend to be much safer than macros, both for type checking
> and for the whole "use argument once" reason (they also avoid compiler
> warnings when the argument _isn't_ used).
In haproxy we've had a hard time dealing with circular dependencies and
build time issue for a while and a few years ago we found what looks
like a mostly optimal arrangement. Each include file exists in two
versions:
- one suffixed with "-t" which contains only type declarations
(#define as well as enums, structs etc)
- the main one without "-t" that includes the first one and contains
declarations (extern variables & functions as well as inline)
And all this with a strict rule: no -t file may ever include any of the
other ones. It now works pretty well, and we could significantly reduce
the depth of includes and no longer need to resolve broken inline-to-inline
references. And we discovered that many C files don't even need the main
file and only need types definitions, further reducing build time. Also
we figured that certain -t files only included another one for a single
struct definition that appeared as a pointer, so these were sometimes
replaced with just a forward-declaration before use and that was done.
We made mistakes too, most of our macros that replaced inline functions
tend to be in the main files instead of the -t one as the rule implies,
encouraging to place further macro definitions at the wrong place. But
moving them is no big deal.
If I would change something, it would probably be around long macro
definitions (e.g. series of flags) that are often not needed by other
-t files and only by functions. It's just difficult for me to express
that distinction in a way that's clear enough for eveyrone to respect,
but this could definitely further reduce the preprocessing time of the
types-only "-t" files.
Willy
next prev parent reply other threads:[~2026-06-20 9:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 22:01 [GIT PULL] tracing: Updates for 7.2 Steven Rostedt
2026-06-19 4:23 ` Linus Torvalds
2026-06-19 12:15 ` Steven Rostedt
2026-06-19 14:35 ` Linus Torvalds
2026-06-19 15:40 ` Sebastian Andrzej Siewior
2026-06-19 15:43 ` Linus Torvalds
2026-06-19 18:30 ` Sebastian Andrzej Siewior
2026-06-19 19:07 ` Linus Torvalds
2026-06-19 20:28 ` Thomas Gleixner
2026-06-19 20:55 ` Linus Torvalds
2026-06-20 9:22 ` Willy Tarreau [this message]
2026-06-19 22:28 ` Linus Torvalds
2026-06-19 15:54 ` Steven Rostedt
2026-06-19 16:29 ` Linus Torvalds
2026-06-20 20:24 ` Julia Lawall
2026-06-20 22:19 ` Steven Rostedt
2026-06-20 22:39 ` Linus Torvalds
2026-06-20 23:43 ` Steven Rostedt
2026-06-21 0:18 ` Linus Torvalds
2026-06-21 6:34 ` Steven Rostedt
2026-06-21 7:10 ` Steven Rostedt
2026-06-19 15:19 ` Yury Norov
2026-06-19 15:40 ` Linus Torvalds
2026-06-19 22:18 ` Yury Norov
2026-06-19 4:38 ` pr-tracker-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ajZb3yhFEEqUrJOj@1wt.eu \
--to=w@1wt.eu \
--cc=ao.sun@transsion.com \
--cc=bigeasy@linutronix.de \
--cc=devnexen@gmail.com \
--cc=john.ogness@linutronix.de \
--cc=kmehltretter@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin@kaiser.cx \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=pengpeng@iscas.ac.cn \
--cc=pengyu@kylinos.cn \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=rosenp@gmail.com \
--cc=rostedt@goodmis.org \
--cc=shuvampandey1@gmail.com \
--cc=tglx@kernel.org \
--cc=tiffany019230@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=vineeth@bitbyteword.org \
--cc=yashsuthar983@gmail.com \
--cc=ynorov@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.