:: Re: [DNG] udev rule to create mount…
Kezdőlap
Delete this message
Reply to this message
Szerző: aitor
Dátum:  
Címzett: dng
Tárgy: Re: [DNG] udev rule to create mount point /dev/hugepages
Hi Adrian,

On 11/7/22 13:39, Adrian Zaugg wrote:
> 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?


It would get incorporated into the packaging of eudev, in the same way as
`/usr/share/initramfs-tools/scripts/init-bottom/udev`.


> 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...


Yes, it is. You can try something like this for your eudev rule:

KERNEL=="node*", SUBSYSTEM=="node", RUN+="your_script.sh"

The script can retrieve the required information from:

/sys/devices/system/node/node[0-9]*/meminfo.

I tried using ATTR{nr_hugepages}!=0 in the rule, but this attribute isn't
listed by `udevadm info`.


> 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]?


I've never used it.

Cheers,

Aitor.