From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E0A8C2D0DB for ; Fri, 31 Jan 2020 16:01:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E26662082E for ; Fri, 31 Jan 2020 16:01:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E26662082E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5398A6B05C1; Fri, 31 Jan 2020 11:01:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4EADE6B05C3; Fri, 31 Jan 2020 11:01:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 401046B05C5; Fri, 31 Jan 2020 11:01:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0176.hostedemail.com [216.40.44.176]) by kanga.kvack.org (Postfix) with ESMTP id 27CD16B05C1 for ; Fri, 31 Jan 2020 11:01:56 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id C239B18041CFD for ; Fri, 31 Jan 2020 16:01:55 +0000 (UTC) X-FDA: 76438395390.25.horn44_4aeafa7cda22a X-HE-Tag: horn44_4aeafa7cda22a X-Filterd-Recvd-Size: 3588 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 31 Jan 2020 16:01:54 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id c9so9216567wrw.8 for ; Fri, 31 Jan 2020 08:01:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=8hfD+a+L2dxb7XwM4BrTUPq0v1gyUGRH/2kK3KgUx3U=; b=D3EtJBqX2UrzbzVMKkG+0sBEF/tHoYbWruqA7DmR8U9/tXM57Eiv5iJsQKYTVoot4X bhQ3nfKSYVUUyAVMtOKNYUX+k+/MOrSKlONDll3BBwQyN0TCUQVuwIqfoSX5KlHPcUYp Ur1mXLvLRmFwxRd10uewqb3rVuSyPX7N2H2kdvkNIdZYnPvvj8GqmQEOjZFgcAi26wV+ 3wk21VkAyi19UIx7hAs9xDzq7oOm1sM5cnh8RpkCiAxnSwwV3AzNe7xbeqyrwr+5VzKN 0RCb5PW/mi2LUdsTviJqpBSzJD9cs2HZUXhWdXNrSSbc5CdzqCVM3TVg7XdheGpnsEMY aSQA== X-Gm-Message-State: APjAAAVbYrVsqjh6U/7vAbZJSBegW3b0xsvVC66HLXUdoJh4AUGpW70S IfBySBPjqn0quwMJr9BJo74= X-Google-Smtp-Source: APXvYqwmnZwvGFTziucXbfEgzg/Yf/xRwiRsszjeLcoGlAbiusYEE8q3z+TQJFkFc2ZyPjcYRe5S8w== X-Received: by 2002:adf:dfcf:: with SMTP id q15mr12712122wrn.404.1580486513732; Fri, 31 Jan 2020 08:01:53 -0800 (PST) Received: from localhost (ip-37-188-238-177.eurotel.cz. [37.188.238.177]) by smtp.gmail.com with ESMTPSA id s8sm11591855wrt.57.2020.01.31.08.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Jan 2020 08:01:52 -0800 (PST) Date: Fri, 31 Jan 2020 17:01:51 +0100 From: Michal Hocko To: Kirill Tkhai Cc: David Hildenbrand , 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 Message-ID: <20200131160151.GB4520@dhcp22.suse.cz> References: <158047248934.390127.5043060848569612747.stgit@localhost.localdomain> <5f3fc9a9-9a22-ccc3-5971-9783b60807bc@virtuozzo.com> <20200131154735.GA4520@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri 31-01-20 18:49:24, Kirill Tkhai wrote: > On 31.01.2020 18:47, Michal Hocko wrote: > > 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. > > Hm, why isn't the same scheme used in alloc_mem_cgroup_per_node_info() then? Dunno, it's an old code. Probably worth cleaning up. -- Michal Hocko SUSE Labs