# SPDX-License-Identifier: GPL-2.0-only
config CC_VERSION_TEXT
	string
	default "$(CC_VERSION_TEXT)"
	help
	  This is used in unclear ways:

	  - Re-run Kconfig when the compiler is updated
	    The 'default' property references the environment variable,
	    CC_VERSION_TEXT so it is recorded in include/config/auto.conf.cmd.
	    When the compiler is updated, Kconfig will be invoked.

	  - Ensure full rebuild when the compiler is updated
	    include/linux/compiler-version.h contains this option in the comment
	    line so fixdep adds include/config/CC_VERSION_TEXT into the
	    auto-generated dependency. When the compiler is updated, syncconfig
	    will touch it and then every file will be rebuilt.

config CC_IS_GCC
	def_bool $(success,test "$(cc-name)" = GCC)

config GCC_VERSION
	int
	default $(cc-version) if CC_IS_GCC
	default 0

config CC_IS_CLANG
	def_bool $(success,test "$(cc-name)" = Clang)

config CLANG_VERSION
	int
	default $(cc-version) if CC_IS_CLANG
	default 0

config AS_IS_GNU
	def_bool $(success,test "$(as-name)" = GNU)

config AS_IS_LLVM
	def_bool $(success,test "$(as-name)" = LLVM)

config AS_VERSION
	int
	# Use clang version if this is the integrated assembler
	default CLANG_VERSION if AS_IS_LLVM
	default $(as-version)

config LD_IS_BFD
	def_bool $(success,test "$(ld-name)" = BFD)

config LD_VERSION
	int
	default $(ld-version) if LD_IS_BFD
	default 0

config LD_IS_LLD
	def_bool $(success,test "$(ld-name)" = LLD)

config LLD_VERSION
	int
	default $(ld-version) if LD_IS_LLD
	default 0

config RUST_IS_AVAILABLE
	def_bool $(success,$(srctree)/scripts/rust_is_available.sh)
	help
	  This shows whether a suitable Rust toolchain is available (found).

	  Please see Documentation/rust/quick-start.rst for instructions on how
	  to satisfy the build requirements of Rust support.

	  In particular, the Makefile target 'rustavailable' is useful to check
	  why the Rust toolchain is not being detected.

config CC_CAN_LINK
	bool
	default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag)) if 64BIT
	default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag))

config CC_CAN_LINK_STATIC
	bool
	default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m64-flag) -static) if 64BIT
	default $(success,$(srctree)/scripts/cc-can-link.sh $(CC) $(CLANG_FLAGS) $(USERCFLAGS) $(USERLDFLAGS) $(m32-flag) -static)

config CC_HAS_ASM_GOTO_OUTPUT
	def_bool $(success,echo 'int foo(int x) { asm goto ("": "=r"(x) ::: bar); return x; bar: return 0; }' | $(CC) -x c - -c -o /dev/null)

config CC_HAS_ASM_GOTO_TIED_OUTPUT
	depends on CC_HAS_ASM_GOTO_OUTPUT
	# Detect buggy gcc and clang, fixed in gcc-11 clang-14.
	def_bool $(success,echo 'int foo(int *x) { asm goto (".long (%l[bar]) - .": "+m"(*x) ::: bar); return *x; bar: return 0; }' | $CC -x c - -c -o /dev/null)

config GCC_ASM_GOTO_OUTPUT_WORKAROUND
	bool
	depends on CC_IS_GCC && CC_HAS_ASM_GOTO_OUTPUT
	# Fixed in GCC 14, 13.3, 12.4 and 11.5
	# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113921
	default y if GCC_VERSION < 110500
	default y if GCC_VERSION >= 120000 && GCC_VERSION < 120400
	default y if GCC_VERSION >= 130000 && GCC_VERSION < 130300

config TOOLS_SUPPORT_RELR
	def_bool $(success,env "CC=$(CC)" "LD=$(LD)" "NM=$(NM)" "OBJCOPY=$(OBJCOPY)" $(srctree)/scripts/tools-support-relr.sh)

