On Wed, 2019-10-09 at 13:17 -0700, -Gary- wrote: > > > @@ -125,14 +128,14 @@ struct shmem_options { > > > #ifdef CONFIG_TMPFS > > > static unsigned long shmem_default_max_blocks(void) > > > { > > > - return totalram_pages() / 2; > > > + return SHMEM_SIZE_DEFAULT; > > > } > > > > > > static unsigned long shmem_default_max_inodes(void) > > > { > > > unsigned long nr_pages = totalram_pages(); > > > > This is now unused. > > Mind telling me what I missed, Qian? > > I pulled from: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > > Latest commit is: > 2019-10-08 15:36:04 -0700 e3280b54afed870d531571212f1fc375df39b7d2 Merge tag 'led-fixes-for-5.4-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds > > My patch is based on that, where the above code still exists, and nr_pages is still referenced below. Apparently, it is making totalram_pages atomic, according to the commit that changed it: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/mm/shmem.c?id=ca79b0c211af63fa3276f0e3fd7dd9ada2439839 > > Should I be pulling from somewhere else, or also re-hacking nr_pages somehow? Ah, you are right that nr_pages is still referenced, but then there could a potentially out of sync? Would that be a problem? Is the compiler just smart enough to call totalram_pages() only once? CPU0: CPU1: unsigned long nr_pages = totalram_pages(); totalram_pages_inc() min(nr_pages - totalhigh_pages(), SHMEM_SIZE_DEFAULT); > > -- Gary > > > > - return min(nr_pages - totalhigh_pages(), nr_pages / 2); > > > + return min(nr_pages - totalhigh_pages(), SHMEM_SIZE_DEFAULT); > > > } > > > #endif