From: Masahiro Yamada <masahiroy@kernel.org>
To: Yoann Congal <yoann.congal@smile.fr>
Cc: linux-fsdevel@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
x86@kernel.org, "André Almeida" <andrealmeid@igalia.com>,
"Borislav Petkov" <bp@alien8.de>,
"Darren Hart" <dvhart@infradead.org>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"Davidlohr Bueso" <dave@stgolabs.net>,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"H . Peter Anvin" <hpa@zytor.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Jiri Slaby" <jirislaby@kernel.org>,
"John Ogness" <john.ogness@linutronix.de>,
"Josh Triplett" <josh@joshtriplett.org>,
"Matthew Wilcox" <willy@infradead.org>,
"Peter Zijlstra" <peterz@infradead.org>,
"Petr Mladek" <pmladek@suse.com>,
"Sergey Senozhatsky" <senozhatsky@chromium.org>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>
Subject: Re: [PATCH v4 2/3] printk: Change type of CONFIG_BASE_SMALL to bool
Date: Wed, 7 Feb 2024 08:05:07 +0900 [thread overview]
Message-ID: <CAK7LNATzkZSK=hYbShOER=PnR7KVUBrDN=RL2Yyw413uMueiXw@mail.gmail.com> (raw)
In-Reply-To: <20240206001333.1710070-3-yoann.congal@smile.fr>
On Tue, Feb 6, 2024 at 9:13 AM Yoann Congal <yoann.congal@smile.fr> wrote:
>
> CONFIG_BASE_SMALL is currently a type int but is only used as a boolean.
>
> So, change its type to bool and adapt all usages:
> CONFIG_BASE_SMALL == 0 becomes !IS_ENABLED(CONFIG_BASE_SMALL) and
> CONFIG_BASE_SMALL != 0 becomes IS_ENABLED(CONFIG_BASE_SMALL).
>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> ---
> NB: This is preliminary work for the following patch removing
> CONFIG_BASE_FULL (now equivalent to !CONFIG_BASE_SMALL)
>
> v3->v4:
> * Split "switch CONFIG_BASE_SMALL to bool" (this patch) and "Remove the redundant
> config" into two patches
> * keep CONFIG_BASE_SMALL instead of CONFIG_BASE_FULL
> ---
> arch/x86/include/asm/mpspec.h | 6 +++---
> drivers/tty/vt/vc_screen.c | 2 +-
> include/linux/threads.h | 4 ++--
> include/linux/udp.h | 2 +-
> include/linux/xarray.h | 2 +-
> init/Kconfig | 8 ++++----
> kernel/futex/core.c | 2 +-
> kernel/user.c | 2 +-
> 8 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/arch/x86/include/asm/mpspec.h b/arch/x86/include/asm/mpspec.h
> index 4b0f98a8d338d..c01d3105840cf 100644
> --- a/arch/x86/include/asm/mpspec.h
> +++ b/arch/x86/include/asm/mpspec.h
> @@ -15,10 +15,10 @@ extern int pic_mode;
> * Summit or generic (i.e. installer) kernels need lots of bus entries.
> * Maximum 256 PCI busses, plus 1 ISA bus in each of 4 cabinets.
> */
> -#if CONFIG_BASE_SMALL == 0
> -# define MAX_MP_BUSSES 260
> -#else
> +#ifdef CONFIG_BASE_SMALL
> # define MAX_MP_BUSSES 32
> +#else
> +# define MAX_MP_BUSSES 260
> #endif
>
> #define MAX_IRQ_SOURCES 256
> diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
> index 67e2cb7c96eec..da33c6c4691c0 100644
> --- a/drivers/tty/vt/vc_screen.c
> +++ b/drivers/tty/vt/vc_screen.c
> @@ -51,7 +51,7 @@
> #include <asm/unaligned.h>
>
> #define HEADER_SIZE 4u
> -#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)
> +#define CON_BUF_SIZE (IS_ENABLED(CONFIG_BASE_SMALL) ? 256 : PAGE_SIZE)
>
> /*
> * Our minor space:
> diff --git a/include/linux/threads.h b/include/linux/threads.h
> index c34173e6c5f18..1674a471b0b4c 100644
> --- a/include/linux/threads.h
> +++ b/include/linux/threads.h
> @@ -25,13 +25,13 @@
> /*
> * This controls the default maximum pid allocated to a process
> */
> -#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)
> +#define PID_MAX_DEFAULT (IS_ENABLED(CONFIG_BASE_SMALL) ? 0x1000 : 0x8000)
>
> /*
> * A maximum of 4 million PIDs should be enough for a while.
> * [NOTE: PID/TIDs are limited to 2^30 ~= 1 billion, see FUTEX_TID_MASK.]
> */
> -#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
> +#define PID_MAX_LIMIT (IS_ENABLED(CONFIG_BASE_SMALL) ? PAGE_SIZE * 8 : \
> (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
>
> /*
> diff --git a/include/linux/udp.h b/include/linux/udp.h
> index d04188714dca1..b456417fb4515 100644
> --- a/include/linux/udp.h
> +++ b/include/linux/udp.h
> @@ -24,7 +24,7 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
> }
>
> #define UDP_HTABLE_SIZE_MIN_PERNET 128
> -#define UDP_HTABLE_SIZE_MIN (CONFIG_BASE_SMALL ? 128 : 256)
> +#define UDP_HTABLE_SIZE_MIN (IS_ENABLED(CONFIG_BASE_SMALL) ? 128 : 256)
> #define UDP_HTABLE_SIZE_MAX 65536
>
> static inline u32 udp_hashfn(const struct net *net, u32 num, u32 mask)
> diff --git a/include/linux/xarray.h b/include/linux/xarray.h
> index cb571dfcf4b16..3f81ee5f9fb9c 100644
> --- a/include/linux/xarray.h
> +++ b/include/linux/xarray.h
> @@ -1141,7 +1141,7 @@ static inline void xa_release(struct xarray *xa, unsigned long index)
> * doubled the number of slots per node, we'd get only 3 nodes per 4kB page.
> */
> #ifndef XA_CHUNK_SHIFT
> -#define XA_CHUNK_SHIFT (CONFIG_BASE_SMALL ? 4 : 6)
> +#define XA_CHUNK_SHIFT (IS_ENABLED(CONFIG_BASE_SMALL) ? 4 : 6)
> #endif
> #define XA_CHUNK_SIZE (1UL << XA_CHUNK_SHIFT)
> #define XA_CHUNK_MASK (XA_CHUNK_SIZE - 1)
> diff --git a/init/Kconfig b/init/Kconfig
> index d50ebd2a2ce42..d4b16cad98502 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -734,7 +734,7 @@ config LOG_CPU_MAX_BUF_SHIFT
> int "CPU kernel log buffer size contribution (13 => 8 KB, 17 => 128KB)"
> depends on SMP
> range 0 21
> - default 0 if BASE_SMALL != 0
> + default 0 if BASE_SMALL
> default 12
> depends on PRINTK
> help
> @@ -1941,9 +1941,9 @@ config RT_MUTEXES
> default y if PREEMPT_RT
>
> config BASE_SMALL
> - int
> - default 0 if BASE_FULL
> - default 1 if !BASE_FULL
> + bool
> + default y if !BASE_FULL
> + default n
The shortest form would be:
config BASE_SMALL
def_bool !BASE_FULL
But, that is not a big deal, as this hunk will
be removed by 3/3.
Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
--
Best Regards
Masahiro Yamada
next prev parent reply other threads:[~2024-02-06 23:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-06 0:13 [PATCH v4 0/3] printk: CONFIG_BASE_SMALL fix for LOG_CPU_MAX_BUF_SHIFT and removal of CONFIG_BASE_FULL Yoann Congal
2024-02-06 0:13 ` [PATCH v4 1/3] printk: Fix LOG_CPU_MAX_BUF_SHIFT when BASE_SMALL is enabled Yoann Congal
2024-02-06 9:00 ` Petr Mladek
2024-02-06 23:03 ` Masahiro Yamada
2024-02-06 0:13 ` [PATCH v4 2/3] printk: Change type of CONFIG_BASE_SMALL to bool Yoann Congal
2024-02-06 9:01 ` Petr Mladek
2024-02-06 14:24 ` Greg Kroah-Hartman
2024-02-06 23:05 ` Masahiro Yamada [this message]
2024-02-06 0:13 ` [PATCH v4 3/3] printk: Remove redundant CONFIG_BASE_FULL Yoann Congal
2024-02-06 9:04 ` Petr Mladek
2024-02-06 9:08 ` Petr Mladek
2024-02-06 13:25 ` Masahiro Yamada
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='CAK7LNATzkZSK=hYbShOER=PnR7KVUBrDN=RL2Yyw413uMueiXw@mail.gmail.com' \
--to=masahiroy@kernel.org \
--cc=andrealmeid@igalia.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=jirislaby@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=josh@joshtriplett.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=tglx@linutronix.de \
--cc=willemdebruijn.kernel@gmail.com \
--cc=willy@infradead.org \
--cc=x86@kernel.org \
--cc=yoann.congal@smile.fr \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).