config CC_HAS_ASM_INLINE
	def_bool $(success,echo 'void foo(void) { asm inline (""); }' | $(CC) -x c - -c -o /dev/null)

config CC_HAS_NO_PROFILE_FN_ATTR
	def_bool $(success,echo '__attribute__((no_profile_instrument_function)) int x();' | $(CC) -x c - -c -o /dev/null -Werror)

config PAHOLE_VERSION
	int
	default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE))

config CONSTRUCTORS
	bool

config IRQ_WORK
	def_bool y if SMP

config BUILDTIME_TABLE_SORT
	bool

config THREAD_INFO_IN_TASK
	bool
	help
	  Select this to move thread_info off the stack into task_struct.  To
	  make this work, an arch will need to remove all thread_info fields
	  except flags and fix any runtime bugs.

	  One subtle change that will be needed is to use try_get_task_stack()
	  and put_task_stack() in save_thread_stack_tsk() and get_wchan().

menu "General setup"

config BROKEN
	bool

config BROKEN_ON_SMP
	bool
	depends on BROKEN || !SMP
	default y

config INIT_ENV_ARG_LIMIT
	int
	default 32 if !UML
	default 128 if UML
	help
	  Maximum of each of the number of arguments and environment
	  variables passed to init from the kernel command line.

config COMPILE_TEST
	bool "Compile also drivers which will not load"
	depends on HAS_IOMEM
	help
	  Some drivers can be compiled on a different platform than they are
	  intended to be run on. Despite they cannot be loaded there (or even
	  when they load they cannot be used due to missing HW support),
	  developers still, opposing to distributors, might want to build such
	  drivers to compile-test them.

	  If you are a developer and want to build everything available, say Y
	  here. If you are a user/distributor, say N here to exclude useless
	  drivers to be distributed.

config WERROR
	bool "Compile the kernel with warnings as errors"
	default COMPILE_TEST
	help
	  A kernel build should not cause any compiler warnings, and this
	  enables the '-Werror' (for C) and '-Dwarnings' (for Rust) flags
	  to enforce that rule by default. Certain warnings from other tools
	  such as the linker may be upgraded to errors with this option as
	  well.

	  However, if you have a new (or very old) compiler or linker with odd
	  and unusual warnings, or you have some architecture with problems,
	  you may need to disable this config option in order to
	  successfully build the kernel.

	  If in doubt, say Y.

config UAPI_HEADER_TEST
	bool "Compile test UAPI headers"
	depends on HEADERS_INSTALL && CC_CAN_LINK
	help
	  Compile test headers exported to user-space to ensure they are
	  self-contained, i.e. compilable as standalone units.

	  If you are a developer or tester and want to ensure the exported
	  headers are self-contained, say Y here. Otherwise, choose N.

config LOCALVERSION
	string "Local version - append to kernel release"
	help
	  Append an extra string to the end of your kernel version.
	  This will show up when you type uname, for example.
	  The string you set here will be appended after the contents of
	  any files with a filename matching localversion* in your
	  object and source tree, in that order.  Your total string can
	  be a maximum of 64 characters.

config LOCALVERSION_AUTO
	bool "Automatically append version information to the version string"
	default y
	depends on !COMPILE_TEST
	help
	  This will try to automatically determine if the current tree is a
	  release tree by looking for git tags that belong to the current
	  top of tree revision.

	  A string of the format -gxxxxxxxx will be added to the localversion
	  if a git-based tree is found.  The string generated by this will be
	  appended after any matching localversion* files, and after the value
	  set in CONFIG_LOCALVERSION.

	  (The actual string used here is the first 12 characters produced
	  by running the command:

	    $ git rev-parse --verify HEAD

	  which is done within the script "scripts/setlocalversion".)

config BUILD_SALT
	string "Build ID Salt"
	default ""
	help
	  The build ID is used to link binaries and their debug info. Setting
	  this option will use the value in the calculation of the build id.
	  This is mostly useful for distributions which want to ensure the
	  build is unique between builds. It's safe to leave the default.

config HAVE_KERNEL_GZIP
	bool

