mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: akpm@linux-foundation.org
To: guro@fb.com, hannes@cmpxchg.org, mhocko@suse.com,
	mm-commits@vger.kernel.org, shakeelb@google.com,
	songmuchun@bytedance.com
Subject: [merged] mm-memcontrol-fix-kernel-stack-account.patch removed from -mm tree
Date: Sat, 08 May 2021 15:40:56 -0700	[thread overview]
Message-ID: <20210508224056.gcv_0wqcz%akpm@linux-foundation.org> (raw)


The patch titled
     Subject: mm: memcontrol: fix kernel stack account
has been removed from the -mm tree.  Its filename was
     mm-memcontrol-fix-kernel-stack-account.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Muchun Song <songmuchun@bytedance.com>
Subject: mm: memcontrol: fix kernel stack account

For simplification 991e7673859e ("mm: memcontrol: account kernel stack per
node") has changed the per zone vmalloc backed stack pages accounting to
per node.  By doing that we have lost a certain precision because those
pages might live in different NUMA nodes.  In the end NR_KERNEL_STACK_KB
exported to the userspace might be over estimated on some nodes while
underestimated on others.  But this is not a real world problem, just a
problem found by reading the code.  So there is no actual data to showing
how much impact it has on users.

This doesn't impose any real problem to correctnes of the kernel behavior
as the counter is not used for any internal processing but it can cause
some confusion to the userspace.

Address the problem by accounting each vmalloc backing page to its own
node.

Link: https://lkml.kernel.org/r/20210303151843.81156-1-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/fork.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- a/kernel/fork.c~mm-memcontrol-fix-kernel-stack-account
+++ a/kernel/fork.c
@@ -380,14 +380,17 @@ static void account_kernel_stack(struct
 	void *stack = task_stack_page(tsk);
 	struct vm_struct *vm = task_stack_vm_area(tsk);
 
+	if (vm) {
+		int i;
 
-	/* All stack pages are in the same node. */
-	if (vm)
-		mod_lruvec_page_state(vm->pages[0], NR_KERNEL_STACK_KB,
-				      account * (THREAD_SIZE / 1024));
-	else
+		for (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++)
+			mod_lruvec_page_state(vm->pages[i], NR_KERNEL_STACK_KB,
+					      account * (PAGE_SIZE / 1024));
+	} else {
+		/* All stack pages are in the same node. */
 		mod_lruvec_kmem_state(stack, NR_KERNEL_STACK_KB,
 				      account * (THREAD_SIZE / 1024));
+	}
 }
 
 static int memcg_charge_kernel_stack(struct task_struct *tsk)
_

Patches currently in -mm which might be from songmuchun@bytedance.com are



                 reply	other threads:[~2021-05-08 22:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210508224056.gcv_0wqcz%akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=mm-commits@vger.kernel.org \
    --cc=shakeelb@google.com \
    --cc=songmuchun@bytedance.com \
    /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).