:: Re: [DNG] udev rule to create mount…
Página Principal
Delete this message
Reply to this message
Autor: Adrian Zaugg
Data:  
Para: dng
Assunto: Re: [DNG] udev rule to create mount point /dev/hugepages
Hi Aitor

It is not meant to make user changes under /usr except under /usr/local; so a
change like your suggestion should get incorporated into the corresponding
package, I think. Or do you see a place somewhere in /etc/initramfs-tools/
scripts/ for it?

>From my understanding udev is responsible to set up /dev so having udev

creating the directory /dev/hugepages would be a cleaner way to go. The rule
should thus be present in /lib/udev/rules.d/ and be packaged with eudev.

On Debian the directory is created in any case, as it seems to me. The systemd
unit checks for the existence of /sys/kernel/mm/hugepages and this seems to
exist no matter whether explicit hugepages are available or not. The test
should read the number of HugePages_Total instead and create the directory if
it is >0. Hence something like this:

if [ $(grep "HugePages_Total:" /proc/meminfo | \
    sed -e "s/^HugePages_Total:[\t ]*//") -gt 0 ]; then
   [...]
fi


I don't know whether it is possible to write as a (e)udev rule for this...

Whatever solution is best, Devuan and Debian are different in this respect.
Devuan does not have a solution at hand. So we need to find out how Devuan
should solve this and ask for the feature from the right packet.

How do you guys set up the mount point for hugetblfs? Just like Torvalds under
/mnt/huge [1]?


Regards, Adrian.


[1] https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/
mm/hugetlbpage.rst


In der Nachricht vom Friday, 8 July 2022 21:19:12 CEST steht:
> Hi Adrian,
>
> On 8/7/22 15:40, Adrian Zaugg wrote:
> > But I'm failing to write a (e)udev rule, that does the following:
> >     if the directory /sys/kernel/mm/hugepages exists,
> >     create the directory /dev/hugepages

> >
> > Thank you very much for your help!
>
> Add a new script named, for example,
> `/usr/share/initramfs-tools/scripts/init-bottom/zz-hugepage` with the
> following code:
>
> #!/bin/sh -e
>
> PREREQS=""
>
> prereqs() { echo "$PREREQS"; }
>
> case "$1" in
>      prereqs)
>      prereqs
>      exit 0
>      ;;
> esac

>
> if [ -d /sys/kernel/mm/hugepages ]; then
>      /bin/mkdir ${rootmnt}/dev/hugepages
> fi

>
> I'm adding the prefix 'zz' to the name of the script because the scripts are
> found in lexical order, and the temporary symlink `${rootmnt}/dev` to the
> final `/dev` for other initramfs scripts is created in
> `/usr/share/initramfs-tools/scripts/init-bottom/udev`.
>
> HTH,
>
> Aitor.