From patchwork Fri Jan 31 16:08:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 11360241 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9995D139A for ; Fri, 31 Jan 2020 16:09:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 704672082E for ; Fri, 31 Jan 2020 16:09:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 704672082E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=virtuozzo.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 97B096B05C5; Fri, 31 Jan 2020 11:09:01 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 953D46B05C7; Fri, 31 Jan 2020 11:09:01 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 81A1F6B05C8; Fri, 31 Jan 2020 11:09:01 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0136.hostedemail.com [216.40.44.136]) by kanga.kvack.org (Postfix) with ESMTP id 5B2906B05C5 for ; Fri, 31 Jan 2020 11:09:01 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 02527BBEF for ; Fri, 31 Jan 2020 16:09:01 +0000 (UTC) X-FDA: 76438413282.27.turn78_88d5087618003 X-Spam-Summary: 2,0,0,ad3b1d5736916ad9,d41d8cd98f00b204,ktkhai@virtuozzo.com,:mhocko@kernel.org:david@redhat.com:akpm@linux-foundation.org:hannes@cmpxchg.org:shakeelb@google.com:vdavydov.dev@gmail.com::linux-kernel@vger.kernel.org,RULES_HIT:41:152:355:379:800:854:960:966:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2194:2196:2199:2200:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3352:3866:3867:3871:4250:4385:5007:6261:7576:7903:8603:10004:10400:11026:11473:11658:11914:12043:12296:12297:12438:12555:12679:12760:13069:13311:13357:14096:14097:14181:14394:14721:21080:21451:21627:21990:30054:30090,0,RBL:185.231.240.75:@virtuozzo.com:.lbl8.mailshell.net-62.2.3.100 64.100.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:29,LUA_SUMMARY:none X-HE-Tag: turn78_88d5087618003 X-Filterd-Recvd-Size: 2825 Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Fri, 31 Jan 2020 16:09:00 +0000 (UTC) Received: from dhcp-172-16-24-104.sw.ru ([172.16.24.104]) by relay.sw.ru with esmtp (Exim 4.92.3) (envelope-from ) id 1ixYqf-00030w-Uk; Fri, 31 Jan 2020 19:08:50 +0300 Subject: [PATCH v3] mm: Allocate shrinker_map on appropriate NUMA node To: Michal Hocko 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 References: <158047248934.390127.5043060848569612747.stgit@localhost.localdomain> <5f3fc9a9-9a22-ccc3-5971-9783b60807bc@virtuozzo.com> <20200131154735.GA4520@dhcp22.suse.cz> <20200131160151.GB4520@dhcp22.suse.cz> From: Kirill Tkhai Message-ID: Date: Fri, 31 Jan 2020 19:08:49 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <20200131160151.GB4520@dhcp22.suse.cz> Content-Language: en-US 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: mm: Allocate shrinker_map on appropriate NUMA node From: Kirill Tkhai 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 v3: Remove node_state() patterns. v2: Use NUMA_NO_NODE instead of -1. Acked-by: Michal Hocko Reviewed-by: David Hildenbrand Reviewed-by: Shakeel Butt Reviewed-by: Roman Gushchin --- 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;