Le lun. 23 mars 2026 à 14:23, Pádraig Brady <[email protected]> a écrit :
>
> On 08/03/2026 12:11, Laurent Lyaudet wrote:
> > Hello :),
> >
> > I'm not an expert of kernel and architecture,
> > but I do know some things.
> > For example, I know that Linux keeps frequently accessed files in RAM,
> > and that when writing there are options to ensure that
> > the write finishes only when the file was modified on the HDD, SSD.
> > (More or less since there is a cache also at the SSD,
> > and if I remember correctly,
> > databases software editors sell servers with a custom OS,
> > an enormous amount of RAM and their software
> > to bring better guarantees to the security/validity of data (in case
> > of failure)).
> >
> > When coding bash scripts,
> > I saw (without precise measure)
> > that my code executed faster when I merged consecutive commands into one.
> > In particular for sed (using repeated -e)
> > that, I admit, is not in coreutils,
> > a single sed command was faster than
> > consecutive sed commands.
> >
> > I do know that it is something that is well-known,
> > since it is the reason it is recommended to use Bash or other shells
> > builtins, when possible, instead of spawning a new process.
> >
> > But I wondered :
> > - if the cost is mainly to copy the code in machine language
> > (executable, ELF in case of Linux) to the RAM or the cache,
> > - and if so if there was something in Linux or on some CPUs
> > (AMD?, Intel?, server CPUs?) such that some files can be kept "forever"
> > in L3 Cache since today CPUs L3 Cache is enormous on some
> > CPUs, it would logic that the kernel and the core utils
> > are never removed from the L3 cache to go the RAM.
> > It's kind of a mixte mode between Von Neumann architecture
> > and Harvard architecture,
> > where executable code compared to data would have
> > a privileged mode to stay in cache.
> >
> > Does anybody knows if such a thing exists ?
> > If not, I think it would be a good idea FOR PERFORMANCE.
> > It may be a bad idea for SECURITY
> > because the addresses would always be the same
> > (I'm not an expert of that, that's just my "general specialized" culture
> > in informatics that makes me think that.)
>
> Yes there are two main costs.
> 1. Loading pages from persistent storage.
> 2. Setting up the initial state in the process.
> Both are significant.
>
> You could avoid 1. with something like:
>
> vmtouch -l $(rpm -ql coreutils | grep bin/)
>
> cheers,
> Padraig

Hello Padraig,

Thanks for your attempt to answer.
But I was talking about L3 Cache of CPU,
from what I can see here :
https://hoytech.com/vmtouch/
https://github.com/hoytech/vmtouch/blob/master/vmtouch.pod
vmtouch only deals with RAM cache of filesystem,
not L3 CPU cache.
I already talked of the RAM cache of filesystem in my previous email.
I knew about it and that there could still be a performance difference
with L3 cache.

Best regards,
    Laurent Lyaudet

Reply via email to