linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Nico Pache <npache@redhat.com>
To: Matthew Wilcox <willy@infradead.org>, mhocko@suse.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, shakeelb@google.com,
	ktkhai@virtuozzo.com, shy828301@gmail.com, guro@fb.com,
	vbabka@suse.cz, vdavydov.dev@gmail.com, raquini@redhat.com,
	david@redhat.com
Subject: Re: [PATCH v2 1/1] mm/vmscan.c: Prevent allocating shrinker_info on offlined nodes
Date: Tue, 7 Dec 2021 19:25:25 -0500	[thread overview]
Message-ID: <a1c3e952-866d-e3b4-1479-8f04e963bf11@redhat.com> (raw)
In-Reply-To: <Ya/vaGdKHm6Zy3ML@casper.infradead.org>



On 12/7/21 18:34, Matthew Wilcox wrote:
> On Tue, Dec 07, 2021 at 05:40:13PM -0500, Nico Pache wrote:
>> +++ b/mm/vmscan.c
>> @@ -222,13 +222,16 @@ static int expand_one_shrinker_info(struct mem_cgroup *memcg,
>>  	int size = map_size + defer_size;
>>  
>>  	for_each_node(nid) {
>> +		int tmp = nid;
>>  		pn = memcg->nodeinfo[nid];
>>  		old = shrinker_info_protected(memcg, nid);
>>  		/* Not yet online memcg */
>>  		if (!old)
>>  			return 0;
>>  
>> -		new = kvmalloc_node(sizeof(*new) + size, GFP_KERNEL, nid);
>> +		if(!node_online(nid))
>> +			tmp = numa_mem_id();
>> +		new = kvmalloc_node(sizeof(*new) + size, GFP_KERNEL, tmp);
>>  		if (!new)
> 
> Why should this be fixed here and not in, say, kvmalloc_node()?

according to Michal, the caller should be responsible for making sure it is
allocating on a correct node. This avoids adding branches to hot-paths and
wasting cycles. Im not opposed to moving it to kvmalloc_node, but it may result
in masking other issues from other callers.
> 



  reply	other threads:[~2021-12-08  0:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 22:40 [PATCH v2 0/1] Dont allocate pages on a offline node Nico Pache
2021-12-07 22:40 ` [PATCH v2 1/1] mm/vmscan.c: Prevent allocating shrinker_info on offlined nodes Nico Pache
2021-12-07 23:34   ` Matthew Wilcox
2021-12-08  0:25     ` Nico Pache [this message]
2021-12-08  1:53       ` Andrew Morton
2021-12-07 23:44   ` Andrew Morton
2021-12-08  0:26     ` Yang Shi
2021-12-08  0:33       ` Nico Pache
2021-12-08  1:23         ` Yang Shi
2021-12-08  1:26           ` Yang Shi
2021-12-08  7:59             ` Michal Hocko
2021-12-13 19:10               ` Yang Shi
2022-01-10 17:09       ` Rafael Aquini
2022-01-10 17:16         ` Michal Hocko
2022-01-10 17:21           ` Rafael Aquini
2021-12-08  0:40     ` Nico Pache
2021-12-08  7:54       ` Michal Hocko

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=a1c3e952-866d-e3b4-1479-8f04e963bf11@redhat.com \
    --to=npache@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=guro@fb.com \
    --cc=ktkhai@virtuozzo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=raquini@redhat.com \
    --cc=shakeelb@google.com \
    --cc=shy828301@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=vdavydov.dev@gmail.com \
    --cc=willy@infradead.org \
    /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