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 4B9C3C433F5 for ; Tue, 7 Dec 2021 21:24:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 930F26B0071; Tue, 7 Dec 2021 16:24:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BA7A6B0072; Tue, 7 Dec 2021 16:24:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7336D6B0073; Tue, 7 Dec 2021 16:24:40 -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 5DF7D6B0071 for ; Tue, 7 Dec 2021 16:24:40 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 17D1C1846EF94 for ; Tue, 7 Dec 2021 21:24:30 +0000 (UTC) X-FDA: 78892277100.23.B9B3822 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf30.hostedemail.com (Postfix) with ESMTP id 5908CE001985 for ; Tue, 7 Dec 2021 21:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638912267; 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=Wn5kxaLGFOkCOE3vlVAq3FMKxlWOJF803iGWDpf7qyw=; b=RHXmZTDDrnX2s1EheIui9Dpcb+p8j3TqK2C7mMpRD6Iz2oJX1oP+CTEr0Gyyh7JeK+RC5F 3b3eAB+JzEuUEMCV08a7qCJbJ3515yx7uSa2dN/BMhd7xlp0ghHmefYgX1fr6w11DNmZT1 Or7bQo5C7RtOvck8J3/ZhS5sC6TFUXY= Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594-fWfSEnc8NQWUeJCzrFkaRg-1; Tue, 07 Dec 2021 16:24:26 -0500 X-MC-Unique: fWfSEnc8NQWUeJCzrFkaRg-1 Received: by mail-io1-f71.google.com with SMTP id g23-20020a6be617000000b005e245747fb4so569559ioh.15 for ; Tue, 07 Dec 2021 13:24:26 -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=Wn5kxaLGFOkCOE3vlVAq3FMKxlWOJF803iGWDpf7qyw=; b=isWo4IqNIBn+uOXnwXwcrB6vDvB35ipprwNbyWrNBYT39akpePN7ZErP5g+070p705 xco6+tOBTQZzlmu0klftLKUsnerUT/okoTCNApslb/5Y8ZUnHFoZBrVUV0+nnHaTy3FV ix1P06QFbL8qJzmJy/R1mbbJBQMbuUBhq3iAnAaKu5+/qI0T4oLgW3yYxgxe28y4XCsA qqFLIu0+SdcvFoRxMr32fc8439szIN8GVAU4NpdWuWmtw1jE+MrApeJO8GLMHfv07PUB +vSu89d4Jh45SBGS6fKotVlRPxqK4tOVH62d71U9Hc83OE/3Cp/I9FImiHOqNWY1Bf9y coXQ== X-Gm-Message-State: AOAM532Ut9WTz4LYqmmtyHIbn38WitzugCAIR1GXsTbabgxpF2OdsIWT CTbSguTYijdqaQYs2ZAJhxi78LA3KbXzKLMqiuJ8+KCP0e1zxkkRskWXbRKZLM+Nnatvbi7Xkm+ dAF+L7yCFJ+Q= X-Received: by 2002:a05:6602:2c83:: with SMTP id i3mr2361765iow.54.1638912265540; Tue, 07 Dec 2021 13:24:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPpiZvgvkFBP4jYV9P3L95Lz+9Veit4KuNNxL4nYOgfZpNG3y+qSMJ3QgmydN2zLJlshtlYg== X-Received: by 2002:a05:6602:2c83:: with SMTP id i3mr2361744iow.54.1638912265386; Tue, 07 Dec 2021 13:24:25 -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 b8sm679453ilj.0.2021.12.07.13.24.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 07 Dec 2021 13:24:24 -0800 (PST) Message-ID: <09c3b733-974a-8672-b267-6be1f0b6009b@redhat.com> Date: Tue, 7 Dec 2021 16:24:23 -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: [RFC PATCH 1/2] include/linux/gfp.h: Do not allocate pages on a offlined node To: Michal Hocko 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, Rafael Aquini References: <20211206033338.743270-1-npache@redhat.com> <20211206033338.743270-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-Server: rspam09 X-Rspamd-Queue-Id: 5908CE001985 X-Stat-Signature: ge6ahp6t1mk1k7tcnsnp7ercs4poqamx Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RHXmZTDD; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf30.hostedemail.com: domain of npache@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=npache@redhat.com X-HE-Tag: 1638912269-89076 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/6/21 04:22, Michal Hocko wrote: > On Sun 05-12-21 22:33:37, Nico Pache wrote: >> We shouldn't allocate pages on a unavailable node. Add a check for this >> in __alloc_pages_node and return NULL to avoid issues further down the >> callchain. >> >> Also update the VM_WARN_ON in __alloc_pages_node which could skip this >> warn if the gfp_mask is not GFP_THISNODE. > > Page allocator trusts callers to know they are doing a right thing so > that no unnecessary branches have to be implemented and the fast path is > really optimized for performance. Allocating from an !node_online node > is a bug in the caller. One that is not really that hard to make > unfortunatelly but also one that is is not that common. Thank you for your review, That makes sense. I will drop this patch on my second posting to avoid any performance regression. Cheers, -- Nico > > That being said I am not really sure we want to introduce this check. > >> Co-developed-by: Rafael Aquini >> Signed-off-by: Nico Pache >> --- >> include/linux/gfp.h | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/include/linux/gfp.h b/include/linux/gfp.h >> index b976c4177299..e7e18f6d0d9d 100644 >> --- a/include/linux/gfp.h >> +++ b/include/linux/gfp.h >> @@ -565,7 +565,10 @@ static inline struct page * >> __alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order) >> { >> VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); >> - VM_WARN_ON((gfp_mask & __GFP_THISNODE) && !node_online(nid)); >> + VM_WARN_ON(!node_online(nid)); >> + >> + if (!node_online(nid)) >> + return NULL; >> >> return __alloc_pages(gfp_mask, order, nid, NULL); >> } >> -- >> 2.33.1 >