config HAVE_KERNEL_BZIP2
	bool

config HAVE_KERNEL_LZMA
	bool

config HAVE_KERNEL_XZ
	bool

config HAVE_KERNEL_LZO
	bool

config HAVE_KERNEL_LZ4
	bool

config HAVE_KERNEL_ZSTD
	bool

config HAVE_KERNEL_UNCOMPRESSED
	bool

choice
	prompt "Kernel compression mode"
	default KERNEL_GZIP
	depends on HAVE_KERNEL_GZIP || HAVE_KERNEL_BZIP2 || HAVE_KERNEL_LZMA || HAVE_KERNEL_XZ || HAVE_KERNEL_LZO || HAVE_KERNEL_LZ4 || HAVE_KERNEL_ZSTD || HAVE_KERNEL_UNCOMPRESSED
	help
	  The linux kernel is a kind of self-extracting executable.
	  Several compression algorithms are available, which differ
	  in efficiency, compression and decompression speed.
	  Compression speed is only relevant when building a kernel.
	  Decompression speed is relevant at each boot.

	  If you have any problems with bzip2 or lzma compressed
	  kernels, mail me (Alain Knaff) <alain@knaff.lu>. (An older
	  version of this functionality (bzip2 only), for 2.4, was
	  supplied by Christian Ludwig)

	  High compression options are mostly useful for users, who
	  are low on disk space (embedded systems), but for whom ram
	  size matters less.

	  If in doubt, select 'gzip'

config KERNEL_GZIP
	bool "Gzip"
	depends on HAVE_KERNEL_GZIP
	help
	  The old and tried gzip compression. It provides a good balance
	  between compression ratio and decompression speed.

config KERNEL_BZIP2
	bool "Bzip2"
	depends on HAVE_KERNEL_BZIP2
	help
	  Its compression ratio and speed is intermediate.
	  Decompression speed is slowest among the choices.  The kernel
	  size is about 10% smaller with bzip2, in comparison to gzip.
	  Bzip2 uses a large amount of memory. For modern kernels you
	  will need at least 8MB RAM or more for booting.

config KERNEL_LZMA
	bool "LZMA"
	depends on HAVE_KERNEL_LZMA
	help
	  This compression algorithm's ratio is best.  Decompression speed
	  is between gzip and bzip2.  Compression is slowest.
	  The kernel size is about 33% smaller with LZMA in comparison to gzip.

config KERNEL_XZ
	bool "XZ"
	depends on HAVE_KERNEL_XZ
	help
	  XZ uses the LZMA2 algorithm and instruction set specific
	  BCJ filters which can improve compression ratio of executable
	  code. The size of the kernel is about 30% smaller with XZ in
	  comparison to gzip. On architectures for which there is a BCJ
	  filter (i386, x86_64, ARM, IA-64, PowerPC, and SPARC), XZ
	  will create a few percent smaller kernel than plain LZMA.

	  The speed is about the same as with LZMA: The decompression
	  speed of XZ is better than that of bzip2 but worse than gzip
	  and LZO. Compression is slow.

config KERNEL_LZO
	bool "LZO"
	depends on HAVE_KERNEL_LZO
	help
	  Its compression ratio is the poorest among the choices. The kernel
	  size is about 10% bigger than gzip; however its speed
	  (both compression and decompression) is the fastest.

config KERNEL_LZ4
	bool "LZ4"
	depends on HAVE_KERNEL_LZ4
	help
	  LZ4 is an LZ77-type compressor with a fixed, byte-oriented encoding.
	  A preliminary version of LZ4 de/compression tool is available at
	  <https://code.google.com/p/lz4/>.

	  Its compression ratio is worse than LZO. The size of the kernel
	  is about 8% bigger than LZO. But the decompression speed is
	  faster than LZO.

config KERNEL_ZSTD
	bool "ZSTD"
	depends on HAVE_KERNEL_ZSTD
	help
	  ZSTD is a compression algorithm targeting intermediate compression
	  with fast decompression speed. It will compress better than GZIP and
	  decompress around the same speed as LZO, but slower than LZ4. You
	  will need at least 192 KB RAM or more for booting. The zstd command
	  line tool is required for compression.

