From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: David Hildenbrand <david@redhat.com>,
akpm@linux-foundation.org, hannes@cmpxchg.org,
shakeelb@google.com, vdavydov.dev@gmail.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v3] mm: Allocate shrinker_map on appropriate NUMA node
Date: Fri, 31 Jan 2020 19:08:49 +0300 [thread overview]
Message-ID: <fff0e636-4c36-ed10-281c-8cdb0687c839@virtuozzo.com> (raw)
In-Reply-To: <20200131160151.GB4520@dhcp22.suse.cz>
mm: Allocate shrinker_map on appropriate NUMA node
From: Kirill Tkhai <ktkhai@virtuozzo.com>
Despite shrinker_map may be touched from any cpu
(e.g., a bit there may be set by a task running
everywhere); kswapd is always bound to specific
node. So, we will allocate shrinker_map from
related NUMA node to respect its NUMA locality.
Also, this follows generic way we use for allocation
memcg's per-node data.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
v3: Remove node_state() patterns.
v2: Use NUMA_NO_NODE instead of -1.
---
mm/memcontrol.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6f6dc8712e39..c37382f5a43c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -334,7 +334,7 @@ static int memcg_expand_one_shrinker_map(struct mem_cgroup *memcg,
if (!old)
return 0;
- new = kvmalloc(sizeof(*new) + size, GFP_KERNEL);
+ new = kvmalloc_node(sizeof(*new) + size, GFP_KERNEL, nid);
if (!new)
return -ENOMEM;
@@ -378,7 +378,7 @@ static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg)
mutex_lock(&memcg_shrinker_map_mutex);
size = memcg_shrinker_map_size;
for_each_node(nid) {
- map = kvzalloc(sizeof(*map) + size, GFP_KERNEL);
+ map = kvzalloc_node(sizeof(*map) + size, GFP_KERNEL, nid);
if (!map) {
memcg_free_shrinker_maps(memcg);
ret = -ENOMEM;
next prev parent reply other threads:[~2020-01-31 16:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-31 12:09 [PATCH] mm: Allocate shrinker_map on appropriate NUMA node Kirill Tkhai
2020-01-31 14:57 ` David Hildenbrand
2020-01-31 15:00 ` [PATCH v2] " Kirill Tkhai
2020-01-31 15:47 ` Michal Hocko
2020-01-31 15:49 ` Kirill Tkhai
2020-01-31 16:01 ` Michal Hocko
2020-01-31 16:08 ` Kirill Tkhai [this message]
2020-01-31 16:18 ` [PATCH v3] " Michal Hocko
2020-02-03 9:31 ` Kirill Tkhai
2020-01-31 16:20 ` David Hildenbrand
2020-01-31 17:22 ` Shakeel Butt
2020-01-31 22:37 ` Roman Gushchin
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=fff0e636-4c36-ed10-281c-8cdb0687c839@virtuozzo.com \
--to=ktkhai@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=shakeelb@google.com \
--cc=vdavydov.dev@gmail.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).