On 2025-05-06 12:13:24 +0200, Vincent Lefevre wrote:
> On 2025-02-21 20:33:21 +0100, Salvatore Bonaccorso wrote:
[...]
> > So size is only showed if sbinfo->max_blocks != shmem_default_max_blocks().
> > 
> > Let's look at shmem_default_max_blocks():
> > 
> >  147 #ifdef CONFIG_TMPFS
> >  148 static unsigned long shmem_default_max_blocks(void)
> >  149 {
> >  150         return totalram_pages() / 2;
> >  151 }
[...]

The bug may be the use of totalram_pages(), while the documentation
says:

> >        size=bytes
[...]
> >               The size may also have a % suffix to limit this  instance
> >               to a percentage of physical RAM.
                                     ^^^^^^^^^^^^

According to https://stackoverflow.com/a/60882958/3782797 (and
the answer given b MistralAI) it is get_num_physpages() that
gives the whole physical memory.

I suspect that totalram_pages() is not constant over the time,
so using it is buggy as there is no way for the user to know
what size is actually used for the 50% default.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)

Reply via email to