Re: [RESEND PATCH 1/2 -mm] mm: account lazy free pages separately

3 messages, 3 authors, 2019-08-15 · open the first message on its own page

Re: [RESEND PATCH 1/2 -mm] mm: account lazy free pages separately

From: Vlastimil Babka <hidden>
Date: 2019-08-14 12:49:22

On 8/9/19 8:26 PM, Yang Shi wrote:
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? 
The answer to "Why not" is that it becomes part of userspace API (btw this
patchset should have CC'd linux-api@ - please do for further iterations) and
even if the implementation detail of deferred splitting might change in the
future, we'll basically have to keep the counter (even with 0 value) in
/proc/meminfo forever.

Also, quite recently we have added the following counter:

KReclaimable: Kernel allocations that the kernel will attempt to reclaim
              under memory pressure. Includes SReclaimable (below), and other
              direct allocations with a shrinker.

Although THP allocations are not exactly "kernel allocations", once they are
unmapped, they are in fact kernel-only, so IMHO it wouldn't be a big stretch to
add the lazy THP pages there?
Or we fix NR_ANON_THPS and show deferred split THPs in /proc/meminfo?
quoted

Re: [RESEND PATCH 1/2 -mm] mm: account lazy free pages separately

From: Michal Hocko <mhocko@kernel.org>
Date: 2019-08-14 12:53:39

On Wed 14-08-19 14:49:18, Vlastimil Babka wrote:
On 8/9/19 8:26 PM, Yang Shi wrote:
quoted
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? 
The answer to "Why not" is that it becomes part of userspace API (btw this
patchset should have CC'd linux-api@ - please do for further iterations) and
even if the implementation detail of deferred splitting might change in the
future, we'll basically have to keep the counter (even with 0 value) in
/proc/meminfo forever.

Also, quite recently we have added the following counter:

KReclaimable: Kernel allocations that the kernel will attempt to reclaim
              under memory pressure. Includes SReclaimable (below), and other
              direct allocations with a shrinker.

Although THP allocations are not exactly "kernel allocations", once they are
unmapped, they are in fact kernel-only, so IMHO it wouldn't be a big stretch to
add the lazy THP pages there?
That would indeed fit in much better than a dedicated counter.
-- 
Michal Hocko
SUSE Labs

Re: [RESEND PATCH 1/2 -mm] mm: account lazy free pages separately

From: Yang Shi <hidden>
Date: 2019-08-15 04:53:41


On 8/14/19 5:49 AM, Vlastimil Babka wrote:
On 8/9/19 8:26 PM, Yang Shi wrote:
quoted
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?
The answer to "Why not" is that it becomes part of userspace API (btw this
patchset should have CC'd linux-api@ - please do for further iterations) and
even if the implementation detail of deferred splitting might change in the
future, we'll basically have to keep the counter (even with 0 value) in
/proc/meminfo forever.

Also, quite recently we have added the following counter:

KReclaimable: Kernel allocations that the kernel will attempt to reclaim
               under memory pressure. Includes SReclaimable (below), and other
               direct allocations with a shrinker.

Although THP allocations are not exactly "kernel allocations", once they are
unmapped, they are in fact kernel-only, so IMHO it wouldn't be a big stretch to
add the lazy THP pages there?
Thanks a lot for the suggestion. I agree it may be a good fit. Hope 
"kernel allocations" not cause confusion. But, we can explain in the 
documentation.
quoted
Or we fix NR_ANON_THPS and show deferred split THPs in /proc/meminfo?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help