config KERNEL_UNCOMPRESSED
	bool "None"
	depends on HAVE_KERNEL_UNCOMPRESSED
	help
	  Produce uncompressed kernel image. This option is usually not what
	  you want. It is useful for debugging the kernel in slow simulation
	  environments, where decompressing and moving the kernel is awfully
	  slow. This option allows early boot code to skip the decompressor
	  and jump right at uncompressed kernel image.

endchoice

config DEFAULT_INIT
	string "Default init path"
	default ""
	help
	  This option determines the default init for the system if no init=
	  option is passed on the kernel command line. If the requested path is
	  not present, we will still then move on to attempting further
	  locations (e.g. /sbin/init, etc). If this is empty, we will just use
	  the fallback list when init= is not passed.

config DEFAULT_HOSTNAME
	string "Default hostname"
	default "(none)"
	help
	  This option determines the default system hostname before userspace
	  calls sethostname(2). The kernel traditionally uses "(none)" here,
	  but you may wish to use a different default here to make a minimal
	  system more usable with less configuration.

config SYSVIPC
	bool "System V IPC"
	help
	  Inter Process Communication is a suite of library functions and
	  system calls which let processes (running programs) synchronize and
	  exchange information. It is generally considered to be a good thing,
	  and some programs won't run unless you say Y here. In particular, if
	  you want to run the DOS emulator dosemu under Linux (read the
	  DOSEMU-HOWTO, available from <http://www.tldp.org/docs.html#howto>),
	  you'll need to say Y here.

	  You can find documentation about IPC with "info ipc" and also in
	  section 6.4 of the Linux Programmer's Guide, available from
	  <http://www.tldp.org/guides.html>.

config SYSVIPC_SYSCTL
	bool
	depends on SYSVIPC
	depends on SYSCTL
	default y

config SYSVIPC_COMPAT
	def_bool y
	depends on COMPAT && SYSVIPC

config POSIX_MQUEUE
	bool "POSIX Message Queues"
	depends on NET
	help
	  POSIX variant of message queues is a part of IPC. In POSIX message
	  queues every message has a priority which decides about succession
	  of receiving it by a process. If you want to compile and run
	  programs written e.g. for Solaris with use of its POSIX message
	  queues (functions mq_*) say Y here.

	  POSIX message queues are visible as a filesystem called 'mqueue'
	  and can be mounted somewhere if you want to do filesystem
	  operations on message queues.

	  If unsure, say Y.

config POSIX_MQUEUE_SYSCTL
	bool
	depends on POSIX_MQUEUE
	depends on SYSCTL
	default y

config WATCH_QUEUE
	bool "General notification queue"
	default n
	help

	  This is a general notification queue for the kernel to pass events to
	  userspace by splicing them into pipes.  It can be used in conjunction
	  with watches for key/keyring change notifications and device
	  notifications.

	  See Documentation/core-api/watch_queue.rst

config CROSS_MEMORY_ATTACH
	bool "Enable process_vm_readv/writev syscalls"
	depends on MMU
	default y
	help
	  Enabling this option adds the system calls process_vm_readv and
	  process_vm_writev which allow a process with the correct privileges
	  to directly read from or write to another process' address space.
	  See the man page for more details.

config USELIB
	bool "uselib syscall (for libc5 and earlier)"
	default ALPHA || M68K || SPARC
	help
	  This option enables the uselib syscall, a system call used in the
	  dynamic linker from libc5 and earlier.  glibc does not use this
	  system call.  If you intend to run programs built on libc5 or
	  earlier, you may need to enable this syscall.  Current systems
	  running glibc can safely disable this.

config AUDIT
	bool "Auditing support"
	depends on NET
	help
	  Enable auditing infrastructure that can be used with another
	  kernel subsystem, such as SELinux (which requires this for
	  logging of avc messages output).  System call auditing is included
	  on architectures which support it.

config HAVE_ARCH_AUDITSYSCALL
	bool

config AUDITSYSCALL
	def_bool y
	depends on AUDIT && HAVE_ARCH_AUDITSYSCALL
	select FSNOTIFY

source "kernel/irq/Kconfig"
source "kernel/time/Kconfig"
source "kernel/bpf/Kconfig"
source "kernel/Kconfig.preempt"

menu "CPU/Task time and stats accounting"

config VIRT_CPU_ACCOUNTING
	bool

choice
	prompt "Cputime accounting"
	default TICK_CPU_ACCOUNTING

# Kind of a stub config for the pure tick based cputime accounting
config TICK_CPU_ACCOUNTING
	bool "Simple tick based cputime accounting"
	depends on !S390 && !NO_HZ_FULL
	help
	  This is the basic tick based cputime accounting that maintains
	  statistics about user, system and idle time spent on per jiffies
	  granularity.

	  If unsure, say Y.

config VIRT_CPU_ACCOUNTING_NATIVE
	bool "Deterministic task and CPU time accounting"
	depends on HAVE_VIRT_CPU_ACCOUNTING && !NO_HZ_FULL
	select VIRT_CPU_ACCOUNTING
	help
	  Select this option to enable more accurate task and CPU time
	  accounting.  This is done by reading a CPU counter on each
	  kernel entry and exit and on transitions within the kernel
	  between system, softirq and hardirq state, so there is a
	  small performance impact.  In the case of s390 or IBM POWER > 5,
	  this also enables accounting of stolen time on logically-partitioned
	  systems.

config VIRT_CPU_ACCOUNTING_GEN
	bool "Full dynticks CPU time accounting"
	depends on HAVE_CONTEXT_TRACKING_USER
	depends on HAVE_VIRT_CPU_ACCOUNTING_GEN
	depends on GENERIC_CLOCKEVENTS
	select VIRT_CPU_ACCOUNTING
	select CONTEXT_TRACKING_USER
	help
	  Select this option to enable task and CPU time accounting on full
	  dynticks systems. This accounting is implemented by watching every
	  kernel-user boundaries using the context tracking subsystem.
	  The accounting is thus performed at the expense of some significant
	  overhead.

	  For now this is only useful if you are working on the full
	  dynticks subsystem development.

	  If unsure, say N.

endchoice

config IRQ_TIME_ACCOUNTING
	bool "Fine granularity task level IRQ time accounting"
	depends on HAVE_IRQ_TIME_ACCOUNTING && !VIRT_CPU_ACCOUNTING_NATIVE
	help
	  Select this option to enable fine granularity task irq time
	  accounting. This is done by reading a timestamp on each
	  transitions between softirq and hardirq state, so there can be a
	  small performance impact.

	  If in doubt, say N here.

config HAVE_SCHED_AVG_IRQ
	def_bool y
	depends on IRQ_TIME_ACCOUNTING || PARAVIRT_TIME_ACCOUNTING
	depends on SMP

config SCHED_THERMAL_PRESSURE
	bool
	default y if ARM && ARM_CPU_TOPOLOGY
	default y if ARM64
	depends on SMP
	depends on CPU_FREQ_THERMAL
	help
	  Select this option to enable thermal pressure accounting in the
	  scheduler. Thermal pressure is the value conveyed to the scheduler
	  that reflects the reduction in CPU compute capacity resulted from
	  thermal throttling. Thermal throttling occurs when the performance of
	  a CPU is capped due to high operating temperatures.

	  If selected, the scheduler will be able to balance tasks accordingly,
	  i.e. put less load on throttled CPUs than on non/less throttled ones.

	  This requires the architecture to implement
	  arch_update_thermal_pressure() and arch_scale_thermal_pressure().

config BSD_PROCESS_ACCT
	bool "BSD Process Accounting"
	depends on MULTIUSER
	help
	  If you say Y here, a user level program will be able to instruct the
	  kernel (via a special system call) to write process accounting
	  information to a file: whenever a process exits, information about
	  that process will be appended to the file by the kernel.  The
	  information includes things such as creation time, owning user,
	  command name, memory usage, controlling terminal etc. (the complete
	  list is in the struct acct in <file:include/linux/acct.h>).  It is
	  up to the user level program to do useful things with this
	  information.  This is generally a good idea, so say Y.

config BSD_PROCESS_ACCT_V3
	bool "BSD Process Accounting version 3 file format"
	depends on BSD_PROCESS_ACCT
	default n
	help
	  If you say Y here, the process accounting information is written
	  in a new file format that also logs the process IDs of each
	  process and its parent. Note that this file format is incompatible
	  with previous v0/v1/v2 file formats, so you will need updated tools
	  for processing it. A preliminary version of these tools is available
	  at <http://www.gnu.org/software/acct/>.

config TASKSTATS
	bool "Export task/process statistics through netlink"
	depends on NET
	depends on MULTIUSER
	default n
	help
	  Export selected statistics for tasks/processes through the
	  generic netlink interface. Unlike BSD process accounting, the
	  statistics are available during the lifetime of tasks/processes as
	  responses to commands. Like BSD accounting, they are sent to user
	  space on task exit.

	  Say N if unsure.

config TASK_DELAY_ACCT
	bool "Enable per-task delay accounting"
	depends on TASKSTATS
	select SCHED_INFO
	help
	  Collect information on time spent by a task waiting for system
	  resources like cpu, synchronous block I/O completion and swapping
	  in pages. Such statistics can help in setting a task's priorities
	  relative to other tasks for cpu, io, rss limits etc.

	  Say N if unsure.

config TASK_XACCT
	bool "Enable extended accounting over taskstats"
	depends on TASKSTATS
	help
	  Collect extended task accounting data and send the data
	  to userland for processing over the taskstats interface.

	  Say N if unsure.

config TASK_IO_ACCOUNTING
	bool "Enable per-task storage I/O accounting"
	depends on TASK_XACCT
	help
	  Collect information on the number of bytes of storage I/O which this
	  task has caused.

	  Say N if unsure.

config PSI
	bool "Pressure stall information tracking"
	select KERNFS
	help
	  Collect metrics that indicate how overcommitted the CPU, memory,
	  and IO capacity are in the system.

	  If you say Y here, the kernel will create /proc/pressure/ with the
	  pressure statistics files cpu, memory, and io. These will indicate
	  the share of walltime in which some or all tasks in the system are
	  delayed due to contention of the respective resource.

	  In kernels with cgroup support, cgroups (cgroup2 only) will
	  have cpu.pressure, memory.pressure, and io.pressure files,
	  which aggregate pressure stalls for the grouped tasks only.

	  For more details see Documentation/accounting/psi.rst.

	  Say N if unsure.

config PSI_DEFAULT_DISABLED
	bool "Require boot parameter to enable pressure stall information tracking"
	default n
	depends on PSI
	help
	  If set, pressure stall information tracking will be disabled
	  per default but can be enabled through passing psi=1 on the
	  kernel commandline during boot.

	  This feature adds some code to the task wakeup and sleep
	  paths of the scheduler. The overhead is too low to affect
	  common scheduling-intense workloads in practice (such as
	  webservers, memcache), but it does show up in artificial
	  scheduler stress tests, such as hackbench.

	  If you are paranoid and not sure what the kernel will be
	  used for, say Y.

	  Say N if unsure.

endmenu # "CPU/Task time and stats accounting"

config CPU_ISOLATION
	bool "CPU isolation"
	depends on SMP || COMPILE_TEST
	default y
	help
	  Make sure that CPUs running critical tasks are not disturbed by
	  any source of "noise" such as unbound workqueues, timers, kthreads...
	  Unbound jobs get offloaded to housekeeping CPUs. This is driven by
	  the "isolcpus=" boot parameter.

	  Say Y if unsure.

source "kernel/rcu/Kconfig"

config IKCONFIG
	tristate "Kernel .config support"
	help
	  This option enables the complete Linux kernel ".config" file
	  contents to be saved in the kernel. It provides documentation
	  of which kernel options are used in a running kernel or in an
	  on-disk kernel.  This information can be extracted from the kernel
	  image file with the script scripts/extract-ikconfig and used as
	  input to rebuild the current kernel or to build another kernel.
	  It can also be extracted from a running kernel by reading
	  /proc/config.gz if enabled (below).

config IKCONFIG_PROC
	bool "Enable access to .config through /proc/config.gz"
	depends on IKCONFIG && PROC_FS
	help
	  This option enables access to the kernel configuration file
	  through /proc/config.gz.

config IKHEADERS
	tristate "Enable kernel headers through /sys/kernel/kheaders.tar.xz"
	depends on SYSFS
	help
	  This option enables access to the in-kernel headers that are generated during
	  the build process. These can be used to build eBPF tracing programs,
	  or similar programs.  If you build the headers as a module, a module called
	  kheaders.ko is built which can be loaded on-demand to get access to headers.

config LOG_BUF_SHIFT
	int "Kernel log buffer size (16 => 64KB, 17 => 128KB)"
	range 12 25
	default 17
	depends on PRINTK
	help
	  Select the minimal kernel log buffer size as a power of 2.
	  The final size is affected by LOG_CPU_MAX_BUF_SHIFT config
	  parameter, see below. Any higher size also might be forced
	  by "log_buf_len" boot parameter.

	  Examples:
		     17 => 128 KB
		     16 => 64 KB
		     15 => 32 KB
		     14 => 16 KB
		     13 =>  8 KB
		     12 =>  4 KB

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 12
	depends on PRINTK
	help
	  This option allows to increase the default ring buffer size
	  according to the number of CPUs. The value defines the contribution
	  of each CPU as a power of 2. The used space is typically only few
	  lines however it might be much more when problems are reported,
	  e.g. backtraces.

	  The increased size means that a new buffer has to be allocated and
	  the original static one is unused. It makes sense only on systems
	  with more CPUs. Therefore this value is used only when the sum of
	  contributions is greater than the half of the default kernel ring
	  buffer as defined by LOG_BUF_SHIFT. The default values are set
	  so that more than 16 CPUs are needed to trigger the allocation.

	  Also this option is ignored when "log_buf_len" kernel parameter is
	  used as it forces an exact (power of two) size of the ring buffer.

	  The number of possible CPUs is used for this computation ignoring
	  hotplugging making the computation optimal for the worst case
	  scenario while allowing a simple algorithm to be used from bootup.

	  Examples shift values and their meaning:
		     17 => 128 KB for each CPU
		     16 =>  64 KB for each CPU
		     15 =>  32 KB for each CPU
		     14 =>  16 KB for each CPU
		     13 =>   8 KB for each CPU
		     12 =>   4 KB for each CPU

config PRINTK_INDEX
	bool "Printk indexing debugfs interface"
	depends on PRINTK && DEBUG_FS
	help
	  Add support for indexing of all printk formats known at compile time
	  at <debugfs>/printk/index/<module>.

	  This can be used as part of maintaining daemons which monitor
	  /dev/kmsg, as it permits auditing the printk formats present in a
	  kernel, allowing detection of cases where monitored printks are
	  changed or no longer present.

	  There is no additional runtime cost to printk with this enabled.

#
# Architectures with an unreliable sched_clock() should select this:
#
config HAVE_UNSTABLE_SCHED_CLOCK
	bool

config GENERIC_SCHED_CLOCK
	bool

menu "Scheduler features"

config UCLAMP_TASK
	bool "Enable utilization clamping for RT/FAIR tasks"
	depends on CPU_FREQ_GOV_SCHEDUTIL
	help
	  This feature enables the scheduler to track the clamped utilization
	  of each CPU based on RUNNABLE tasks scheduled on that CPU.

	  With this option, the user can specify the min and max CPU
	  utilization allowed for RUNNABLE tasks. The max utilization defines
	  the maximum frequency a task should use while the min utilization
	  defines the minimum frequency it should use.

	  Both min and max utilization clamp values are hints to the scheduler,
	  aiming at improving its frequency selection policy, but they do not
	  enforce or grant any specific bandwidth for tasks.

	  If in doubt, say N.

config UCLAMP_BUCKETS_COUNT
	int "Number of supported utilization clamp buckets"
	range 5 20
	default 5
	depends on UCLAMP_TASK
	help
	  Defines the number of clamp buckets to use. The range of each bucket
	  will be SCHED_CAPACITY_SCALE/UCLAMP_BUCKETS_COUNT. The higher the
	  number of clamp buckets the finer their granularity and the higher
	  the precision of clamping aggregation and tracking at run-time.

	  For example, with the minimum configuration value we will have 5
	  clamp buckets tracking 20% utilization each. A 25% boosted tasks will
	  be refcounted in the [20..39]% bucket and will set the bucket clamp
	  effective value to 25%.
	  If a second 30% boosted task should be co-scheduled on the same CPU,
	  that task will be refcounted in the same bucket of the first task and
	  it will boost the bucket clamp effective value to 30%.
	  The clamp effective value of a bucket is reset to its nominal value
	  (20% in the example above) when there are no more tasks refcounted in
	  that bucket.

	  An additional boost/capping margin can be added to some tasks. In the
	  example above the 25% task will be boosted to 30% until it exits the
	  CPU. If that should be considered not acceptable on certain systems,
	  it's always possible to reduce the margin by increasing the number of
	  clamp buckets to trade off used memory for run-time tracking
	  precision.

	  If in doubt, use the default value.

endmenu

#
# For architectures that want to enable the support for NUMA-affine scheduler
# balancing logic:
#
config ARCH_SUPPORTS_NUMA_BALANCING
	bool

#
# For architectures that prefer to flush all TLBs after a number of pages
# are unmapped instead of sending one IPI per page to flush. The architecture
# must provide guarantees on what happens if a clean TLB cache entry is
# written after the unmap. Details are in mm/rmap.c near the check for
# should_defer_flush. The architecture should also consider if the full flush
# and the refill costs are offset by the savings of sending fewer IPIs.
config ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH
	bool

config CC_HAS_INT128
	def_bool !$(cc-option,$(m64-flag) -D__SIZEOF_INT128__=0) && 64BIT

config CC_IMPLICIT_FALLTHROUGH
	string
	default "-Wimplicit-fallthrough=5" if CC_IS_GCC && $(cc-option,-Wimplicit-fallthrough=5)
	default "-Wimplicit-fallthrough" if CC_IS_CLANG && $(cc-option,-Wunreachable-code-fallthrough)

# Currently, disable gcc-10+ array-bounds globally.
# It's still broken in gcc-13, so no upper bound yet.
config GCC10_NO_ARRAY_BOUNDS
	def_bool y

config CC_NO_ARRAY_BOUNDS
	bool
	default y if CC_IS_GCC && GCC_VERSION >= 100000 && GCC10_NO_ARRAY_BOUNDS

# Currently, disable -Wstringop-overflow for GCC globally.
config GCC_NO_STRINGOP_OVERFLOW
	def_bool y

config CC_NO_STRINGOP_OVERFLOW
	bool
	default y if CC_IS_GCC && GCC_NO_STRINGOP_OVERFLOW

config CC_STRINGOP_OVERFLOW
	bool
	default y if CC_IS_GCC && !CC_NO_STRINGOP_OVERFLOW

#
# For architectures that know their GCC __int128 support is sound
#
config ARCH_SUPPORTS_INT128
	bool

# For architectures that (ab)use NUMA to represent different memory regions
# all cpu-local but of different latencies, such as SuperH.
#
config ARCH_WANT_NUMA_VARIABLE_LOCALITY
	bool

config NUMA_BALANCING
	bool "Memory placement aware NUMA scheduler"
	depends on ARCH_SUPPORTS_NUMA_BALANCING
	depends on !ARCH_WANT_NUMA_VARIABLE_LOCALITY
	depends on SMP && NUMA && MIGRATION && !PREEMPT_RT
	help
	  This option adds support for automatic NUMA aware memory/task placement.
	  The mechanism is quite primitive and is based on migrating memory when
	  it has references to the node the task is running on.

	  This system will be inactive 