From: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Ajit Khaparde <ajit.khaparde@broadcom.com>,
Andrew Morton <akpm@linux-foundation.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Borislav Petkov <bp@suse.de>, Corey Minyard <cminyard@mvista.com>,
Chris Mason <clm@fb.com>,
Christian Brauner <christian.brauner@ubuntu.com>,
David Sterba <dsterba@suse.com>,
Jani Nikula <jani.nikula@linux.intel.com>,
Jason Wang <jasowang@redhat.com>,
Jitendra Bhivare <jitendra.bhivare@broadcom.com>,
John Hubbard <jhubbard@nvidia.com>,
"John S . Gruber" <JohnSGruber@gmail.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Josef Bacik <josef@toxicpanda.com>,
Kees Cook <keescook@chromium.org>,
Ketan Mukadam <ketan.mukadam@broadcom.com>,
Len Brown <lenb@kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Miguel Ojeda <ojeda@kernel.org>,
Mike Rapoport <rppt@linux.ibm.com>,
Nick Desaulniers <ndesaulniers@google.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Russell King <linux@armlinux.org.uk>,
Somnath Kotur <somnath.kotur@broadcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>,
Subbu Seetharaman <subbu.seetharaman@broadcom.com>,
intel-gfx@lists.freedesktop.org, linux-acpi@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-btrfs@vger.kernel.org, linux-scsi@vger.kernel.org,
netdev@vger.kernel.org,
virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 00/17] Add memberof(), split some headers, and slightly simplify code
Date: Fri, 19 Nov 2021 16:06:27 +0100 [thread overview]
Message-ID: <434296d3-8fe1-f1d2-ee9d-ea25d6c4e43e@gmail.com> (raw)
In-Reply-To: <CAK8P3a0qT9tAxFkLN_vJYRcocDW2TcBq79WcYKZFyAG0udZx5Q@mail.gmail.com>
Hi Arnd,
On 11/19/21 15:47, Arnd Bergmann wrote:
> On Fri, Nov 19, 2021 at 12:36 PM Alejandro Colomar
> <alx.manpages@gmail.com> wrote:
>>
>> Alejandro Colomar (17):
>> linux/container_of.h: Add memberof(T, m)
>> Use memberof(T, m) instead of explicit NULL dereference
>> Replace some uses of memberof() by its wrappers
>> linux/memberof.h: Move memberof() to separate header
>> linux/typeof_member.h: Move typeof_member() to a separate header
>> Simplify sizeof(typeof_member()) to sizeof_field()
>> linux/NULL.h: Move NULL to a separate header
>> linux/offsetof.h: Move offsetof(T, m) to a separate header
>> linux/offsetof.h: Implement offsetof() in terms of memberof()
>> linux/container_of.h: Implement container_of_safe() in terms of
>> container_of()
>> linux/container_of.h: Cosmetic
>> linux/container_of.h: Remove unnecessary cast to (void *)
>
> My feeling is that this takes the separation too far: by having this many header
> files that end up being included from practically every single .c file
> in the kernel,
> I think you end up making compile speed worse overall.
>
> If your goal is to avoid having to recompile as much of the kernel
> after touching
> a header, I think a better approach is to help untangle the dependencies, e.g.
> by splitting out type definitions from headers with inline functions (most
> indirect header dependencies are on type definitions) and by focusing on
> linux/fs.h, linux/sched.h, linux/mm.h and how they interact with the rest of the
> headers. At the moment, these are included in most .c files and they in turn
> include a ton of other headers.
Yes, I would like to untangle the dependencies.
The main reason I started doing this splitting
is because I wouldn't be able to include
<linux/stddef.h> in some headers,
because it pulled too much stuff that broke unrelated things.
So that's why I started from there.
I for example would like to get NULL in memberof()
without puling anything else,
so <linux/NULL.h> makes sense for that.
It's clear that every .c wants NULL,
but it's not so clear that every .c wants
everything that <linux/stddef.h> pulls indirectly.
But I'll note that linux/fs.h, linux/sched.h, linux/mm.h are
interesting headers for further splitting.
BTW, I also have a longstanding doubt about
how header files are organized in the kernel,
and which headers can and cannot be included
from which other files.
For example I see that files in samples or scripts or tools,
that redefine many things such as offsetof() or ARRAY_SIZE(),
and I don't know if there's a good reason for that,
or if I should simply remove all that stuff and
include <linux/offsetof.h> everywhere I see offsetof() being used.
Thanks,
Alex
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-11-19 15:09 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 11:36 [PATCH 00/17] Add memberof(), split some headers, and slightly simplify code Alejandro Colomar
2021-11-19 11:36 ` [PATCH 02/17] Use memberof(T, m) instead of explicit NULL dereference Alejandro Colomar
2021-11-23 18:07 ` Rafael J. Wysocki
2021-11-19 12:47 ` [PATCH 00/17] Add memberof(), split some headers, and slightly simplify code Jani Nikula
2021-11-19 13:16 ` Alejandro Colomar (man-pages)
2021-11-19 13:48 ` Jani Nikula
2021-11-19 14:54 ` Andy Shevchenko
2021-11-19 14:47 ` Arnd Bergmann
2021-11-19 15:06 ` Alejandro Colomar (man-pages) [this message]
2021-11-19 15:34 ` Andy Shevchenko
2021-11-19 15:38 ` Alejandro Colomar (man-pages)
2021-11-19 15:57 ` Arnd Bergmann
2021-11-19 16:10 ` Andy Shevchenko
2021-11-19 16:18 ` Arnd Bergmann
2021-11-19 16:22 ` Alejandro Colomar (man-pages)
2021-11-19 16:27 ` Arnd Bergmann
2021-11-19 16:35 ` Andy Shevchenko
2021-11-22 12:36 ` Jonathan Cameron
2021-11-19 16:12 ` Alejandro Colomar (man-pages)
2021-11-19 16:25 ` Arnd Bergmann
2021-11-19 16:37 ` Andy Shevchenko
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=434296d3-8fe1-f1d2-ee9d-ea25d6c4e43e@gmail.com \
--to=alx.manpages@gmail.com \
--cc=JohnSGruber@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=ajit.khaparde@broadcom.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=bjorn.andersson@linaro.org \
--cc=bp@suse.de \
--cc=christian.brauner@ubuntu.com \
--cc=clm@fb.com \
--cc=cminyard@mvista.com \
--cc=dsterba@suse.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jasowang@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=jitendra.bhivare@broadcom.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=josef@toxicpanda.com \
--cc=keescook@chromium.org \
--cc=ketan.mukadam@broadcom.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linux@rasmusvillemoes.dk \
--cc=mst@redhat.com \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=rppt@linux.ibm.com \
--cc=somnath.kotur@broadcom.com \
--cc=sriharsha.basavapatna@broadcom.com \
--cc=subbu.seetharaman@broadcom.com \
--cc=virtualization@lists.linux-foundation.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).