From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Brendan Higgins <brendanhiggins@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Alexey Dobriyan <adobriyan@gmail.com>,
Miguel Ojeda <ojeda@kernel.org>,
Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kunit-dev@googlegroups.com, linux-media@vger.kernel.org,
netdev@vger.kernel.org, bpf@vger.kernel.org,
"Rafael J. Wysocki" <rafael@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>,
Boqun Feng <boqun.feng@gmail.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>, Thomas Graf <tgraf@suug.ch>,
Andrew Morton <akpm@linux-foundation.org>,
jic23@kernel.org, linux@rasmusvillemoes.dk
Subject: Re: [PATCH v1 3/3] kernel.h: Split out container_of() and typeof_memeber() macros
Date: Tue, 13 Jul 2021 14:16:17 +0300 [thread overview]
Message-ID: <YO12ARa3i1TprGnJ@smile.fi.intel.com> (raw)
In-Reply-To: <YO1s+rHEqC9RjMva@kroah.com>
On Tue, Jul 13, 2021 at 12:37:46PM +0200, Greg Kroah-Hartman wrote:
> On Tue, Jul 13, 2021 at 11:45:41AM +0300, Andy Shevchenko wrote:
> > kernel.h is being used as a dump for all kinds of stuff for a long time.
> > Here is the attempt cleaning it up by splitting out container_of() and
> > typeof_memeber() macros.
>
> That feels messy, why?
Because the headers in the kernel are messy.
> Reading one .h file for these common
> macros/defines is fine, why are container_of and typeof somehow
> deserving of their own .h files?
It's explained here. There are tons of drivers that includes kernel.h for only
a few or even solely for container_of() macro.
> What speedups are you seeing by
> splitting this up?
C preprocessing.
> > At the same time convert users in the header and other folders to use it.
> > Though for time being include new header back to kernel.h to avoid twisted
> > indirected includes for existing users.
> >
> > Note, there are _a lot_ of headers and modules that include kernel.h solely
> > for one of these macros and this allows to unburden compiler for the twisted
> > inclusion paths and to make new code cleaner in the future.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> > include/kunit/test.h | 14 ++++++++++++--
> > include/linux/container_of.h | 37 ++++++++++++++++++++++++++++++++++++
> > include/linux/kernel.h | 31 +-----------------------------
> > include/linux/kobject.h | 14 +++++++-------
>
> Why are all of these changes needed to kobject.h for this one change?
> This diff:
>
> > --- a/include/linux/kobject.h
> > +++ b/include/linux/kobject.h
> > @@ -15,18 +15,18 @@
> > #ifndef _KOBJECT_H_
> > #define _KOBJECT_H_
> >
> > -#include <linux/types.h>
> > -#include <linux/list.h>
> > -#include <linux/sysfs.h>
> > +#include <linux/atomic.h>
> > #include <linux/compiler.h>
> > -#include <linux/spinlock.h>
> > +#include <linux/container_of.h>
> > +#include <linux/list.h>
> > #include <linux/kref.h>
> > #include <linux/kobject_ns.h>
> > -#include <linux/kernel.h>
> > #include <linux/wait.h>
> > -#include <linux/atomic.h>
> > -#include <linux/workqueue.h>
> > +#include <linux/spinlock.h>
> > +#include <linux/sysfs.h>
> > +#include <linux/types.h>
> > #include <linux/uidgid.h>
> > +#include <linux/workqueue.h>
>
> Is a lot more changes than the "split the macros out" deserves.
>
> Please make this a separate change, remember to only do one thing at a
> time (this patch is at least 2 changes...)
>
> so NAK, this change isn't ok as-is.
Fair enough. I will remove these conversions from the patch in v2.
Thanks for review!
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2021-07-13 11:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-13 8:45 [PATCH v1 1/3] kernel.h: Don't pollute header with single user macros Andy Shevchenko
2021-07-13 8:45 ` [PATCH v1 2/3] kernel.h: Drop unneeded <linux/kernel.h> inclusion from other headers Andy Shevchenko
2021-07-13 8:45 ` [PATCH v1 3/3] kernel.h: Split out container_of() and typeof_memeber() macros Andy Shevchenko
2021-07-13 10:37 ` Greg Kroah-Hartman
2021-07-13 11:16 ` Andy Shevchenko [this message]
2021-07-13 11:23 ` Greg Kroah-Hartman
2021-07-13 12:19 ` Herbert Xu
2021-07-13 12:45 ` Andy Shevchenko
2021-07-13 13:58 ` David Laight
2021-07-13 18:39 ` Miguel Ojeda
2021-10-07 9:20 ` Andy Shevchenko
2021-10-07 10:00 ` Andy Shevchenko
2021-10-07 15:39 ` Miguel Ojeda
2021-10-07 15:55 ` Andy Shevchenko
2021-07-13 12:38 ` [PATCH v1 1/3] kernel.h: Don't pollute header with single user macros Peter Zijlstra
2021-07-13 12:42 ` 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=YO12ARa3i1TprGnJ@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=boqun.feng@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=brendanhiggins@google.com \
--cc=daniel@iogearbox.net \
--cc=gregkh@linuxfoundation.org \
--cc=herbert@gondor.apana.org.au \
--cc=jic23@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=kunit-dev@googlegroups.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=longman@redhat.com \
--cc=mchehab+huawei@kernel.org \
--cc=mchehab@kernel.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sakari.ailus@linux.intel.com \
--cc=songliubraving@fb.com \
--cc=tgraf@suug.ch \
--cc=will@kernel.org \
--cc=yhs@fb.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox