Skip to contentSkip to conversation

kernel.h: Split out ARRAY_SZIE()

PATCH Alexey Dobriyan 2 participants 7 messages Oct 24, 2022 – Oct 30, 2022

lore
Share & tools
lore
#0 lore raw
Quoted 1 line

include/linux/array_size.h | 13 +++++++++++++

All of this is pessimisation unless you're removing

+#include <linux/array_size.h>

from kernel.h which you aren't doing.

container_of.h is just as silly.

kernel.h might need _some_ cleanup (like panic and tainted stuff) which is rarely used but ARRAY_SIZE()?

#2 lore raw
In reply to Andy Shevchenko
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Alexey Dobriyan
Quoted 1 line

include/linux/array_size.h | 13 +++++++++++++

All of this is pessimisation unless you're removing

+#include <linux/array_size.h>

from kernel.h which you aren't doing.

container_of.h is just as silly.

Quoted 8 lines
Quoted 2 lines

kernel.h might need _some_ cleanup (like panic and tainted stuff) which is rarely used but ARRAY_SIZE()?

Are you suggesting to slow down compilation with inclusion of tons of unneeded stuff in the zillions of drivers?

Or you are talking that we need to abandon most of the headers and combine everything into kernel.h? I think this is what is silly.

Btw, your mail broke the reply chain.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#1 lore raw
In reply to Alexey Dobriyan
Quoted 4 lines · Alexey Dobriyan
Quoted 1 line

include/linux/array_size.h | 13 +++++++++++++

All of this is pessimisation unless you're removing

Quoted 8 lines

+#include <linux/array_size.h>

from kernel.h which you aren't doing.

container_of.h is just as silly.

kernel.h might need _some_ cleanup (like panic and tainted stuff) which is rarely used but ARRAY_SIZE()?

Are you suggesting to slow down compilation with inclusion of tons of unneeded stuff in the zillions of drivers?

Or you are talking that we need to abandon most of the headers and combine everything into kernel.h? I think this is what is silly.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 11 lines · Andy Shevchenko
Quoted 10 lines · Alexey Dobriyan
Quoted 1 line

include/linux/array_size.h | 13 +++++++++++++

All of this is pessimisation unless you're removing

+#include <linux/array_size.h>

from kernel.h which you aren't doing.

container_of.h is just as silly.

Quoted 8 lines
Quoted 2 lines

kernel.h might need _some_ cleanup (like panic and tainted stuff) which is rarely used but ARRAY_SIZE()?

Are you suggesting to slow down compilation with inclusion of tons of unneeded stuff in the zillions of drivers?

Or you are talking that we need to abandon most of the headers and combine everything into kernel.h? I think this is what is silly.

It hard to escape kernel.h so you will be including it anyway. Unless you delete, say, kstrtox.h from kernel.h, it is pointless busywork.

#4 lore raw
Quoted 15 lines · Alexey Dobriyan
Quoted 14 lines · Andy Shevchenko
Quoted 12 lines · Alexey Dobriyan
Quoted 1 line

include/linux/array_size.h | 13 +++++++++++++

All of this is pessimisation unless you're removing

+#include <linux/array_size.h>

from kernel.h which you aren't doing.

container_of.h is just as silly.

kernel.h might need _some_ cleanup (like panic and tainted stuff) which is rarely used but ARRAY_SIZE()?

Quoted 7 lines
Quoted 5 lines

Are you suggesting to slow down compilation with inclusion of tons of unneeded stuff in the zillions of drivers?

Or you are talking that we need to abandon most of the headers and combine everything into kernel.h? I think this is what is silly.

It hard to escape kernel.h so you will be including it anyway.

It's very important to not include it in the headers.

And this split helps to it a lot. We have container_of() or array_size() used in macros and/or inliners that are usually appears in the headers. And if you know what dependency hell means, the kernel.h brings to it a huge mess.

So, try to be constructive, okay?

Quoted 1 line

Unless you delete, say, kstrtox.h from kernel.h, it is pointless busywork.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw
Quoted 24 lines · Andy Shevchenko
Quoted 15 lines · Alexey Dobriyan
Quoted 14 lines · Andy Shevchenko
Quoted 12 lines · Alexey Dobriyan
Quoted 1 line

include/linux/array_size.h | 13 +++++++++++++

All of this is pessimisation unless you're removing

+#include <linux/array_size.h>

from kernel.h which you aren't doing.

container_of.h is just as silly.

kernel.h might need _some_ cleanup (like panic and tainted stuff) which is rarely used but ARRAY_SIZE()?

Quoted 7 lines
Quoted 5 lines

Are you suggesting to slow down compilation with inclusion of tons of unneeded stuff in the zillions of drivers?

Or you are talking that we need to abandon most of the headers and combine everything into kernel.h? I think this is what is silly.

It hard to escape kernel.h so you will be including it anyway.

Quoted 9 lines

It's very important to not include it in the headers.

And this split helps to it a lot. We have container_of() or array_size() used in macros and/or inliners that are usually appears in the headers. And if you know what dependency hell means, the kernel.h brings to it a huge mess.

So, try to be constructive, okay?

Quoted 1 line

Unless you delete, say, kstrtox.h from kernel.h, it is pointless busywork.

I'm very constructive.

Parsing 1 define is faster than opening/reading/closing a file to parse 1 define (it's 2 defines because of header guard).

Therefore extracting 1 macro into separate file without obvious future growth is a pessimisation.

And if you delete #include <array_size.h> from kernel.h and fix all compile failures (which you aren't doing apparently) backporters will hate you for life.

I've tried to delete kstrtox.h, and even allnoconfig had dozens of failures.

#6 lore raw
Quoted 35 lines · Alexey Dobriyan
Quoted 24 lines · Andy Shevchenko
Quoted 15 lines · Alexey Dobriyan
Quoted 14 lines · Andy Shevchenko
Quoted 12 lines · Alexey Dobriyan
Quoted 1 line

include/linux/array_size.h | 13 +++++++++++++

All of this is pessimisation unless you're removing

+#include <linux/array_size.h>

from kernel.h which you aren't doing.

container_of.h is just as silly.

kernel.h might need _some_ cleanup (like panic and tainted stuff) which is rarely used but ARRAY_SIZE()?

Quoted 7 lines
Quoted 5 lines

Are you suggesting to slow down compilation with inclusion of tons of unneeded stuff in the zillions of drivers?

Or you are talking that we need to abandon most of the headers and combine everything into kernel.h? I think this is what is silly.

It hard to escape kernel.h so you will be including it anyway.

Quoted 9 lines

It's very important to not include it in the headers.

And this split helps to it a lot. We have container_of() or array_size() used in macros and/or inliners that are usually appears in the headers. And if you know what dependency hell means, the kernel.h brings to it a huge mess.

So, try to be constructive, okay?

Quoted 1 line

Unless you delete, say, kstrtox.h from kernel.h, it is pointless busywork.

Quoted 7 lines

I'm very constructive.

Parsing 1 define is faster than opening/reading/closing a file to parse 1 define (it's 2 defines because of header guard).

Therefore extracting 1 macro into separate file without obvious future growth is a pessimisation.

You are looking at it at the wrong side. The opening one file inside a single file maybe a way to slow down the compilation, but cleaning up the _headers_ from kernel.h and similar mess is a definite win.

Ingo, for example, unwounded the thread coil for the scheduler code with a significant win. And his work exactly shows why it's right way to go.

Quoted 3 lines

And if you delete #include <array_size.h> from kernel.h and fix all compile failures (which you aren't doing apparently) backporters will hate you for life.

It would need some time to have kernel.h to be hanging as is before we can start cleaning the mess our of it. I prefer to kill the whole header or leave there only really _kernel_ parts.

Quoted 2 lines

I've tried to delete kstrtox.h, and even allnoconfig had dozens of failures.

So, help us and fix them!

Signature · 2 lines
With Best Regards,
Andy Shevchenko