Re: [PATCH] shmem: make shmem default size a define value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > 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);

Ah, I see your point, Qian.  Even with my fledgling skills, I should have thought of that.  The whole point of the commit I referenced was to make the operation atomic so the values would be identical.  I failed there.

The only option then, would be to do something like define SHMEM_SIZE_DEFAULT as 50, and call it as *(SHMEM_SIZE_DEFAULT/100), which feels pretty contrived and silly.

Good news is that I finally see how it probably ended up as it is.  While poking around, I've also started to see this type of math throughout the entire kernel, such as the hibernate subsystem, where 2/5 is used.  Since I am not going to take up the task of finding and changing all of them...  best to leave well enough alone.

This has been a very educational experience.  It has been fun to really dig into the MM corner of the kernel, and get to understand things on a deeper level.  A lot going on in there!

You've been so patient and gracious.  Thank you for your time, and walking me through the thinking.  I will apply my efforts in other areas.  <^)

-- Gary




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux