sysv: Mount cgroup fs for memory pressure information early

Prepare for systemd-254 update.  See #5293 for details.
This commit is contained in:
Xi Ruoyao 2023-07-28 19:59:01 +08:00
parent d0de26cbe0
commit 44674e4c92
No known key found for this signature in database
GPG Key ID: ACAAD20E19E710E3
6 changed files with 37 additions and 11 deletions

View File

@ -1,3 +1,6 @@
2023-07-28 Xi Ruoyao <xry111@xry111.site>
* In mountvirtfs, mount /sys/fs/cgroup for udev from systemd-254.
2023-07-22 Xi Ruoyao <xry111@xry111.site> 2023-07-22 Xi Ruoyao <xry111@xry111.site>
* In mountvirtfs, create symlinks /dev/{fd,std{in,out,err}} and * In mountvirtfs, create symlinks /dev/{fd,std{in,out,err}} and
/dev/core (optional). /dev/core (optional).

View File

@ -63,6 +63,10 @@ case "${1}" in
log_info_msg2 " ${INFO}/dev/shm" log_info_msg2 " ${INFO}/dev/shm"
mount -o nosuid,nodev /dev/shm || failed=1 mount -o nosuid,nodev /dev/shm || failed=1
mkdir -p /sys/fs/cgroup
log_info_msg2 " ${INFO}/sys/fs/cgroup"
mount -o nosuid,noexec,nodev /sys/fs/cgroup || failed=1
(exit ${failed}) (exit ${failed})
evaluate_retval evaluate_retval
if [ "${failed}" = 1 ]; then if [ "${failed}" = 1 ]; then

View File

@ -40,6 +40,19 @@
appropriate for the entry or if needed the entire day's listitem. appropriate for the entry or if needed the entire day's listitem.
--> -->
<listitem revision='sysv'>
<para>2023-07-28</para>
<itemizedlist>
<listitem revision='sysv'>
<para>[xry111] - Enable cgroup-based memory pressure information
in kernel, and add the cgroup file system into /etc/fstab and the
mountvirtfs bootscript. This is a preparation for udev from
systemd-254. Addresses
<ulink url='&lfs-ticket-root;5293'>#5293</ulink>.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem revision='sysv'> <listitem revision='sysv'>
<para>2023-07-22</para> <para>2023-07-22</para>
<itemizedlist> <itemizedlist>

View File

@ -22,17 +22,18 @@
<screen revision="sysv"><userinput>cat &gt; /etc/fstab &lt;&lt; "EOF" <screen revision="sysv"><userinput>cat &gt; /etc/fstab &lt;&lt; "EOF"
<literal># Begin /etc/fstab <literal># Begin /etc/fstab
# file system mount-point type options dump fsck # file system mount-point type options dump fsck
# order # order
/dev/<replaceable>&lt;xxx&gt;</replaceable> / <replaceable>&lt;fff&gt;</replaceable> defaults 1 1 /dev/<replaceable>&lt;xxx&gt;</replaceable> / <replaceable>&lt;fff&gt;</replaceable> defaults 1 1
/dev/<replaceable>&lt;yyy&gt;</replaceable> swap swap pri=1 0 0 /dev/<replaceable>&lt;yyy&gt;</replaceable> swap swap pri=1 0 0
proc /proc proc nosuid,noexec,nodev 0 0 proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0 sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /run tmpfs defaults 0 0 tmpfs /run tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
tmpfs /dev/shm tmpfs nosuid,nodev 0 0 tmpfs /dev/shm tmpfs nosuid,nodev 0 0
cgroup2 /sys/fs/cgroup cgroup2 nosuid,noexec,nodev 0 0
# End /etc/fstab</literal> # End /etc/fstab</literal>
EOF</userinput></screen> EOF</userinput></screen>

View File

@ -135,7 +135,12 @@
[*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE] [*] Randomize the address of the kernel image (KASLR) [CONFIG_RANDOMIZE_BASE]
General setup ---&gt; General setup ---&gt;
[ ] Compile the kernel with warnings as errors [CONFIG_WERROR] [ ] Compile the kernel with warnings as errors [CONFIG_WERROR]
CPU/Task time and stats accounting ---&gt;
[*] Pressure stall information tracking [CONFIG_PSI]
[ ] Require boot parameter to enable pressure stall information tracking [CONFIG_PSI_DEFAULT_DISABLED]
&lt; &gt; Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS] &lt; &gt; Enable kernel headers through /sys/kernel/kheaders.tar.xz [CONFIG_IKHEADERS]
[*] Control Group support [CONFIG_CGROUPS] ---&gt;
[*] Memory controller [CONFIG_MEMCG]
[ ] Configure standard kernel features (expert users) [CONFIG_EXPERT] [ ] Configure standard kernel features (expert users) [CONFIG_EXPERT]
General architecture-dependent options ---&gt; General architecture-dependent options ---&gt;
[*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR] [*] Stack Protector buffer overflow detection [CONFIG_STACKPROTECTOR]

View File

@ -383,7 +383,7 @@
<!ENTITY less-fin-du "4.3 MB"> <!ENTITY less-fin-du "4.3 MB">
<!ENTITY less-fin-sbu "less than 0.1 SBU"> <!ENTITY less-fin-sbu "less than 0.1 SBU">
<!ENTITY lfs-bootscripts-version "20230722"> <!-- Scripts depend on this format --> <!ENTITY lfs-bootscripts-version "20230728"> <!-- Scripts depend on this format -->
<!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB"> <!ENTITY lfs-bootscripts-size "BOOTSCRIPTS-SIZE KB">
<!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.xz"> <!ENTITY lfs-bootscripts-url "&downloads-root;lfs-bootscripts-&lfs-bootscripts-version;.tar.xz">
<!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM"> <!ENTITY lfs-bootscripts-md5 "BOOTSCRIPTS-MD5SUM">