lkml.org 
[lkml]   [2021]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 1/1] mm/vmscan.c: Prevent allocating shrinker_info on offlined nodes
On Tue, 7 Dec 2021 19:25:25 -0500 Nico Pache <npache@redhat.com> wrote:

>
>
> 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.
> >

Yes, kvmalloc_node(nid) should allocate on `nid', or should fail.

A new kvmalloc_try_node() or whatever would express this idea.

\
 
 \ /
  Last update: 2021-12-08 02:54    [W:0.064 / U:1.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site