Linux KVM is meant for VM guests and probably therefore was set to 
CONFIG_BASE_SMALL=1.
The discussion "if this makes sense or not" is up to the kernel team but it 
seems this bug has got no attention by them yet :-/.

I was quickly assessing the case and found:
- Linux-generic is on CONFIG_BASE_SMALL=0 in B/F/G/H as one would expect.
- linux-kvm in B/F/G/H was all the time set to CONFIG_BASE_SMALL=0
- the option we talk about here is [1][2]
- IMHO "speed loss for saving a few KB" does not sound right. IIRC linux-kvm 
was meant more for 
  speed than density. We are virtual, but not as small as an embedded 
controller for example.
- This goes back to [3] when linux-kvm was introduced
- I didn't find a commit in [4] that listed any extended reasoning/discussion 
when enabling [5] it.

IMHO I agree and this should be switched in the kernel config.
I don't think that changing the pid-max was wrong. Even older Xenial linux-kvm 
running in 2020 can be considered bigger than what CONFIG_BASE_SMALL was meant 
for.

But further actions are for the kernel Team to consider and make.
Therefore I'm adding a src:linux task, subscribing some more people and
pinging the kernel team internally to get some attention.

[1]: 
https://mirrors.edge.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.11-rc5/2.6.11-rc5-mm1/broken-out/base-small-introduce-the-config_base_small-flag.patch
[2]: https://github.com/torvalds/linux/blob/master/init/Kconfig#L1518
[3]: 
https://kernel.ubuntu.com/~kernel-ppa/config/xenial/linux-kvm/4.4.0-1004.9/amd64-config.flavour.kvm
[5]: 
https://git.launchpad.net/~canonical-kernel/ubuntu/+source/linux-kvm/tree/debian.kvm/config/config.common.ubuntu#n157
[4]: https://git.launchpad.net/~canonical-kernel/ubuntu/+source/linux-kvm

** Also affects: linux (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux-kvm in Ubuntu.
https://bugs.launchpad.net/bugs/1866149

Title:
  CONFIG_BASE_SMALL=1 restricts pid space, which conflicts with systemd
  default sysctl

Status in linux package in Ubuntu:
  Incomplete
Status in linux-kvm package in Ubuntu:
  Confirmed

Bug description:
  I'm not completely sure which package to log this against.

  I'm running the kvm focal minimal cloud image from 20200302. I noticed
  on boot that there was an error complaining that systemd-systemctl
  couldn't update pid_max to the value it wanted:

  systemd-sysctl[117]: Couldn't write '4194304' to 'kernel/pid_max':
  Invalid argument

  Digging into it a bit more, this comes from /usr/lib/sysctl.d/50-pid-max.conf:
  # Bump the numeric PID range to its maximum of 2^22 (from the in-kernel 
default
  # of 2^16), to make PID collisions less likely.
  kernel.pid_max = 4194304

  However, the linux-image-kvm kernel is compiled with
  CONFIG_BASE_SMALL=1

  and this triggers the following code in include/linux/threads.h

  #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
        (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))

  which means that if CONFIG_BASE_SMALL is set we get a maximum limit of
  PAGE_SIZE * 8, which on x86 would be 32768.

  As a workaround I can override it with a file in /etc/sysctl.d/ but
  this shouldn't be needed.

  I really don't know if CONFIG_BASE_SMALL makes any sense on x86 cloud
  images, they really aren't small machines in the scheme of things!

  Cheers

  David

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1866149/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to