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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4806C433EF for ; Wed, 8 Dec 2021 00:25:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4716C6B0072; Tue, 7 Dec 2021 19:25:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4210E6B0073; Tue, 7 Dec 2021 19:25:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C14E6B0074; Tue, 7 Dec 2021 19:25:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id 19C2C6B0072 for ; Tue, 7 Dec 2021 19:25:43 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CA1B9184D7AF3 for ; Wed, 8 Dec 2021 00:25:32 +0000 (UTC) X-FDA: 78892733304.07.2FF4B68 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf24.hostedemail.com (Postfix) with ESMTP id 3440CB0000A1 for ; Wed, 8 Dec 2021 00:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638923131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vL66q55dWWCdgYpPhLfU3fp1NwArxVg0aJUFZipYmVg=; b=RyuIxMK8135TrBdDORClr2yubTa7oRVbnoZAAOhlB+uMBcvp0yXb5qAMyyONdRC87DLndO lOde1Vjwl3u8eI1ic8aXTF9N+VlnIabn1ARgss/z+abrEBMnT6KtGlVNgQLaHrvjXXxBW2 l+ulgKw23fhikPYj/icppFdL8z4DlLo= Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-234-Ev00jKVKPpav3n4WRr6WfA-1; Tue, 07 Dec 2021 19:25:28 -0500 X-MC-Unique: Ev00jKVKPpav3n4WRr6WfA-1 Received: by mail-il1-f198.google.com with SMTP id i3-20020a056e021b0300b0029eceae8532so971613ilv.17 for ; Tue, 07 Dec 2021 16:25:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=vL66q55dWWCdgYpPhLfU3fp1NwArxVg0aJUFZipYmVg=; b=btqGTXH5P6XQAOvuxLFtHekyHGWkCKpnhcHTVs0M1cJrDXVARvcXzVSo9G+cCwpv4a uwmy3lXh+LpgPmyomgHBarCMEteSqYAuqIq31u11oFBwhk3YdcTH6RdmAliHEDVJK76b Yb2hJ2O1lW9AOB3bBC2d69bRe6TMbIz3BhMuDkUeNryUVSay/WtRgzfGRw/bfC8FDDwd TGCt0FxFwl39xFsxCsqnOfP8Uz2ojA2wXvJQoyXqW4WjC844cwPnryGBhQc+h2ouWgHZ 7L++Qhw4AQNv5UUhr3qC5qBCeU/7aQaFvExkoHgFAwf39Oz/TA8nzWPGviti74DfTAfI HqUA== X-Gm-Message-State: AOAM532Xmyw4Uonye1Af0MU3++vk9ZF86xhY3hul37OzELeLcNKx3Qjp E/C2C2u4yoy7Hph27TkOSEXING/7QuB2oqUvUszhdyzgJ9baZ9KCAZRKE9Am21J/NDJUd+ENR1e J81b55zgaWAY= X-Received: by 2002:a05:6638:1607:: with SMTP id x7mr56534056jas.27.1638923127543; Tue, 07 Dec 2021 16:25:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzXfTdYROr2ty3V9158qTk1ZTQBQ1cnMMfIFquYrZLWi36z/QOZojMKQAvzcw/3cICEXoCaA== X-Received: by 2002:a05:6638:1607:: with SMTP id x7mr56534028jas.27.1638923127373; Tue, 07 Dec 2021 16:25:27 -0800 (PST) Received: from ?IPV6:2601:280:4400:a2e0:7336:512c:930d:4f0e? ([2601:280:4400:a2e0:7336:512c:930d:4f0e]) by smtp.gmail.com with ESMTPSA id t6sm764024ios.13.2021.12.07.16.25.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Dec 2021 16:25:27 -0800 (PST) Message-ID: Date: Tue, 7 Dec 2021 19:25:25 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v2 1/1] mm/vmscan.c: Prevent allocating shrinker_info on offlined nodes To: Matthew Wilcox , 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 References: <20211207224013.880775-1-npache@redhat.com> <20211207224013.880775-2-npache@redhat.com> From: Nico Pache In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 3440CB0000A1 Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RyuIxMK8; spf=none (imf24.hostedemail.com: domain of npache@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=npache@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam04 X-Stat-Signature: brqbzsbg31qa5on6sch4hjo19631udjt X-HE-Tag: 1638923132-354475 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 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. >