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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 854DEC33CB7 for ; Fri, 31 Jan 2020 15:49:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 23F2A2173E for ; Fri, 31 Jan 2020 15:49:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 23F2A2173E 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 C21746B05BD; Fri, 31 Jan 2020 10:49:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BAAB66B05C0; Fri, 31 Jan 2020 10:49:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A24AB6B05C1; Fri, 31 Jan 2020 10:49:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0187.hostedemail.com [216.40.44.187]) by kanga.kvack.org (Postfix) with ESMTP id 894CA6B05BD for ; Fri, 31 Jan 2020 10:49:43 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4CC1A824805A for ; Fri, 31 Jan 2020 15:49:43 +0000 (UTC) X-FDA: 76438364646.14.limit67_71eecb48f7e17 X-HE-Tag: limit67_71eecb48f7e17 X-Filterd-Recvd-Size: 2174 Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Fri, 31 Jan 2020 15:49:42 +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 1ixYXt-0002sK-0i; Fri, 31 Jan 2020 18:49:25 +0300 Subject: Re: [PATCH v2] 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> From: Kirill Tkhai Message-ID: Date: Fri, 31 Jan 2020 18:49:24 +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: <20200131154735.GA4520@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 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? Kirill