On 8/9/19 11:02 AM, Michal Hocko wrote:
On Fri 09-08-19 09:19:13, Yang Shi wrote:
OK, so it is a pre-existing problem. Thanks!
On 8/9/19 1:32 AM, Michal Hocko wrote:
On Fri 09-08-19 07:57:44, Yang Shi wrote:This series follows up the discussion happened when reviewing "Make deferred
When doing partial unmap to THP, the pages in the affected range wouldIs this a fallout of the recent deferred freeing work?
be considered to be reclaimable when memory pressure comes in. And,
such pages would be put on deferred split queue and get minus from the
memory statistics (i.e. /proc/meminfo).
For example, when doing THP split test, /proc/meminfo would show:
Before put on lazy free list:
MemTotal:ÂÂÂÂÂÂ 45288336 kB
MemFree:ÂÂÂÂÂÂÂ 43281376 kB
MemAvailable:ÂÂ 43254048 kB
...
Active(anon):ÂÂÂ 1096296 kB
Inactive(anon):ÂÂÂÂ 8372 kB
...
AnonPages:ÂÂÂÂÂÂ 1096264 kB
...
AnonHugePages:ÂÂ 1056768 kB
After put on lazy free list:
MemTotal:ÂÂÂÂÂÂ 45288336 kB
MemFree:ÂÂÂÂÂÂÂ 43282612 kB
MemAvailable:ÂÂ 43255284 kB
...
Active(anon):ÂÂÂ 1094228 kB
Inactive(anon):ÂÂÂÂ 8372 kB
...
AnonPages:ÂÂÂÂÂÂÂÂ 49668 kB
...
AnonHugePages:ÂÂÂÂ 10240 kB
The THPs confusingly look disappeared although they are still on LRU if
you are not familair the tricks done by kernel.
split shrinker memcg aware".
David Rientjes suggested deferred split THP should be accounted intoThanks for the reference.
available memory since they would be shrunk when memory pressure comes in,
just like MADV_FREE pages. For the discussion, please refer to:
https://www.mail-archive.com/linux-kernel@xxxxxxxxxxxxxxx/msg2010115.html
I have to study the code some more but is there any reason why thoseYes, I agree. We may use a more specific name, i.e. DeferredSplitTHP.Accounted the lazy free pages to NR_LAZYFREE, and show them in meminfoThe name is really confusing because I have thought of MADV_FREE immediately.
and other places. With the change the /proc/meminfo would look like:
Before put on lazy free list:
Like deferred split THP and MADV_FREE pages, they could be reclaimed during+LazyFreePages: Cleanly freeable pages under memory pressure (i.e. deferredWhat does that mean actually? I have hard time imagine what cleanly
+ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ split THP).
freeable pages mean.
memory pressure.
If you just go with "DeferredSplitTHP", these ambiguity would go away.
pages are not accounted as proper THPs anymore? Sure they are partially
unmaped but they are still THPs so why cannot we keep them accounted
like that. Having a new counter to reflect that sounds like papering
over the problem to me. But as I've said I might be missing something
important here.
I think we could keep those pages accounted for NR_ANON_THPS since they are still THP although they are unmapped as you mentioned if we just want to fix the improper accounting.
Here the new counter is introduced for patch 2/2 to account deferred split THPs into available memory since NR_ANON_THPS may contain non-deferred split THPs.
I could use an internal counter for deferred split THPs, but if it is accounted by mod_node_page_state, why not just show it in /proc/meminfo? Or we fix NR_ANON_THPS and show deferred split THPs in /proc/meminfo?