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 A505DC433F5 for ; Tue, 7 Dec 2021 10:16:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14E4E6B00AD; Tue, 7 Dec 2021 05:15:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0FD566B00AE; Tue, 7 Dec 2021 05:15:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE0286B00AF; Tue, 7 Dec 2021 05:15:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id DF5BE6B00AD for ; Tue, 7 Dec 2021 05:15:50 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A8B068249980 for ; Tue, 7 Dec 2021 10:15:40 +0000 (UTC) X-FDA: 78890591640.20.78AD0A2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf01.hostedemail.com (Postfix) with ESMTP id 18D7740002 for ; Tue, 7 Dec 2021 10:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638872139; 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=ZOdfiEUFnQ8oq2ledal/kWkSxPZYiIBUvxwXeK8aWUA=; b=CnqRx3Q2lxEu9cYVJTlYPQgrIJCiYdLfhjlel9JKVDbFLEmmbp18TeMuDoMttzz0swBj7p zTIL9EKx26mOcQ1rrPKDuOOcx7+X2MkYAGig+WzjIMXr+Cr69kp8NfsA+sxWj5icEXGLXL 69LskYqNZHv6AK4N8IzNJUaAB32AZQA= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-212-cDcIypEUMqSJWrnO722-cw-1; Tue, 07 Dec 2021 05:15:36 -0500 X-MC-Unique: cDcIypEUMqSJWrnO722-cw-1 Received: by mail-wr1-f70.google.com with SMTP id q17-20020adff791000000b00183e734ba48so2762238wrp.8 for ; Tue, 07 Dec 2021 02:15:36 -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 :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=ZOdfiEUFnQ8oq2ledal/kWkSxPZYiIBUvxwXeK8aWUA=; b=G8CyRmmdq7O20MJ55waC1hMe0IqB2pcI3OXOpJbFBnmUZ1MjLxjFJzxGVDcMjvYtAd /RfWai8w/avs6e3DMqAuYCOwMWHgmjfSSt90PmU312ewpj7SvRXp61gIF7wZq6nVEAPP SRX8z+HCbJr8miByitI5Rsgt9Ey0cJ2UZAOMqdhDF3RtqilQ4CkC1NMBPHwXMmE7WrVx 9MDs+K7hxTyydaRA7Sr3vVzDwi4mJtraYeNcAYgMqd576ilPTzNpf7Z3X//E0/nMv9so ymhouUt5+YFW9tcVmuRDtobtVl8OgqF01ff9Wi3B0Q6N3iLhx+VYfwJfRaXvBgMn0pUj cT4Q== X-Gm-Message-State: AOAM532YRCYbAIMfZIDYj/aO9azkt6n6aehWOy151uc1mcduPvDKVc19 7gx0IRKk7n+8sp6+BF0CYrrnA/UYE4q1U5C1aCre8I/QAl+NA/RCLtLnAEsOXvxhWoUYNgSS41X SsPlXBf+Hm2c= X-Received: by 2002:adf:f444:: with SMTP id f4mr50062316wrp.538.1638872135229; Tue, 07 Dec 2021 02:15:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjRZw4P1L3VF7aNsoSNqPgbOYmZC4eaeb0kk2GB4Q6/89DHiu9q+me6oPZTwQdDuHUNivETg== X-Received: by 2002:adf:f444:: with SMTP id f4mr50062285wrp.538.1638872135005; Tue, 07 Dec 2021 02:15:35 -0800 (PST) Received: from [192.168.3.132] (p4ff23e57.dip0.t-ipconnect.de. [79.242.62.87]) by smtp.gmail.com with ESMTPSA id j18sm2615766wmq.44.2021.12.07.02.15.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Dec 2021 02:15:34 -0800 (PST) Message-ID: <0c5a157f-82cb-0ac8-9955-8f19469454bb@redhat.com> Date: Tue, 7 Dec 2021 11:15:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 To: Yang Shi Cc: Kirill Tkhai , Michal Hocko , Nico Pache , Linux Kernel Mailing List , Linux MM , Andrew Morton , Shakeel Butt , Roman Gushchin , Vlastimil Babka , Vladimir Davydov , raquini@redhat.com References: <20211206033338.743270-1-npache@redhat.com> <20211206033338.743270-3-npache@redhat.com> <24b4455c-aff9-ca9f-e29f-350833e7a0d1@virtuozzo.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [RFC PATCH 2/2] mm/vmscan.c: Prevent allocating shrinker_info on offlined nodes 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-Server: rspam10 X-Rspamd-Queue-Id: 18D7740002 X-Stat-Signature: jab81bwfiw37z3aatdgoycaduqy6u3am Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=CnqRx3Q2; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf01.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-HE-Tag: 1638872139-572383 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: >> >> Short term I tend to like [2], because it avoids having to mess with all >> such instances to eventually get it right and the temporary overhead >> until we have the code reworked should be really negligible ... > > Thanks, David. Basically either option looks fine to me. But I'm a > little bit concerned about [2]. It silently changes the node requested > by the callers. It actually papers over potential bugs? And what if Hi, It's just a preferred node, so we do have a node fallback already via the zonelist to other nodes for proper online nodes -- and would have the proper node fallback when preallcoating all pgdat. *Not* doing the fallback with a preferred node that is not online could be considered a BUG instead. Note that [2] was just a quick draft. We might have to do some minor adjustments to handle __GFP_THISNODE properly. But after all, we have: VM_WARN_ON((gfp_mask & __GFP_THISNODE) && !node_online(nid)); in __alloc_pages_node() and __folio_alloc_node(). So it might not be worth adjusting at all. > the callers specify __GFP_THISNODE (I didn't search if such callers > really exist in the current code)? > > How's about a helper function, for example, called > kvmalloc_best_node()? It does: > > void * kvmalloc_best_node(unsigned long size, int flag, int nid) > { > bool onlined = node_online(nid); > > WARN_ON_ONCE((flag & __GFP_THISNODE) && !onlined); > > if (!onlined) > nid = -1; > > return kvmalloc_node(size, GFP_xxx, nid); > } We still have to "fix" each and every affected for_each_node() ... code until we have preallcoation of pgdat for all possible nodes. -- Thanks, David / dhildenb