linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Kirill Tkhai <ktkhai@virtuozzo.com>
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: Re: [PATCH v2] mm: Allocate shrinker_map on appropriate NUMA node
Date: Fri, 31 Jan 2020 16:47:35 +0100	[thread overview]
Message-ID: <20200131154735.GA4520@dhcp22.suse.cz> (raw)
In-Reply-To: <5f3fc9a9-9a22-ccc3-5971-9783b60807bc@virtuozzo.com>

On Fri 31-01-20 18:00:51, Kirill Tkhai wrote:
[...]
> @@ -333,8 +333,9 @@ static int memcg_expand_one_shrinker_map(struct mem_cgroup *memcg,
>  		/* Not yet online memcg */
>  		if (!old)
>  			return 0;
> -
> -		new = kvmalloc(sizeof(*new) + size, GFP_KERNEL);
> +		/* See comment in alloc_mem_cgroup_per_node_info()*/
> +		tmp = node_state(nid, N_NORMAL_MEMORY) ? nid : NUMA_NO_NODE;
> +		new = kvmalloc_node(sizeof(*new) + size, GFP_KERNEL, tmp);
>  		if (!new)
>  			return -ENOMEM;

I do not think this is a good pattern to copy. Why cannot you simply use
kvmalloc_node with the given node? The allocator should fallback to the
closest node if the given one doesn't have any memory.
-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2020-01-31 15:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 12:09 [PATCH] " 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 [this message]
2020-01-31 15:49       ` Kirill Tkhai
2020-01-31 16:01         ` Michal Hocko
2020-01-31 16:08           ` [PATCH v3] " Kirill Tkhai
2020-01-31 16:18             ` 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=20200131154735.GA4520@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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