From: -Gary- <me@garybgenett.net>
To: Qian Cai <cai@lca.pw>
Cc: Vlastimil Babka <vbabka@suse.cz>, Hugh Dickins <hughd@google.com>,
linux-mm@kvack.org
Subject: Re: [PATCH] shmem: make shmem default size a define value
Date: Wed, 9 Oct 2019 16:17:11 -0700 [thread overview]
Message-ID: <20191009231710.GH22291@spider> (raw)
In-Reply-To: <1570654587.5937.18.camel@lca.pw>
> > 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
prev parent reply other threads:[~2019-10-09 23:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 18:46 [PATCH] shmem: make shmem default size a define value Gary B. Genett
2019-10-09 19:01 ` Qian Cai
2019-10-09 20:17 ` -Gary-
2019-10-09 20:56 ` Qian Cai
2019-10-09 23:17 ` -Gary- [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191009231710.GH22291@spider \
--to=me@garybgenett.net \
--cc=cai@lca.pw \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).